File tree Expand file tree Collapse file tree 6 files changed +95
-0
lines changed
transform/babel-jest-manual Expand file tree Collapse file tree 6 files changed +95
-0
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,21 @@ describe('babel-jest ignored', () => {
5757 } ) ;
5858} ) ;
5959
60+ describe ( 'babel-jest with manual transformer' , ( ) => {
61+ const dir = path . resolve ( __dirname , '..' , 'transform/babel-jest-manual' ) ;
62+
63+ beforeEach ( ( ) => {
64+ run ( 'yarn' , dir ) ;
65+ } ) ;
66+
67+ it ( 'runs transpiled code' , ( ) => {
68+ // --no-cache because babel can cache stuff and result in false green
69+ const { json} = runWithJson ( dir , [ '--no-cache' ] ) ;
70+ expect ( json . success ) . toBe ( true ) ;
71+ expect ( json . numTotalTests ) . toBeGreaterThanOrEqual ( 1 ) ;
72+ } ) ;
73+ } ) ;
74+
6075// babel-jest is automatically linked at the root because it is a workspace now
6176// a way to test this in isolation is to move the test suite into a temp folder
6277describe ( 'no babel-jest' , ( ) => {
Original file line number Diff line number Diff line change 1+ /**
2+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
3+ *
4+ * This source code is licensed under the MIT license found in the
5+ * LICENSE file in the root directory of this source tree.
6+ */
7+
8+ 'use strict' ;
9+
10+ require ( '../foo' ) ;
11+
12+ it ( 'strips flowtypes using babel-jest and .babelrc' , ( ) => {
13+ const a : string = 'a' ;
14+ expect ( a ) . toBe ( 'a' ) ;
15+ } ) ;
Original file line number Diff line number Diff line change 1+ /**
2+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
3+ *
4+ * This source code is licensed under the MIT license found in the
5+ * LICENSE file in the root directory of this source tree.
6+ */
7+
8+ const someFunction = ( ) : null = > null ;
9+
10+ module . exports = someFunction ( ) ;
Original file line number Diff line number Diff line change 1+ {
2+ "dependencies" : {
3+ "@babel/preset-flow" : " ^7.0.0"
4+ },
5+ "jest" : {
6+ "testEnvironment" : " node" ,
7+ "transform" : {
8+ "\\ .js$" : " <rootDir>/transformer.js"
9+ }
10+ }
11+ }
Original file line number Diff line number Diff line change 1+ /**
2+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
3+ *
4+ * This source code is licensed under the MIT license found in the
5+ * LICENSE file in the root directory of this source tree.
6+ */
7+
8+ const { createTransformer} = require ( 'babel-jest' ) ;
9+
10+ module . exports = createTransformer ( {
11+ presets : [ '@babel/preset-flow' ] ,
12+ root : __dirname ,
13+ } ) ;
Original file line number Diff line number Diff line change 1+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2+ # yarn lockfile v1
3+
4+
5+ " @babel/helper-plugin-utils@^7.0.0 " :
6+ version "7.0.0"
7+ resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz#bbb3fbee98661c569034237cc03967ba99b4f250"
8+ integrity sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA==
9+
10+ " @babel/plugin-syntax-flow@^7.0.0 " :
11+ version "7.0.0"
12+ resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.0.0.tgz#70638aeaad9ee426bc532e51523cff8ff02f6f17"
13+ integrity sha512-zGcuZWiWWDa5qTZ6iAnpG0fnX/GOu49pGR5PFvkQ9GmKNaSphXQnlNXh/LG20sqWtNrx/eB6krzfEzcwvUyeFA==
14+ dependencies :
15+ " @babel/helper-plugin-utils" " ^7.0.0"
16+
17+ " @babel/plugin-transform-flow-strip-types@^7.0.0 " :
18+ version "7.0.0"
19+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.0.0.tgz#c40ced34c2783985d90d9f9ac77a13e6fb396a01"
20+ integrity sha512-WhXUNb4It5a19RsgKKbQPrjmy4yWOY1KynpEbNw7bnd1QTcrT/EIl3MJvnGgpgvrKyKbqX7nUNOJfkpLOnoDKA==
21+ dependencies :
22+ " @babel/helper-plugin-utils" " ^7.0.0"
23+ " @babel/plugin-syntax-flow" " ^7.0.0"
24+
25+ " @babel/preset-flow@^7.0.0 " :
26+ version "7.0.0"
27+ resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.0.0.tgz#afd764835d9535ec63d8c7d4caf1c06457263da2"
28+ integrity sha512-bJOHrYOPqJZCkPVbG1Lot2r5OSsB+iUOaxiHdlOeB1yPWS6evswVHwvkDLZ54WTaTRIk89ds0iHmGZSnxlPejQ==
29+ dependencies :
30+ " @babel/helper-plugin-utils" " ^7.0.0"
31+ " @babel/plugin-transform-flow-strip-types" " ^7.0.0"
You can’t perform that action at this time.
0 commit comments