Adopt forbidDuplicateNames: true in jasmine-core's own tests
This commit is contained in:
+195
-187
@@ -242,7 +242,7 @@ describe('Clock', function() {
|
|||||||
expect(fakeGlobal.clearInterval).toBe(replacedClearInterval);
|
expect(fakeGlobal.clearInterval).toBe(replacedClearInterval);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('replaces the global timer functions on uninstall', function() {
|
it('restores the global timer functions on uninstall', function() {
|
||||||
const fakeSetTimeout = jasmine.createSpy('global setTimeout'),
|
const fakeSetTimeout = jasmine.createSpy('global setTimeout'),
|
||||||
fakeClearTimeout = jasmine.createSpy('global clearTimeout'),
|
fakeClearTimeout = jasmine.createSpy('global clearTimeout'),
|
||||||
fakeSetInterval = jasmine.createSpy('global setInterval'),
|
fakeSetInterval = jasmine.createSpy('global setInterval'),
|
||||||
@@ -408,211 +408,219 @@ describe('Clock', function() {
|
|||||||
expect(delayedFunctionScheduler.scheduleFunction).not.toHaveBeenCalled();
|
expect(delayedFunctionScheduler.scheduleFunction).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('schedules the delayed function (via setTimeout) with the fake timer', function() {
|
describe('setTimeout', function() {
|
||||||
const fakeSetTimeout = jasmine.createSpy('setTimeout'),
|
it('schedules the delayed function with the fake timer', function() {
|
||||||
scheduleFunction = jasmine.createSpy('scheduleFunction'),
|
const fakeSetTimeout = jasmine.createSpy('setTimeout'),
|
||||||
delayedFunctionScheduler = { scheduleFunction: scheduleFunction },
|
scheduleFunction = jasmine.createSpy('scheduleFunction'),
|
||||||
fakeGlobal = { setTimeout: fakeSetTimeout },
|
delayedFunctionScheduler = { scheduleFunction: scheduleFunction },
|
||||||
delayedFn = jasmine.createSpy('delayedFn'),
|
fakeGlobal = { setTimeout: fakeSetTimeout },
|
||||||
mockDate = {
|
delayedFn = jasmine.createSpy('delayedFn'),
|
||||||
install: function() {},
|
mockDate = {
|
||||||
tick: function() {},
|
install: function() {},
|
||||||
uninstall: function() {}
|
tick: function() {},
|
||||||
},
|
uninstall: function() {}
|
||||||
clock = new jasmineUnderTest.Clock(
|
|
||||||
fakeGlobal,
|
|
||||||
function() {
|
|
||||||
return delayedFunctionScheduler;
|
|
||||||
},
|
},
|
||||||
mockDate
|
clock = new jasmineUnderTest.Clock(
|
||||||
),
|
fakeGlobal,
|
||||||
timeout = new clock.FakeTimeout();
|
function() {
|
||||||
|
return delayedFunctionScheduler;
|
||||||
|
},
|
||||||
|
mockDate
|
||||||
|
),
|
||||||
|
timeout = new clock.FakeTimeout();
|
||||||
|
|
||||||
clock.install();
|
clock.install();
|
||||||
clock.setTimeout(delayedFn, 0, 'a', 'b');
|
clock.setTimeout(delayedFn, 0, 'a', 'b');
|
||||||
|
|
||||||
expect(fakeSetTimeout).not.toHaveBeenCalled();
|
expect(fakeSetTimeout).not.toHaveBeenCalled();
|
||||||
|
|
||||||
if (!NODE_JS) {
|
if (!NODE_JS) {
|
||||||
expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalledWith(
|
expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalledWith(
|
||||||
delayedFn,
|
delayedFn,
|
||||||
0,
|
0,
|
||||||
['a', 'b']
|
['a', 'b']
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalledWith(
|
expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalledWith(
|
||||||
delayedFn,
|
delayedFn,
|
||||||
0,
|
0,
|
||||||
['a', 'b'],
|
['a', 'b'],
|
||||||
false,
|
false,
|
||||||
timeout
|
timeout
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns an id for the delayed function', function() {
|
||||||
|
const fakeSetTimeout = jasmine.createSpy('setTimeout'),
|
||||||
|
scheduleId = 123,
|
||||||
|
scheduleFunction = jasmine
|
||||||
|
.createSpy('scheduleFunction')
|
||||||
|
.and.returnValue(scheduleId),
|
||||||
|
delayedFunctionScheduler = { scheduleFunction: scheduleFunction },
|
||||||
|
fakeGlobal = { setTimeout: fakeSetTimeout },
|
||||||
|
delayedFn = jasmine.createSpy('delayedFn'),
|
||||||
|
mockDate = {
|
||||||
|
install: function() {},
|
||||||
|
tick: function() {},
|
||||||
|
uninstall: function() {}
|
||||||
|
},
|
||||||
|
clock = new jasmineUnderTest.Clock(
|
||||||
|
fakeGlobal,
|
||||||
|
function() {
|
||||||
|
return delayedFunctionScheduler;
|
||||||
|
},
|
||||||
|
mockDate
|
||||||
|
);
|
||||||
|
|
||||||
|
clock.install();
|
||||||
|
const timeout = clock.setTimeout(delayedFn, 0);
|
||||||
|
|
||||||
|
if (!NODE_JS) {
|
||||||
|
expect(timeout).toEqual(123);
|
||||||
|
} else {
|
||||||
|
expect(timeout.constructor.name).toEqual('FakeTimeout');
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns an id for the delayed function', function() {
|
describe('clearTimeout', function() {
|
||||||
const fakeSetTimeout = jasmine.createSpy('setTimeout'),
|
it('clears the scheduled function with the scheduler', function() {
|
||||||
scheduleId = 123,
|
const fakeClearTimeout = jasmine.createSpy('clearTimeout'),
|
||||||
scheduleFunction = jasmine
|
delayedFunctionScheduler = jasmine.createSpyObj(
|
||||||
.createSpy('scheduleFunction')
|
'delayedFunctionScheduler',
|
||||||
.and.returnValue(scheduleId),
|
['removeFunctionWithId']
|
||||||
delayedFunctionScheduler = { scheduleFunction: scheduleFunction },
|
),
|
||||||
fakeGlobal = { setTimeout: fakeSetTimeout },
|
fakeGlobal = { setTimeout: fakeClearTimeout },
|
||||||
delayedFn = jasmine.createSpy('delayedFn'),
|
mockDate = {
|
||||||
mockDate = {
|
install: function() {},
|
||||||
install: function() {},
|
tick: function() {},
|
||||||
tick: function() {},
|
uninstall: function() {}
|
||||||
uninstall: function() {}
|
|
||||||
},
|
|
||||||
clock = new jasmineUnderTest.Clock(
|
|
||||||
fakeGlobal,
|
|
||||||
function() {
|
|
||||||
return delayedFunctionScheduler;
|
|
||||||
},
|
},
|
||||||
mockDate
|
clock = new jasmineUnderTest.Clock(
|
||||||
);
|
fakeGlobal,
|
||||||
|
function() {
|
||||||
|
return delayedFunctionScheduler;
|
||||||
|
},
|
||||||
|
mockDate
|
||||||
|
);
|
||||||
|
|
||||||
clock.install();
|
clock.install();
|
||||||
const timeout = clock.setTimeout(delayedFn, 0);
|
clock.clearTimeout(123);
|
||||||
|
|
||||||
if (!NODE_JS) {
|
expect(fakeClearTimeout).not.toHaveBeenCalled();
|
||||||
expect(timeout).toEqual(123);
|
expect(
|
||||||
} else {
|
delayedFunctionScheduler.removeFunctionWithId
|
||||||
expect(timeout.constructor.name).toEqual('FakeTimeout');
|
).toHaveBeenCalledWith(123);
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('clears the scheduled function with the scheduler', function() {
|
describe('setInterval', function() {
|
||||||
const fakeClearTimeout = jasmine.createSpy('clearTimeout'),
|
it('schedules the delayed function with the fake timer', function() {
|
||||||
delayedFunctionScheduler = jasmine.createSpyObj(
|
const fakeSetInterval = jasmine.createSpy('setInterval'),
|
||||||
'delayedFunctionScheduler',
|
scheduleFunction = jasmine.createSpy('scheduleFunction'),
|
||||||
['removeFunctionWithId']
|
delayedFunctionScheduler = { scheduleFunction: scheduleFunction },
|
||||||
),
|
fakeGlobal = { setInterval: fakeSetInterval },
|
||||||
fakeGlobal = { setTimeout: fakeClearTimeout },
|
delayedFn = jasmine.createSpy('delayedFn'),
|
||||||
mockDate = {
|
mockDate = {
|
||||||
install: function() {},
|
install: function() {},
|
||||||
tick: function() {},
|
tick: function() {},
|
||||||
uninstall: function() {}
|
uninstall: function() {}
|
||||||
},
|
|
||||||
clock = new jasmineUnderTest.Clock(
|
|
||||||
fakeGlobal,
|
|
||||||
function() {
|
|
||||||
return delayedFunctionScheduler;
|
|
||||||
},
|
},
|
||||||
mockDate
|
clock = new jasmineUnderTest.Clock(
|
||||||
);
|
fakeGlobal,
|
||||||
|
function() {
|
||||||
|
return delayedFunctionScheduler;
|
||||||
|
},
|
||||||
|
mockDate
|
||||||
|
),
|
||||||
|
timeout = new clock.FakeTimeout();
|
||||||
|
|
||||||
clock.install();
|
clock.install();
|
||||||
clock.clearTimeout(123);
|
clock.setInterval(delayedFn, 0, 'a', 'b');
|
||||||
|
|
||||||
expect(fakeClearTimeout).not.toHaveBeenCalled();
|
expect(fakeSetInterval).not.toHaveBeenCalled();
|
||||||
expect(delayedFunctionScheduler.removeFunctionWithId).toHaveBeenCalledWith(
|
|
||||||
123
|
if (!NODE_JS) {
|
||||||
);
|
expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalledWith(
|
||||||
|
delayedFn,
|
||||||
|
0,
|
||||||
|
['a', 'b'],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalledWith(
|
||||||
|
delayedFn,
|
||||||
|
0,
|
||||||
|
['a', 'b'],
|
||||||
|
true,
|
||||||
|
timeout
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns an id for the delayed function', function() {
|
||||||
|
const fakeSetInterval = jasmine.createSpy('setInterval'),
|
||||||
|
scheduleId = 123,
|
||||||
|
scheduleFunction = jasmine
|
||||||
|
.createSpy('scheduleFunction')
|
||||||
|
.and.returnValue(scheduleId),
|
||||||
|
delayedFunctionScheduler = { scheduleFunction: scheduleFunction },
|
||||||
|
fakeGlobal = { setInterval: fakeSetInterval },
|
||||||
|
delayedFn = jasmine.createSpy('delayedFn'),
|
||||||
|
mockDate = {
|
||||||
|
install: function() {},
|
||||||
|
tick: function() {},
|
||||||
|
uninstall: function() {}
|
||||||
|
},
|
||||||
|
clock = new jasmineUnderTest.Clock(
|
||||||
|
fakeGlobal,
|
||||||
|
function() {
|
||||||
|
return delayedFunctionScheduler;
|
||||||
|
},
|
||||||
|
mockDate
|
||||||
|
);
|
||||||
|
|
||||||
|
clock.install();
|
||||||
|
const interval = clock.setInterval(delayedFn, 0);
|
||||||
|
|
||||||
|
if (!NODE_JS) {
|
||||||
|
expect(interval).toEqual(123);
|
||||||
|
} else {
|
||||||
|
expect(interval.constructor.name).toEqual('FakeTimeout');
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('schedules the delayed function with the fake timer', function() {
|
describe('clearInterval', function() {
|
||||||
const fakeSetInterval = jasmine.createSpy('setInterval'),
|
it('clears the scheduled function with the scheduler', function() {
|
||||||
scheduleFunction = jasmine.createSpy('scheduleFunction'),
|
const clearInterval = jasmine.createSpy('clearInterval'),
|
||||||
delayedFunctionScheduler = { scheduleFunction: scheduleFunction },
|
delayedFunctionScheduler = jasmine.createSpyObj(
|
||||||
fakeGlobal = { setInterval: fakeSetInterval },
|
'delayedFunctionScheduler',
|
||||||
delayedFn = jasmine.createSpy('delayedFn'),
|
['removeFunctionWithId']
|
||||||
mockDate = {
|
),
|
||||||
install: function() {},
|
fakeGlobal = { setInterval: clearInterval },
|
||||||
tick: function() {},
|
mockDate = {
|
||||||
uninstall: function() {}
|
install: function() {},
|
||||||
},
|
tick: function() {},
|
||||||
clock = new jasmineUnderTest.Clock(
|
uninstall: function() {}
|
||||||
fakeGlobal,
|
|
||||||
function() {
|
|
||||||
return delayedFunctionScheduler;
|
|
||||||
},
|
},
|
||||||
mockDate
|
clock = new jasmineUnderTest.Clock(
|
||||||
),
|
fakeGlobal,
|
||||||
timeout = new clock.FakeTimeout();
|
function() {
|
||||||
|
return delayedFunctionScheduler;
|
||||||
|
},
|
||||||
|
mockDate
|
||||||
|
);
|
||||||
|
|
||||||
clock.install();
|
clock.install();
|
||||||
clock.setInterval(delayedFn, 0, 'a', 'b');
|
clock.clearInterval(123);
|
||||||
|
|
||||||
expect(fakeSetInterval).not.toHaveBeenCalled();
|
expect(clearInterval).not.toHaveBeenCalled();
|
||||||
|
expect(
|
||||||
if (!NODE_JS) {
|
delayedFunctionScheduler.removeFunctionWithId
|
||||||
expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalledWith(
|
).toHaveBeenCalledWith(123);
|
||||||
delayedFn,
|
});
|
||||||
0,
|
|
||||||
['a', 'b'],
|
|
||||||
true
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalledWith(
|
|
||||||
delayedFn,
|
|
||||||
0,
|
|
||||||
['a', 'b'],
|
|
||||||
true,
|
|
||||||
timeout
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
it('returns an id for the delayed function', function() {
|
|
||||||
const fakeSetInterval = jasmine.createSpy('setInterval'),
|
|
||||||
scheduleId = 123,
|
|
||||||
scheduleFunction = jasmine
|
|
||||||
.createSpy('scheduleFunction')
|
|
||||||
.and.returnValue(scheduleId),
|
|
||||||
delayedFunctionScheduler = { scheduleFunction: scheduleFunction },
|
|
||||||
fakeGlobal = { setInterval: fakeSetInterval },
|
|
||||||
delayedFn = jasmine.createSpy('delayedFn'),
|
|
||||||
mockDate = {
|
|
||||||
install: function() {},
|
|
||||||
tick: function() {},
|
|
||||||
uninstall: function() {}
|
|
||||||
},
|
|
||||||
clock = new jasmineUnderTest.Clock(
|
|
||||||
fakeGlobal,
|
|
||||||
function() {
|
|
||||||
return delayedFunctionScheduler;
|
|
||||||
},
|
|
||||||
mockDate
|
|
||||||
);
|
|
||||||
|
|
||||||
clock.install();
|
|
||||||
const interval = clock.setInterval(delayedFn, 0);
|
|
||||||
|
|
||||||
if (!NODE_JS) {
|
|
||||||
expect(interval).toEqual(123);
|
|
||||||
} else {
|
|
||||||
expect(interval.constructor.name).toEqual('FakeTimeout');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
it('clears the scheduled function with the scheduler', function() {
|
|
||||||
const clearInterval = jasmine.createSpy('clearInterval'),
|
|
||||||
delayedFunctionScheduler = jasmine.createSpyObj(
|
|
||||||
'delayedFunctionScheduler',
|
|
||||||
['removeFunctionWithId']
|
|
||||||
),
|
|
||||||
fakeGlobal = { setInterval: clearInterval },
|
|
||||||
mockDate = {
|
|
||||||
install: function() {},
|
|
||||||
tick: function() {},
|
|
||||||
uninstall: function() {}
|
|
||||||
},
|
|
||||||
clock = new jasmineUnderTest.Clock(
|
|
||||||
fakeGlobal,
|
|
||||||
function() {
|
|
||||||
return delayedFunctionScheduler;
|
|
||||||
},
|
|
||||||
mockDate
|
|
||||||
);
|
|
||||||
|
|
||||||
clock.install();
|
|
||||||
clock.clearInterval(123);
|
|
||||||
|
|
||||||
expect(clearInterval).not.toHaveBeenCalled();
|
|
||||||
expect(delayedFunctionScheduler.removeFunctionWithId).toHaveBeenCalledWith(
|
|
||||||
123
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('gives you a friendly reminder if the Clock is not installed and you tick', function() {
|
it('gives you a friendly reminder if the Clock is not installed and you tick', function() {
|
||||||
|
|||||||
@@ -470,20 +470,28 @@ describe('Matchers (Integration)', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('toBeNullish', function() {
|
describe('toBeNullish', function() {
|
||||||
verifyPasses(function(env) {
|
describe('with undefined', function() {
|
||||||
env.expect(undefined).toBeNullish();
|
verifyPasses(function(env) {
|
||||||
|
env.expect(undefined).toBeNullish();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
verifyPasses(function(env) {
|
describe('with null', function() {
|
||||||
env.expect(null).toBeNullish();
|
verifyPasses(function(env) {
|
||||||
|
env.expect(null).toBeNullish();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
verifyFails(function(env) {
|
describe('with a truthy value', function() {
|
||||||
env.expect(1).toBeNullish();
|
verifyFails(function(env) {
|
||||||
|
env.expect(1).toBeNullish();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
verifyFails(function(env) {
|
describe('with a non-null falsy value', function() {
|
||||||
env.expect('').toBeNullish();
|
verifyFails(function(env) {
|
||||||
|
env.expect('').toBeNullish();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -665,13 +673,17 @@ describe('Matchers (Integration)', function() {
|
|||||||
env.expect(spyObj).toHaveSpyInteractions();
|
env.expect(spyObj).toHaveSpyInteractions();
|
||||||
});
|
});
|
||||||
|
|
||||||
verifyFails(function(env) {
|
describe('with no methods called', function() {
|
||||||
env.expect(spyObj).toHaveSpyInteractions();
|
verifyFails(function(env) {
|
||||||
|
env.expect(spyObj).toHaveSpyInteractions();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
verifyFails(function(env) {
|
describe('with only non-spy methods called', function() {
|
||||||
spyObj.otherMethod();
|
verifyFails(function(env) {
|
||||||
env.expect(spyObj).toHaveSpyInteractions();
|
spyObj.otherMethod();
|
||||||
|
env.expect(spyObj).toHaveSpyInteractions();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -281,22 +281,44 @@ describe('toThrowError', function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('fails if thrown is a type of Error and the expected is a different Error', function() {
|
describe('with a string', function() {
|
||||||
const matchersUtil = {
|
it('fails if thrown is a type of Error and the expected is a different Error', function() {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.returnValue(false),
|
const matchersUtil = {
|
||||||
pp: jasmineUnderTest.makePrettyPrinter()
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(false),
|
||||||
},
|
pp: jasmineUnderTest.makePrettyPrinter()
|
||||||
matcher = jasmineUnderTest.matchers.toThrowError(matchersUtil),
|
},
|
||||||
fn = function() {
|
matcher = jasmineUnderTest.matchers.toThrowError(matchersUtil),
|
||||||
throw new TypeError('foo');
|
fn = function() {
|
||||||
};
|
throw new TypeError('foo');
|
||||||
|
};
|
||||||
|
|
||||||
const result = matcher.compare(fn, TypeError, 'bar');
|
const result = matcher.compare(fn, TypeError, 'bar');
|
||||||
|
|
||||||
expect(result.pass).toBe(false);
|
expect(result.pass).toBe(false);
|
||||||
expect(result.message()).toEqual(
|
expect(result.message()).toEqual(
|
||||||
"Expected function to throw TypeError with message 'bar', but it threw TypeError with message 'foo'."
|
"Expected function to throw TypeError with message 'bar', but it threw TypeError with message 'foo'."
|
||||||
);
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('with a regex', function() {
|
||||||
|
it('fails if thrown is a type of Error and the expected is a different Error', function() {
|
||||||
|
const matchersUtil = {
|
||||||
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(false),
|
||||||
|
pp: jasmineUnderTest.makePrettyPrinter()
|
||||||
|
},
|
||||||
|
matcher = jasmineUnderTest.matchers.toThrowError(matchersUtil),
|
||||||
|
fn = function() {
|
||||||
|
throw new TypeError('foo');
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = matcher.compare(fn, TypeError, /bar/);
|
||||||
|
|
||||||
|
expect(result.pass).toBe(false);
|
||||||
|
expect(result.message()).toEqual(
|
||||||
|
"Expected function to throw TypeError with a message matching /bar/, but it threw TypeError with message 'foo'."
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('passes if thrown is a type of Error and has the same type as the expected Error and the message matches the expected message', function() {
|
it('passes if thrown is a type of Error and has the same type as the expected Error and the message matches the expected message', function() {
|
||||||
@@ -316,22 +338,4 @@ describe('toThrowError', function() {
|
|||||||
'Expected function not to throw TypeError with a message matching /foo/.'
|
'Expected function not to throw TypeError with a message matching /foo/.'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('fails if thrown is a type of Error and the expected is a different Error', function() {
|
|
||||||
const matchersUtil = {
|
|
||||||
equals: jasmine.createSpy('delegated-equal').and.returnValue(false),
|
|
||||||
pp: jasmineUnderTest.makePrettyPrinter()
|
|
||||||
},
|
|
||||||
matcher = jasmineUnderTest.matchers.toThrowError(matchersUtil),
|
|
||||||
fn = function() {
|
|
||||||
throw new TypeError('foo');
|
|
||||||
};
|
|
||||||
|
|
||||||
const result = matcher.compare(fn, TypeError, /bar/);
|
|
||||||
|
|
||||||
expect(result.pass).toBe(false);
|
|
||||||
expect(result.message()).toEqual(
|
|
||||||
"Expected function to throw TypeError with a message matching /bar/, but it threw TypeError with message 'foo'."
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ module.exports = {
|
|||||||
'helpers/defineJasmineUnderTest.js',
|
'helpers/defineJasmineUnderTest.js',
|
||||||
'helpers/resetEnv.js'
|
'helpers/resetEnv.js'
|
||||||
],
|
],
|
||||||
|
env: {
|
||||||
|
forbidDuplicateNames: true
|
||||||
|
},
|
||||||
random: true,
|
random: true,
|
||||||
browser: {
|
browser: {
|
||||||
name: process.env.JASMINE_BROWSER || 'firefox',
|
name: process.env.JASMINE_BROWSER || 'firefox',
|
||||||
|
|||||||
@@ -12,5 +12,8 @@
|
|||||||
"helpers/nodeDefineJasmineUnderTest.js",
|
"helpers/nodeDefineJasmineUnderTest.js",
|
||||||
"helpers/resetEnv.js"
|
"helpers/resetEnv.js"
|
||||||
],
|
],
|
||||||
|
"env": {
|
||||||
|
"forbidDuplicateNames": true
|
||||||
|
},
|
||||||
"random": true
|
"random": true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user