-
-
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.
feat: support
concurrent
in Jest Each (#9326)
- Loading branch information
Showing
22 changed files
with
649 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. 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. | ||
*/ | ||
import {json as runWithJson} from '../runJest'; | ||
|
||
it('works with concurrent.each', () => { | ||
const {json} = runWithJson('circus-concurrent', [ | ||
'concurrent-each.test.js', | ||
'--testRunner=jest-circus/runner', | ||
]); | ||
expect(json.numTotalTests).toBe(4); | ||
expect(json.numPassedTests).toBe(2); | ||
expect(json.numFailedTests).toBe(0); | ||
expect(json.numPendingTests).toBe(2); | ||
}); | ||
|
||
it('works with concurrent.only.each', () => { | ||
const {json} = runWithJson('circus-concurrent', [ | ||
'concurrent-only-each.test.js', | ||
'--testRunner=jest-circus/runner', | ||
]); | ||
expect(json.numTotalTests).toBe(4); | ||
expect(json.numPassedTests).toBe(2); | ||
expect(json.numFailedTests).toBe(0); | ||
expect(json.numPendingTests).toBe(2); | ||
}); |
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,20 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. 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. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
it.concurrent.each([ | ||
[1, 2], | ||
[2, 3], | ||
])('adds one to number', async (a, b) => { | ||
expect(a + 1).toBe(b); | ||
}); | ||
|
||
it.concurrent.skip.each([ | ||
[1, 2], | ||
[2, 3], | ||
])('should skip this test', Promise.resolve()); |
22 changes: 22 additions & 0 deletions
22
e2e/circus-concurrent/__tests__/concurrent-only-each.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,22 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. 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. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
it.concurrent.only.each([ | ||
[1, 2], | ||
[2, 3], | ||
])('adds one to number', async (a, b) => { | ||
expect(a + 1).toBe(b); | ||
}); | ||
|
||
it.concurrent.each([ | ||
[1, 2], | ||
[2, 3], | ||
])('adds one to number', async (a, b) => { | ||
expect(a + 1).toBe(b); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. 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. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
it.concurrent.each([ | ||
[1, 2], | ||
[2, 3], | ||
])('adds one to number', async (a, b) => { | ||
expect(a + 1).toBe(b); | ||
}); | ||
|
||
it.concurrent.skip.each([ | ||
[1, 2], | ||
[2, 3], | ||
])('should skip this test', Promise.resolve()); |
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,22 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. 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. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
it.concurrent.only.each([ | ||
[1, 2], | ||
[2, 3], | ||
])('adds one to number', async (a, b) => { | ||
expect(a + 1).toBe(b); | ||
}); | ||
|
||
it.concurrent.each([ | ||
[1, 2], | ||
[2, 3], | ||
])('adds one to number', async (a, b) => { | ||
expect(a + 1).toBe(b); | ||
}); |
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.