Fix reseting modules in jest and config (#7494)
* Fix reseting modules in jest and config we have lib folders inside the source folders which should not be ignored. * Add codemods lib folder * Support mjs * improve ignore pattern
This commit is contained in:
parent
f9857ca6ba
commit
a340a2614f
21
package.json
21
package.json
@ -78,10 +78,12 @@
|
|||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"collectCoverageFrom": [
|
"collectCoverageFrom": [
|
||||||
|
"packages/*/src/**/*.mjs",
|
||||||
"packages/*/src/**/*.js",
|
"packages/*/src/**/*.js",
|
||||||
|
"codemods/*/src/**/*.mjs",
|
||||||
"codemods/*/src/**/*.js"
|
"codemods/*/src/**/*.js"
|
||||||
],
|
],
|
||||||
"testRegex": "./(packages|codemods)/[^/]+/test/.+\\.js$",
|
"testRegex": "./(packages|codemods)/[^/]+/test/.+\\.m?js$",
|
||||||
"testPathIgnorePatterns": [
|
"testPathIgnorePatterns": [
|
||||||
"/node_modules/",
|
"/node_modules/",
|
||||||
"/test/fixtures/",
|
"/test/fixtures/",
|
||||||
@ -90,24 +92,23 @@
|
|||||||
"/test/tmp/",
|
"/test/tmp/",
|
||||||
"/test/__data__/",
|
"/test/__data__/",
|
||||||
"/test/helpers/",
|
"/test/helpers/",
|
||||||
"<rootDir>/test/warning.js",
|
"<rootDir>/test/warning\\.js",
|
||||||
"<rootDir>/build/",
|
"<rootDir>/build/",
|
||||||
"_browser.js"
|
"_browser\\.js"
|
||||||
],
|
],
|
||||||
"testEnvironment": "node",
|
"testEnvironment": "node",
|
||||||
"setupTestFrameworkScriptFile": "<rootDir>/test/testSetupFile.js",
|
"setupTestFrameworkScriptFile": "<rootDir>/test/testSetupFile.js",
|
||||||
"transformIgnorePatterns": [
|
"transformIgnorePatterns": [
|
||||||
"/node_modules/",
|
"/node_modules/",
|
||||||
"/test/fixtures/",
|
"<rootDir>/packages/babel-standalone/babel(\\.min)?\\.js",
|
||||||
"/test/tmp/",
|
"<rootDir>/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js",
|
||||||
"/test/__data__/",
|
"/test/(fixtures|tmp|__data__)/",
|
||||||
"/lib/"
|
"<rootDir>/(packages|codemods)/[^/]+/lib/"
|
||||||
],
|
|
||||||
"modulePaths": [
|
|
||||||
"<rootDir>/packages/"
|
|
||||||
],
|
],
|
||||||
"modulePathIgnorePatterns": [
|
"modulePathIgnorePatterns": [
|
||||||
"/test/fixtures/",
|
"/test/fixtures/",
|
||||||
|
"/test/tmp/",
|
||||||
|
"/test/__data__/",
|
||||||
"<rootDir>/build/"
|
"<rootDir>/build/"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ describe("@babel/register - caching", () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
// Since lib/cache is a singleton we need to fully reload it
|
// Since lib/cache is a singleton we need to fully reload it
|
||||||
jest.resetModuleRegistry();
|
jest.resetModules();
|
||||||
const cache = require("../lib/cache");
|
const cache = require("../lib/cache");
|
||||||
|
|
||||||
load = cache.load;
|
load = cache.load;
|
||||||
|
|||||||
@ -55,7 +55,7 @@ describe("@babel/register", function() {
|
|||||||
currentHook = null;
|
currentHook = null;
|
||||||
currentOptions = null;
|
currentOptions = null;
|
||||||
sourceMapSupport = false;
|
sourceMapSupport = false;
|
||||||
jest.resetModuleRegistry();
|
jest.resetModules();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("registers hook correctly", () => {
|
test("registers hook correctly", () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user