-
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
To speed up tests execution. hyperfine --warmup 5 --prepare "nx reset && nx clear-cache" \ --runs 100 "nx run-many -t lint" Time (mean ± σ): 2.759s ± 0.027s [User: 3.324s, System: 0.219s] Range (min … max): 2.690s … 2.870s 100 runs hyperfine --warmup 5 --prepare "nx reset && nx clear-cache" \ --runs 100 "nx run-many -t build" Time (mean ± σ): 1.815s ± 0.018s [User: 1.763s, System: 0.140s] Range (min … max): 1.775s … 1.904s 100 runs hyperfine --warmup 5 --prepare "nx reset && nx clear-cache" \ --runs 100 "nx run-many -t test" Time (mean ± σ): 1.668s ± 0.008s [User: 0.802s, System: 0.137s] Range (min … max): 1.643s … 1.689s 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
7175602
commit 2689c86
Showing
4 changed files
with
51 additions
and
19 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/my-nutri' | ||
} | ||
|
||
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
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