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:
Daniel Tschinder 2018-03-05 16:04:29 +01:00 committed by GitHub
parent f9857ca6ba
commit a340a2614f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 12 deletions

View File

@ -78,10 +78,12 @@
},
"jest": {
"collectCoverageFrom": [
"packages/*/src/**/*.mjs",
"packages/*/src/**/*.js",
"codemods/*/src/**/*.mjs",
"codemods/*/src/**/*.js"
],
"testRegex": "./(packages|codemods)/[^/]+/test/.+\\.js$",
"testRegex": "./(packages|codemods)/[^/]+/test/.+\\.m?js$",
"testPathIgnorePatterns": [
"/node_modules/",
"/test/fixtures/",
@ -90,24 +92,23 @@
"/test/tmp/",
"/test/__data__/",
"/test/helpers/",
"<rootDir>/test/warning.js",
"<rootDir>/test/warning\\.js",
"<rootDir>/build/",
"_browser.js"
"_browser\\.js"
],
"testEnvironment": "node",
"setupTestFrameworkScriptFile": "<rootDir>/test/testSetupFile.js",
"transformIgnorePatterns": [
"/node_modules/",
"/test/fixtures/",
"/test/tmp/",
"/test/__data__/",
"/lib/"
],
"modulePaths": [
"<rootDir>/packages/"
"<rootDir>/packages/babel-standalone/babel(\\.min)?\\.js",
"<rootDir>/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js",
"/test/(fixtures|tmp|__data__)/",
"<rootDir>/(packages|codemods)/[^/]+/lib/"
],
"modulePathIgnorePatterns": [
"/test/fixtures/",
"/test/tmp/",
"/test/__data__/",
"<rootDir>/build/"
]
}

View File

@ -34,7 +34,7 @@ describe("@babel/register - caching", () => {
beforeEach(() => {
// Since lib/cache is a singleton we need to fully reload it
jest.resetModuleRegistry();
jest.resetModules();
const cache = require("../lib/cache");
load = cache.load;

View File

@ -55,7 +55,7 @@ describe("@babel/register", function() {
currentHook = null;
currentOptions = null;
sourceMapSupport = false;
jest.resetModuleRegistry();
jest.resetModules();
});
test("registers hook correctly", () => {