mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
Summary: This commit is a bit of a shotgun fix for various project settings. Realistically, they could've been separate commits, but this is convenience for just getting things into a green state to unblock further work. Details: - Use our version of TS in vscode plugins - organize vscode/settings.json - fix tsconfig.test and tsconfig.prod (removes errors in test files) - only use prod tsconfig in webpack - point .eslintrc to both test and prod configs - cleanup storybook - running eslint in my workspace was OOMing. I configured maxWorkers like we had in v1 to fix this. - remove .storybook from code coverage - remove .js files from code coverage --> after moving away from Next.js, we don't allowJS in our tsconfig anymore. We only use JS for configurations, it's not allowed in src code!
67 lines
1.9 KiB
JavaScript
67 lines
1.9 KiB
JavaScript
// REMARK: Jest is supposed to never exceed 50% maxWorkers by default. However,
|
|
// there seems to be an issue with this in our Ubuntu-based workspaces.
|
|
// If we don't limit it, then 100% CPU and high MEM usage is hit
|
|
// unexpectedly, leading to OOM kills.
|
|
//
|
|
// SEE thread: https://github.com/coder/coder/pull/483#discussion_r829636583
|
|
const maxWorkers = process.env.CI ? 16 : 2
|
|
|
|
module.exports = {
|
|
maxWorkers,
|
|
projects: [
|
|
{
|
|
globals: {
|
|
"ts-jest": {
|
|
tsconfig: "./tsconfig.test.json",
|
|
},
|
|
},
|
|
coverageReporters: ["text", "lcov"],
|
|
displayName: "test",
|
|
preset: "ts-jest",
|
|
|
|
roots: ["<rootDir>"],
|
|
setupFilesAfterEnv: ["./jest.setup.ts"],
|
|
transform: {
|
|
"^.+\\.tsx?$": "ts-jest",
|
|
},
|
|
testEnvironment: "jsdom",
|
|
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
|
|
testPathIgnorePatterns: ["/node_modules/", "/__tests__/fakes", "/e2e/"],
|
|
moduleDirectories: ["node_modules", "<rootDir>"],
|
|
},
|
|
{
|
|
displayName: "lint",
|
|
runner: "jest-runner-eslint",
|
|
testMatch: ["<rootDir>/**/*.js", "<rootDir>/**/*.ts", "<rootDir>/**/*.tsx"],
|
|
testPathIgnorePatterns: ["/out/", "/_jest/", "jest.config.js", "jest-runner.*.js"],
|
|
},
|
|
],
|
|
collectCoverageFrom: [
|
|
// included files
|
|
"<rootDir>/**/*.ts",
|
|
"<rootDir>/**/*.tsx",
|
|
// excluded files
|
|
"!<rootDir>/**/*.stories.tsx",
|
|
"!<rootDir>/_jest/**/*.*",
|
|
"!<rootDir>/api.ts",
|
|
"!<rootDir>/coverage/**/*.*",
|
|
"!<rootDir>/e2e/**/*.*",
|
|
"!<rootDir>/jest-runner.eslint.config.js",
|
|
"!<rootDir>/jest.config.js",
|
|
"!<rootDir>/webpack.*.ts",
|
|
"!<rootDir>/out/**/*.*",
|
|
"!<rootDir>/storybook-static/**/*.*",
|
|
],
|
|
reporters: [
|
|
"default",
|
|
[
|
|
"jest-junit",
|
|
{
|
|
suiteName: "Front-end Jest Tests",
|
|
outputDirectory: "./test-results",
|
|
outputName: "junit.xml",
|
|
},
|
|
],
|
|
],
|
|
}
|