Merge branch 'main' into 3.99
This commit is contained in:
@@ -30,6 +30,20 @@ describe('CallTracker', function() {
|
||||
expect(callTracker.argsFor(1)).toEqual([0, 'foo']);
|
||||
});
|
||||
|
||||
it("tracks the 'this' object from each execution", function() {
|
||||
var callTracker = new jasmineUnderTest.CallTracker();
|
||||
|
||||
var this0 = {},
|
||||
this1 = {};
|
||||
callTracker.track({ object: this0, args: [] });
|
||||
callTracker.track({ object: this1, args: [] });
|
||||
callTracker.track({ args: [] });
|
||||
|
||||
expect(callTracker.thisFor(0)).toBe(this0);
|
||||
expect(callTracker.thisFor(1)).toBe(this1);
|
||||
expect(callTracker.thisFor(2)).toBe(undefined);
|
||||
});
|
||||
|
||||
it('returns any empty array when there was no call', function() {
|
||||
var callTracker = new jasmineUnderTest.CallTracker();
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ describe('GlobalErrors', function() {
|
||||
errors.uninstall();
|
||||
});
|
||||
|
||||
it('reports uncaughtException in node.js', function() {
|
||||
it('reports uncaught exceptions in node.js', function() {
|
||||
var fakeGlobal = {
|
||||
process: {
|
||||
on: jasmine.createSpy('process.on'),
|
||||
@@ -170,7 +170,7 @@ describe('GlobalErrors', function() {
|
||||
);
|
||||
});
|
||||
|
||||
it('reports unhandledRejection in node.js', function() {
|
||||
it('reports unhandled promise rejections in node.js', function() {
|
||||
var fakeGlobal = {
|
||||
process: {
|
||||
on: jasmine.createSpy('process.on'),
|
||||
@@ -218,6 +218,38 @@ describe('GlobalErrors', function() {
|
||||
);
|
||||
});
|
||||
|
||||
it('reports unhandled promise rejections in node.js when no error is provided', function() {
|
||||
var fakeGlobal = {
|
||||
process: {
|
||||
on: jasmine.createSpy('process.on'),
|
||||
removeListener: function() {},
|
||||
listeners: function() {
|
||||
return [];
|
||||
},
|
||||
removeAllListeners: function() {}
|
||||
}
|
||||
},
|
||||
handler = jasmine.createSpy('errorHandler'),
|
||||
errors = new jasmineUnderTest.GlobalErrors(fakeGlobal);
|
||||
|
||||
errors.install();
|
||||
errors.pushListener(handler);
|
||||
|
||||
expect(fakeGlobal.process.on.calls.argsFor(1)[0]).toEqual(
|
||||
'unhandledRejection'
|
||||
);
|
||||
var addedListener = fakeGlobal.process.on.calls.argsFor(1)[1];
|
||||
addedListener(undefined);
|
||||
|
||||
expect(handler).toHaveBeenCalledWith(
|
||||
new Error(
|
||||
'Unhandled promise rejection with no error or message\n' +
|
||||
'(Tip: to get a useful stack trace, use ' +
|
||||
'Promise.reject(new Error(...)) instead of Promise.reject().)'
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
describe('Reporting unhandled promise rejections in the browser', function() {
|
||||
it('subscribes and unsubscribes from the unhandledrejection event', function() {
|
||||
var fakeGlobal = jasmine.createSpyObj('globalErrors', [
|
||||
|
||||
@@ -90,7 +90,7 @@ describe('SpyStrategy', function() {
|
||||
|
||||
expect(function() {
|
||||
spyStrategy.exec();
|
||||
}).toThrow({ code: 'ESRCH' });
|
||||
}).toThrow(jasmine.objectContaining({ code: 'ESRCH' }));
|
||||
expect(originalFn).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
|
||||
@@ -93,7 +93,6 @@ describe('asymmetricEqualityTesterArgCompatShim', function() {
|
||||
'flatMap',
|
||||
'includes',
|
||||
'keys',
|
||||
'toSource',
|
||||
'values'
|
||||
],
|
||||
shim = jasmineUnderTest.asymmetricEqualityTesterArgCompatShim({}, []),
|
||||
|
||||
@@ -683,8 +683,8 @@ describe('Env integration', function() {
|
||||
});
|
||||
|
||||
env.execute(null, function() {
|
||||
// Expect >= 9 rather than >= 10 to compensate for clock imprecision
|
||||
expect(duration).toBeGreaterThanOrEqual(9);
|
||||
// Expect > 0 to compensate for clock imprecision
|
||||
expect(duration).toBeGreaterThan(0);
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -2886,6 +2886,8 @@ describe('Env integration', function() {
|
||||
resolve = res;
|
||||
});
|
||||
|
||||
env.configure({ random: false });
|
||||
|
||||
env.describe('a suite', function() {
|
||||
env.it('does not wait', function() {
|
||||
// Note: we intentionally don't return the result of each expectAsync.
|
||||
@@ -2895,6 +2897,12 @@ describe('Env integration', function() {
|
||||
});
|
||||
});
|
||||
|
||||
env.it('another spec', function(done) {
|
||||
// This is here to make sure that the async expectation evaluates
|
||||
// before the Jasmine under test finishes, especially on Safari 8 and 9.
|
||||
setTimeout(done, 10);
|
||||
});
|
||||
|
||||
env.addReporter({
|
||||
specDone: function() {
|
||||
resolve();
|
||||
@@ -2941,6 +2949,8 @@ describe('Env integration', function() {
|
||||
resolve = res;
|
||||
});
|
||||
|
||||
env.configure({ random: false });
|
||||
|
||||
env.describe('a suite', function() {
|
||||
env.afterAll(function() {
|
||||
// Note: we intentionally don't return the result of expectAsync.
|
||||
@@ -2951,6 +2961,12 @@ describe('Env integration', function() {
|
||||
env.it('is a spec', function() {});
|
||||
});
|
||||
|
||||
env.it('another spec', function(done) {
|
||||
// This is here to make sure that the async expectation evaluates
|
||||
// before the Jasmine under test finishes, especially on Safari 8 and 9.
|
||||
setTimeout(done, 10);
|
||||
});
|
||||
|
||||
env.addReporter({
|
||||
suiteDone: function() {
|
||||
resolve();
|
||||
|
||||
@@ -99,4 +99,13 @@ describe('npm package', function() {
|
||||
expect(images).toContain('jasmine-horizontal.svg');
|
||||
expect(images).toContain('jasmine_favicon.png');
|
||||
});
|
||||
|
||||
it('does not have CI config files and scripts', function() {
|
||||
expect(fs.existsSync(path.resolve(this.tmpDir, 'package/.circleci'))).toBe(
|
||||
false
|
||||
);
|
||||
expect(fs.existsSync(path.resolve(this.tmpDir, 'package/scripts'))).toBe(
|
||||
false
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -43,9 +43,7 @@ module.exports = {
|
||||
browserVersion: process.env.SAUCE_BROWSER_VERSION,
|
||||
build: `Core ${process.env.TRAVIS_BUILD_NUMBER || 'Ran locally'}`,
|
||||
tags: ['Jasmine-Core'],
|
||||
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER
|
||||
? process.env.TRAVIS_JOB_NUMBER.toString()
|
||||
: null,
|
||||
tunnelIdentifier: process.env.SAUCE_TUNNEL_IDENTIFIER,
|
||||
username: process.env.SAUCE_USERNAME,
|
||||
accessKey: process.env.SAUCE_ACCESS_KEY
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"helpers/integrationMatchers.js",
|
||||
"helpers/promises.js",
|
||||
"helpers/requireFastCheck.js",
|
||||
"helpers/overrideConsoleLogForCircleCi.js",
|
||||
"helpers/nodeDefineJasmineUnderTest.js",
|
||||
"helpers/resetEnv.js"
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user