mirror of
https://github.com/vale981/apollo-server
synced 2025-03-05 09:41:40 -05:00
Configure Jest to import local modules from src
instead of dist
The Jest `moduleNameMapper` option allows us to match module names and transform the path that will be used to import them. If the resulting module is written in TypeScript, it will then be compiled by `ts-jest`, similar to relative imports within the package under test.
This commit is contained in:
parent
68f4e83fb2
commit
6c2f8d7583
1 changed files with 4 additions and 1 deletions
|
@ -16,7 +16,10 @@ module.exports = {
|
|||
"/dist/"
|
||||
],
|
||||
moduleFileExtensions: [...defaults.moduleFileExtensions, "ts", "tsx"],
|
||||
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/../../' }),
|
||||
moduleNameMapper: {
|
||||
...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/../../' }),
|
||||
'^(?!apollo-server-env|apollo-engine-reporting-protobuf)(apollo-(?:server|datasource|cache-control|tracing|engine)[^/]*|graphql-extensions)(?:/dist)?((?:/.*)|$)': '<rootDir>/../../packages/$1/src$2',
|
||||
},
|
||||
clearMocks: true,
|
||||
globals: {
|
||||
"ts-jest": {
|
||||
|
|
Loading…
Add table
Reference in a new issue