-
-
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.
Use realpath to match transformers (#5000)
* Use realpath to match transformers This will use the realpath to match the transformers in case the path is a symlink. This will solve an issue where files which are linked by lerna or npm link are not transformed. Currently a solution for this problem would be a configuration like: ```json { "transformIgnorePatterns": [ "<rootDir>/node_modules/" ] } ``` * Add Changelog * Use native realpath * Add integration test * Remove unneeded import
- Loading branch information
Showing
9 changed files
with
55 additions
and
1 deletion.
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
12 changes: 12 additions & 0 deletions
12
integration_tests/__tests__/transform-linked-modules.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 @@ | ||
// @flow | ||
|
||
'use strict'; | ||
|
||
const runJest = require('../runJest'); | ||
|
||
it('should transform linked modules', () => { | ||
const result = runJest.json('transform-linked-modules', ['--no-cache']).json; | ||
|
||
expect(result.success).toBe(true); | ||
expect(result.numTotalTests).toBe(2); | ||
}); |
9 changes: 9 additions & 0 deletions
9
integration_tests/transform-linked-modules/__tests__/linked-modules.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,9 @@ | ||
test('normal file', () => { | ||
const normal = require('../ignored/normal'); | ||
expect(normal).toEqual('ignored/normal'); | ||
}); | ||
|
||
test('symlink', () => { | ||
const symlink = require('../ignored/symlink'); | ||
expect(symlink).toEqual('transformed'); | ||
}); |
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 @@ | ||
module.exports = 'ignored/normal'; |
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 @@ | ||
../package/index.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,13 @@ | ||
{ | ||
"jest": { | ||
"testEnvironment": "node", | ||
"transformIgnorePatterns": [ | ||
"/node_modules/", | ||
"<rootDir>/__tests__", | ||
"<rootDir>/ignored/" | ||
], | ||
"transform": { | ||
"^.+\\.js$": "<rootDir>/preprocessor.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 @@ | ||
module.exports = 'package/index'; |
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 @@ | ||
module.exports = { | ||
process() { | ||
return 'module.exports = "transformed"'; | ||
}, | ||
}; |
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