mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-23 11:44:06 -08:00
refactor(core): Support writing tests in cli/src
(no-changelog) (#9646)
This commit is contained in:
parent
b45f3dc9fb
commit
65cd2e8803
|
@ -24,9 +24,11 @@ const config = {
|
|||
// This resolve the path mappings from the tsconfig relative to each jest.config.js
|
||||
moduleNameMapper: Object.entries(paths || {}).reduce((acc, [path, [mapping]]) => {
|
||||
path = `^${path.replace(/\/\*$/, '/(.*)$')}`;
|
||||
mapping = mapping.replace(/^\.\/(?:(.*)\/)?\*$/, '$1');
|
||||
mapping = mapping.replace(/^\.?\.\/(?:(.*)\/)?\*$/, '$1');
|
||||
mapping = mapping ? `/${mapping}` : '';
|
||||
acc[path] = '<rootDir>' + (baseUrl ? `/${baseUrl.replace(/^\.\//, '')}` : '') + mapping + '/$1';
|
||||
acc[path] = mapping.startsWith('/test')
|
||||
? '<rootDir>' + mapping + '/$1'
|
||||
: '<rootDir>' + (baseUrl ? `/${baseUrl.replace(/^\.\//, '')}` : '') + mapping + '/$1';
|
||||
return acc;
|
||||
}, {}),
|
||||
setupFilesAfterEnv: ['jest-expect-message'],
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
"tsBuildInfoFile": "dist/build.tsbuildinfo"
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"exclude": ["test/**"]
|
||||
"exclude": ["test/**", "src/**/__tests__/**"]
|
||||
}
|
||||
|
|
|
@ -8,7 +8,9 @@
|
|||
"baseUrl": "src",
|
||||
"paths": {
|
||||
"@/*": ["./*"],
|
||||
"@db/*": ["./databases/*"]
|
||||
"@db/*": ["./databases/*"],
|
||||
"@test/*": ["../test/shared/*"],
|
||||
"@test-integration/*": ["../test/integration/shared/*"]
|
||||
},
|
||||
"tsBuildInfoFile": "dist/typecheck.tsbuildinfo",
|
||||
// TODO: remove all options below this line
|
||||
|
|
Loading…
Reference in a new issue