cal.pub0.org/jest.config.ts

62 lines
2.0 KiB
TypeScript
Raw Normal View History

2022-03-23 21:32:46 +00:00
/*
* For a detailed explanation regarding each configuration property and type check, visit:
* https://jestjs.io/docs/en/configuration.html
*/
const config = {
2022-03-23 21:32:46 +00:00
clearMocks: true,
2022-03-25 05:54:57 +00:00
coverageDirectory: "./coverage",
collectCoverage: true,
2022-03-30 12:17:55 +00:00
collectCoverageFrom: ["pages/api/**/*.ts"],
2022-03-23 21:32:46 +00:00
// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
// "/node_modules/"
// ],
// Indicates which provider should be used to instrument code for coverage
// coverageProvider: "babel",
// A list of reporter names that Jest uses when writing coverage reports
2022-03-30 12:17:55 +00:00
coverageReporters: ["json", "text", "lcov", "clover"],
2022-03-23 21:32:46 +00:00
// An object that configures minimum threshold enforcement for coverage results
2022-03-26 04:28:53 +00:00
coverageThreshold: {
global: {
lines: 50,
functions: 40,
branches: 50,
statements: 50,
},
},
2022-03-23 21:32:46 +00:00
// A path to a custom dependency extractor
// dependencyExtractor: undefined,
// Make calling deprecated APIs throw helpful error messages
2022-03-25 05:54:57 +00:00
errorOnDeprecated: true,
2022-03-23 21:32:46 +00:00
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
2022-03-25 05:54:57 +00:00
maxWorkers: "50%",
2022-03-23 21:32:46 +00:00
moduleNameMapper: {
"^@lib/(.*)$": "<rootDir>/lib/$1",
2022-03-25 05:54:57 +00:00
"^@api/(.*)$": "<rootDir>/pages/api/$1",
},
2022-03-23 21:32:46 +00:00
// The paths to modules that run some code to configure or set up the testing environment before each test
// setupFiles: [],
// A list of paths to modules that run some code to configure or set up the testing framework before each test
2022-03-30 12:17:55 +00:00
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
2022-03-23 21:32:46 +00:00
// The number of seconds after which a test is considered as slow and reported as such in the results.
2022-03-26 04:28:53 +00:00
slowTestThreshold: 0.1,
2022-03-23 21:32:46 +00:00
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
// snapshotSerializers: [],
// The test environment that will be used for testing
testEnvironment: "node",
};
export default config;