-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
15b43d6
commit 49b2380
Showing
29 changed files
with
416 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`shows error messages when called with invalid argument 1`] = ` | ||
"FAIL __tests__/todo_non_string.test.js | ||
● Test suite failed to run | ||
Todo must be called with only a description. | ||
6 | */ | ||
7 | | ||
> 8 | it.todo(() => {}); | ||
| ^ | ||
9 | | ||
at __tests__/todo_non_string.test.js:8:4 | ||
" | ||
`; | ||
|
||
exports[`shows error messages when called with multiple arguments 1`] = ` | ||
"FAIL __tests__/todo_multiple_args.test.js | ||
● Test suite failed to run | ||
Todo must be called with only a description. | ||
6 | */ | ||
7 | | ||
> 8 | it.todo('todo later', () => {}); | ||
| ^ | ||
9 | | ||
at __tests__/todo_multiple_args.test.js:8:4 | ||
" | ||
`; | ||
|
||
exports[`shows error messages when called with no arguments 1`] = ` | ||
"FAIL __tests__/todo_no_args.test.js | ||
● Test suite failed to run | ||
Todo must be called with only a description. | ||
6 | */ | ||
7 | | ||
> 8 | it.todo(); | ||
| ^ | ||
9 | | ||
at __tests__/todo_no_args.test.js:8:4 | ||
" | ||
`; | ||
|
||
exports[`works with all statuses 1`] = ` | ||
"FAIL __tests__/statuses.test.js | ||
✓ passes | ||
✕ fails | ||
○ skipped 1 test | ||
✎ todo 1 test | ||
● fails | ||
expect(received).toBe(expected) // Object.is equality | ||
Expected: 101 | ||
Received: 10 | ||
11 | | ||
12 | it('fails', () => { | ||
> 13 | expect(10).toBe(101); | ||
| ^ | ||
14 | }); | ||
15 | | ||
16 | it.skip('skips', () => { | ||
at __tests__/statuses.test.js:13:14 | ||
" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* Copyright (c) 2018-present, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const path = require('path'); | ||
const runJest = require('../runJest'); | ||
const {extractSummary} = require('../Utils'); | ||
const dir = path.resolve(__dirname, '../test-todo'); | ||
|
||
test('works with all statuses', () => { | ||
const result = runJest(dir, ['statuses.test.js']); | ||
expect(result.status).toBe(1); | ||
const {rest} = extractSummary(result.stderr); | ||
expect(rest).toMatchSnapshot(); | ||
}); | ||
|
||
test('shows error messages when called with no arguments', () => { | ||
const result = runJest(dir, ['todo_no_args.test.js']); | ||
expect(result.status).toBe(1); | ||
const {rest} = extractSummary(result.stderr); | ||
expect(rest).toMatchSnapshot(); | ||
}); | ||
|
||
test('shows error messages when called with multiple arguments', () => { | ||
const result = runJest(dir, ['todo_multiple_args.test.js']); | ||
expect(result.status).toBe(1); | ||
const {rest} = extractSummary(result.stderr); | ||
expect(rest).toMatchSnapshot(); | ||
}); | ||
|
||
test('shows error messages when called with invalid argument', () => { | ||
const result = runJest(dir, ['todo_non_string.test.js']); | ||
expect(result.status).toBe(1); | ||
const {rest} = extractSummary(result.stderr); | ||
expect(rest).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Copyright (c) 2018-present, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
it('passes', () => { | ||
expect(10).toBe(10); | ||
}); | ||
|
||
it('fails', () => { | ||
expect(10).toBe(101); | ||
}); | ||
|
||
it.skip('skips', () => { | ||
expect(10).toBe(101); | ||
}); | ||
|
||
it.todo('todo'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* Copyright (c) 2018-present, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
it.todo('todo later', () => {}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* Copyright (c) 2018-present, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
it.todo(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* Copyright (c) 2018-present, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
it.todo(() => {}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"jest": { | ||
"testEnvironment": "node" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
packages/jest-circus/src/__tests__/circus_todo_test_error.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow strict-local | ||
*/ | ||
|
||
'use strict'; | ||
|
||
let circusIt; | ||
|
||
// using jest-jasmine2's 'it' to test jest-circus's 'it'. Had to differentiate | ||
// the two with this alias. | ||
|
||
const aliasCircusIt = () => { | ||
const {it} = require('../index.js'); | ||
circusIt = it; | ||
}; | ||
|
||
aliasCircusIt(); | ||
|
||
describe('test/it.todo error throwing', () => { | ||
it('todo throws error when given no arguments', () => { | ||
expect(() => { | ||
// $FlowFixMe: Testing runitme errors here | ||
circusIt.todo(); | ||
}).toThrowError('Todo must be called with only a description.'); | ||
}); | ||
it('todo throws error when given more than one argument', () => { | ||
expect(() => { | ||
circusIt.todo('test1', () => {}); | ||
}).toThrowError('Todo must be called with only a description.'); | ||
}); | ||
it('todo throws error when given none string description', () => { | ||
expect(() => { | ||
// $FlowFixMe: Testing runitme errors here | ||
circusIt.todo(() => {}); | ||
}).toThrowError('Todo must be called with only a description.'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.