mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add package for sharing jest configuration for upcoming Features (#7198)
* Add package for shared jest configurations for Lens applications, Features and libraries. Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Add root level script for running unit tests in monorepo mindset Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Ignore coverage files from VCS Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> --------- Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
1 parent
114db72485
commit
73230c8659
11 files changed
+1902
-154
No files matched your search
@@ -0,0 +1,55 @@
|
||||
module.exports = (rootDir) => {
|
||||
const shared = {
|
||||
transform: {
|
||||
"^.+\\.(t|j)sx?$": ["@swc/jest", { cwd: rootDir }],
|
||||
},
|
||||
|
||||
clearMocks: true,
|
||||
coverageDirectory: "coverage",
|
||||
coverageProvider: "v8",
|
||||
coverageReporters: ["lcov"],
|
||||
collectCoverage: true,
|
||||
testMatch: ["**/?(*.)+(test).{js,ts,tsx}"],
|
||||
watchPathIgnorePatterns: ["/node_modules/", "/coverage/", "/build/"],
|
||||
|
||||
collectCoverageFrom: [
|
||||
"<rootDir>/src/**/*.{ts,tsx}",
|
||||
"!<rootDir>/src/**/*.no-coverage.ts",
|
||||
],
|
||||
|
||||
moduleNameMapper: {
|
||||
"^electron$": "identity-obj-proxy",
|
||||
},
|
||||
|
||||
coverageThreshold: {
|
||||
global: {
|
||||
branches: 100,
|
||||
functions: 100,
|
||||
lines: 100,
|
||||
statements: 100,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const configForNode = {
|
||||
...shared,
|
||||
testEnvironment: "node",
|
||||
};
|
||||
|
||||
const configForReact = {
|
||||
...shared,
|
||||
|
||||
moduleNameMapper: {
|
||||
"\\.(css|scss)$": "identity-obj-proxy",
|
||||
...shared.moduleNameMapper,
|
||||
},
|
||||
|
||||
testEnvironment: "jsdom",
|
||||
setupFilesAfterEnv: [`${__dirname}/setup-react-tests.ts`],
|
||||
};
|
||||
|
||||
return {
|
||||
configForReact,
|
||||
configForNode,
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user