mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-17 13:13:49 +01:00
JEST: Test faster by removing barrels (#1645)
This commit is contained in:
parent
dd59612121
commit
3d7a6f70d8
@ -2,7 +2,7 @@ module.exports = {
|
||||
roots: ["<rootDir>/src/", "<rootDir>/test/"],
|
||||
moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
|
||||
transform: {
|
||||
"^.+\\.(js|jsx|ts|tsx)$": "babel-jest",
|
||||
"^.+\\.(js|jsx|ts|tsx|cjs|mjs)$": "<rootDir>/test/jest/config/babelTransform.js",
|
||||
},
|
||||
transformIgnorePatterns: ["node_modules/(?!react-markdown)/"],
|
||||
testPathIgnorePatterns: [".cypress", "node_modules", "dist"],
|
||||
@ -15,7 +15,7 @@ module.exports = {
|
||||
".*?raw$": "<rootDir>/test/__mocks__/fileMock.js",
|
||||
"@player": "<rootDir>/src/Player",
|
||||
"@enums": "<rootDir>/src/Enums",
|
||||
"@nsdefs": "<rootDir>/src/ScriptEditor/NetscriptDefinitions",
|
||||
"@nsdefs": "<rootDir>/src/ScriptEditor/NetscriptDefinitions.d.ts",
|
||||
"^monaco-editor$": "<rootDir>/test/__mocks__/NullMock.js",
|
||||
"^monaco-vim$": "<rootDir>/test/__mocks__/NullMock.js",
|
||||
"/utils/Protections$": "<rootDir>/test/__mocks__/NullMock.js",
|
||||
|
11
package-lock.json
generated
11
package-lock.json
generated
@ -73,6 +73,7 @@
|
||||
"@typescript-eslint/parser": "^6.9.1",
|
||||
"babel-jest": "^29.7.0",
|
||||
"babel-loader": "^9.1.3",
|
||||
"babel-plugin-transform-barrels": "github:cmfrydos/babel-plugin-transform-barrels#46a8aa71cf67a544f7144b47d67f3027424e5cdb",
|
||||
"copy-webpack-plugin": "^12.0.2",
|
||||
"css-loader": "^6.8.1",
|
||||
"electron": "^29.4.5",
|
||||
@ -6313,6 +6314,16 @@
|
||||
"@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/babel-plugin-transform-barrels": {
|
||||
"version": "1.0.16",
|
||||
"resolved": "git+ssh://git@github.com/cmfrydos/babel-plugin-transform-barrels.git#46a8aa71cf67a544f7144b47d67f3027424e5cdb",
|
||||
"integrity": "sha512-/W8yq9bmjGmwZB3KH3np0aj2Kwq1glFSR8mlvb1LMALpNOO24XWfCTZDPO1saqR8HTcF8ZS5Gk+WSq2FeT84ZQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fast-glob": "^3.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/babel-preset-current-node-syntax": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz",
|
||||
|
@ -74,6 +74,7 @@
|
||||
"@typescript-eslint/parser": "^6.9.1",
|
||||
"babel-jest": "^29.7.0",
|
||||
"babel-loader": "^9.1.3",
|
||||
"babel-plugin-transform-barrels": "github:cmfrydos/babel-plugin-transform-barrels#46a8aa71cf67a544f7144b47d67f3027424e5cdb",
|
||||
"copy-webpack-plugin": "^12.0.2",
|
||||
"css-loader": "^6.8.1",
|
||||
"electron": "^29.4.5",
|
||||
|
16
test/jest/config/babelTransform.js
Normal file
16
test/jest/config/babelTransform.js
Normal file
@ -0,0 +1,16 @@
|
||||
const babelJest = require("babel-jest").default;
|
||||
|
||||
module.exports = {
|
||||
process(sourceText, sourcePath, options) {
|
||||
const alias = options?.config?.moduleNameMapper;
|
||||
const extensions = options.config.moduleFileExtensions;
|
||||
const babelTransformer = babelJest.createTransformer({
|
||||
presets: [["@babel/preset-react"], ["@babel/preset-env"], ["@babel/preset-typescript"]],
|
||||
plugins: [["transform-barrels", { executorName: "jest", alias: alias, extensions: extensions }]],
|
||||
babelrc: false,
|
||||
configFile: false,
|
||||
});
|
||||
|
||||
return babelTransformer.process(sourceText, sourcePath, options);
|
||||
},
|
||||
};
|
Loading…
Reference in New Issue
Block a user