-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Add each to jest-cirucs #6309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add each to jest-cirucs #6309
Changes from 7 commits
17546bf
fe973ab
3bb5231
3d5e4ca
eb43bb3
6bbd790
c773fe1
464ce7d
ace0d06
2883ba0
4861776
4d21e8b
c4fcf55
1a0213d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,10 +14,8 @@ const runJest = require('../runJest'); | |
| const {extractSummary} = require('../Utils'); | ||
| const dir = path.resolve(__dirname, '../each'); | ||
| const SkipOnWindows = require('../../scripts/SkipOnWindows'); | ||
| const SkipOnJestCircus = require('../../scripts/SkipOnJestCircus'); | ||
|
|
||
| SkipOnWindows.suite(); | ||
|
||
| SkipOnJestCircus.suite(); | ||
|
|
||
| test('works with passing tests', () => { | ||
| const result = runJest(dir, ['success.test.js']); | ||
|
|
@@ -50,7 +48,14 @@ test('shows only the tests with .only as being ran', () => { | |
|
|
||
| test('shows only the tests without .skip as being ran', () => { | ||
| const result = runJest(dir, ['each-skip.test.js']); | ||
| const {rest} = extractSummary(result.stderr); | ||
| expect(rest).toMatchSnapshot(); | ||
| expect(result.status).toBe(0); | ||
| }); | ||
|
|
||
| test('runs only the describe.only.each tests', () => { | ||
| const result = runJest(dir, ['describe-only.test.js']); | ||
| const {rest} = extractSummary(result.stderr); | ||
| expect(rest).toMatchSnapshot(); | ||
| expect(result.status).toBe(0); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /** | ||
| * 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. | ||
| */ | ||
|
|
||
| describe.only.each([[true, true], [true, true]])( | ||
| 'passes all rows expected %s == %s', | ||
| (left, right) => { | ||
| it('passes', () => { | ||
| expect(left).toBe(right); | ||
| }); | ||
| } | ||
| ); | ||
|
|
||
| // This failing tests should never because of the above `only` so the suite | ||
| // should pass | ||
| describe.each([[false, true]])( | ||
| 'fails all rows expected %s == %s', | ||
| (left, right) => { | ||
| it('fails', () => { | ||
| expect(left).toBe(right); | ||
| }); | ||
| } | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,25 @@ | ||
| /** | ||
| * Copyright (c) 2014-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 | ||
| */ | ||
|
|
||
| import bind from './bind'; | ||
| import arrayEach from './array'; | ||
| import templateEach from './template'; | ||
|
|
||
| const each = (...args) => { | ||
| const each = (...args: any) => { | ||
|
||
| if (args.length > 1) { | ||
| return templateEach(global)(...args); | ||
| } | ||
|
|
||
| return arrayEach(global)(...args); | ||
| }; | ||
|
|
||
| each.withGlobal = g => (...args) => { | ||
| each.withGlobal = g => (...args: any) => { | ||
| if (args.length > 1) { | ||
| return templateEach(g)(...args); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now part of master, not
23.0.1😅There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed :)