-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(apps/app): Setup SWC tests compilation
In order to speed up test executions. hyperfine --warmup 5 --prepare "nx reset && nx clear-cache" \ --runs 100 "nx run-many -t lint" Time (mean ± σ): 2.751s ± 0.040s [User: 3.329s, System: 0.220s] Range (min…max): 2.692s … 2.861s 100 runs hyperfine --warmup 5 --prepare "nx reset && nx clear-cache" \ --runs 100 "nx run-many -t build" Time (mean ± σ): 1.785s ± 0.017s [User: 1.751s, System: 0.139s] Range (min…max): 1.750s … 1.834s 100 runs hyperfine --warmup 5 --prepare "nx reset && nx clear-cache" \ --runs 100 "nx run-many -t test" Time (mean ± σ): 1.657s ± 0.006s [User: 0.800s, System: 0.139s] Range (min…max): 1.623s … 1.679s 100 runs More: - https://docs.nestjs.com/recipes/swc#monorepo - nrwl/nx#11289 (comment) - jestjs/jest#9430 - https://npmjs.com/package/jest_workaround
- Loading branch information
1 parent
f62782c
commit ddf5381
Showing
4 changed files
with
43 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,33 @@ | ||
let jestConfigObject = { | ||
module.exports = { | ||
displayName: 'app', | ||
preset: '../../jest.preset.js', | ||
testEnvironment: 'node', | ||
transform: { | ||
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }] | ||
}, | ||
moduleFileExtensions: ['ts', 'js', 'html'], | ||
coverageDirectory: '../../coverage/apps/app' | ||
} | ||
|
||
if (process.env.NODE_ENV === 'CI' || process.env.CI === 'true') { | ||
jestConfigObject.transform = { | ||
'^.+\\.[tj]s$': [ | ||
'ts-jest', | ||
'@swc/jest', | ||
{ | ||
tsconfig: '<rootDir>/tsconfig.spec.json', | ||
isolatedModules: true, | ||
diagnostics: false | ||
sourceMaps: true, | ||
module: { | ||
type: 'commonjs', | ||
strict: true, | ||
strictMode: true | ||
}, | ||
jsc: { | ||
parser: { | ||
syntax: 'typescript', | ||
decorators: true, | ||
dynamicImport: true | ||
}, | ||
transform: { | ||
legacyDecorator: true, | ||
decoratorMetadata: true | ||
}, | ||
target: 'es2021' | ||
}, | ||
minify: false | ||
} | ||
] | ||
} | ||
}, | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], | ||
coverageDirectory: '../../coverage/apps/app' | ||
} | ||
|
||
module.exports = jestConfigObject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,4 @@ | |
"src/**/*.spec.ts", | ||
"src/**/*.d.ts" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters