Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

### Fixes

- `[jest-circus]` Omitting test function now causes test to skip ([#6965](https://github.com/facebook/jest/pull/7013))
- `[jest-haste-map]` [**BREAKING**] Replace internal data structures to improve performance ([#6960](https://github.com/facebook/jest/pull/6960))
- `[jest-haste-map]` Do not visit again files with the same sha-1 ([#6990](https://github.com/facebook/jest/pull/6990))
- `[jest-jasmine2]` Fix memory leak in Error objects hold by the framework ([#6965](https://github.com/facebook/jest/pull/6965))
- `[jest-jasmine2]` Omitting test function now causes test to skip ([#6965](https://github.com/facebook/jest/pull/7013))
- `[jest-haste-map]` Fixed Haste whitelist generation for scoped modules on Windows ([#6980](https://github.com/facebook/jest/pull/6980))
- `[jest-mock]` Fix inheritance of static properties and methods in mocks ([#7003](https://github.com/facebook/jest/pull/7003))
- `[jest-mock]` Fix mocking objects without `Object.prototype` in their prototype chain ([#7003](https://github.com/facebook/jest/pull/7003))
Expand Down
10 changes: 4 additions & 6 deletions packages/jest-circus/src/__tests__/circus_it_test_error.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ describe('test/it error throwing', () => {
circusIt('test1', () => {});
}).not.toThrowError();
});
it(`it throws error with missing callback function`, () => {
it(`it doesn't throw an error with missing callback function`, () => {
expect(() => {
// $FlowFixMe: Easy, we're testing runitme errors here
circusIt('test2');
}).toThrowError('Missing second argument. It must be a callback function.');
}).not.toThrowError();
});
it(`it throws an error when first argument isn't a string`, () => {
expect(() => {
Expand All @@ -58,11 +57,10 @@ describe('test/it error throwing', () => {
circusTest('test5', () => {});
}).not.toThrowError();
});
it(`test throws error with missing callback function`, () => {
it(`test doesn't throw an error with missing callback function`, () => {
expect(() => {
// $FlowFixMe: Easy, we're testing runitme errors here
circusTest('test6');
}).toThrowError('Missing second argument. It must be a callback function.');
}).not.toThrowError();
});
it(`test throws an error when first argument isn't a string`, () => {
expect(() => {
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-circus/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ const afterEach: THook = (fn, timeout) =>
const afterAll: THook = (fn, timeout) =>
_addHook(fn, 'afterAll', afterAll, timeout);

const test = (testName: TestName, fn: TestFn, timeout?: number) => {
const test = (testName: TestName, fn?: TestFn, timeout?: number) => {
if (typeof testName !== 'string') {
throw new Error(
`Invalid first argument, ${testName}. It must be a string.`,
);
}
if (fn === undefined) {
throw new Error('Missing second argument. It must be a callback function.');
return test.skip(testName, () => {});
}
if (typeof fn !== 'function') {
throw new Error(
Expand Down
10 changes: 0 additions & 10 deletions packages/jest-jasmine2/src/__tests__/it_test_error.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
'use strict';

describe('test/it error throwing', () => {
it(`it throws error with missing callback function`, () => {
expect(() => {
it('test1');
}).toThrowError('Missing second argument. It must be a callback function.');
});
it(`it throws an error when first argument isn't a string`, () => {
expect(() => {
it(() => {});
Expand All @@ -26,11 +21,6 @@ describe('test/it error throwing', () => {
`Invalid second argument, test3b. It must be a callback function.`,
);
});
test(`test throws error with missing callback function`, () => {
expect(() => {
test('test4');
}).toThrowError('Missing second argument. It must be a callback function.');
});
test(`test throws an error when first argument isn't a string`, () => {
expect(() => {
test(() => {});
Expand Down
4 changes: 1 addition & 3 deletions packages/jest-jasmine2/src/jasmine/Env.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,7 @@ export default function(j$) {
);
}
if (fn === undefined) {
throw new Error(
'Missing second argument. It must be a callback function.',
);
return this.xit(description, () => {});
}
if (typeof fn !== 'function') {
throw new Error(
Expand Down