-
-
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: add async support to babel-jest (#11192)
- Loading branch information
Showing
13 changed files
with
338 additions
and
70 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
12 changes: 12 additions & 0 deletions
12
e2e/transform/babel-jest-async/__tests__/babelJest.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,12 @@ | ||
/** | ||
* 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 nullReturningFunc from '../only-file-to-transform.js'; | ||
|
||
it('strips flowtypes using babel-jest', () => { | ||
expect(nullReturningFunc()).toBe(null); | ||
}); |
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,10 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
const someFunction = (): null => null; | ||
|
||
export default someFunction; |
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,12 @@ | ||
{ | ||
"type": "module", | ||
"dependencies": { | ||
"@babel/preset-flow": "^7.0.0" | ||
}, | ||
"jest": { | ||
"testEnvironment": "node", | ||
"transform": { | ||
"only-file-to-transform\\.js$": "<rootDir>/transformer.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,19 @@ | ||
/** | ||
* 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 {fileURLToPath} from 'url'; | ||
import babelJest from 'babel-jest'; | ||
|
||
export default { | ||
...babelJest.default.createTransformer({ | ||
presets: ['@babel/preset-flow'], | ||
root: fileURLToPath(import.meta.url), | ||
}), | ||
// remove the synchronous functions | ||
getCacheKey: undefined, | ||
process: undefined, | ||
}; |
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,56 @@ | ||
# This file is generated by running "yarn install" inside your project. | ||
# Manual changes might be lost - proceed with caution! | ||
|
||
__metadata: | ||
version: 4 | ||
cacheKey: 7 | ||
|
||
"@babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.13.0": | ||
version: 7.13.0 | ||
resolution: "@babel/helper-plugin-utils@npm:7.13.0" | ||
checksum: 229ac1917b43ad38732d2d4a9a826f87d8945719249efe1d6191f3e25ba6027a289af70380d82d62a03fc9e82558a0ea6f12739cbb55b64bb280d6b511b4ca65 | ||
languageName: node | ||
linkType: hard | ||
|
||
"@babel/plugin-syntax-flow@npm:^7.12.13": | ||
version: 7.12.13 | ||
resolution: "@babel/plugin-syntax-flow@npm:7.12.13" | ||
dependencies: | ||
"@babel/helper-plugin-utils": ^7.12.13 | ||
peerDependencies: | ||
"@babel/core": ^7.0.0-0 | ||
checksum: de8845354dda62b7857a518a54f85bf30809ed1d7cc5ace93ced6da16d095cba78487d18651f1b2277db58d8e749cb910c703f96529af198369226e374df5f73 | ||
languageName: node | ||
linkType: hard | ||
|
||
"@babel/plugin-transform-flow-strip-types@npm:^7.12.13": | ||
version: 7.13.0 | ||
resolution: "@babel/plugin-transform-flow-strip-types@npm:7.13.0" | ||
dependencies: | ||
"@babel/helper-plugin-utils": ^7.13.0 | ||
"@babel/plugin-syntax-flow": ^7.12.13 | ||
peerDependencies: | ||
"@babel/core": ^7.0.0-0 | ||
checksum: 60903f5e3619b4f4a19d6d00a4d10c5b97566f5d4c56dd35ccdaa6e621fc955ec4003f12cd73ec99475894a7eca6a34aa4b38f87c7c81e93d5fe03d006aae77b | ||
languageName: node | ||
linkType: hard | ||
|
||
"@babel/preset-flow@npm:^7.0.0": | ||
version: 7.12.13 | ||
resolution: "@babel/preset-flow@npm:7.12.13" | ||
dependencies: | ||
"@babel/helper-plugin-utils": ^7.12.13 | ||
"@babel/plugin-transform-flow-strip-types": ^7.12.13 | ||
peerDependencies: | ||
"@babel/core": ^7.0.0-0 | ||
checksum: 47fe1001194a57fbdb33250adcb4c3aa9ff551cfb4eea1a16b123ff5fe78730a7ebfb839bacbe18390fc50fa4bf67fdd5293703b859876de45d52f50d4da0d44 | ||
languageName: node | ||
linkType: hard | ||
|
||
"root-workspace-0b6124@workspace:.": | ||
version: 0.0.0-use.local | ||
resolution: "root-workspace-0b6124@workspace:." | ||
dependencies: | ||
"@babel/preset-flow": ^7.0.0 | ||
languageName: unknown | ||
linkType: soft |
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.