mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 04:04: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
|
// This resolve the path mappings from the tsconfig relative to each jest.config.js
|
||||||
moduleNameMapper: Object.entries(paths || {}).reduce((acc, [path, [mapping]]) => {
|
moduleNameMapper: Object.entries(paths || {}).reduce((acc, [path, [mapping]]) => {
|
||||||
path = `^${path.replace(/\/\*$/, '/(.*)$')}`;
|
path = `^${path.replace(/\/\*$/, '/(.*)$')}`;
|
||||||
mapping = mapping.replace(/^\.\/(?:(.*)\/)?\*$/, '$1');
|
mapping = mapping.replace(/^\.?\.\/(?:(.*)\/)?\*$/, '$1');
|
||||||
mapping = mapping ? `/${mapping}` : '';
|
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;
|
return acc;
|
||||||
}, {}),
|
}, {}),
|
||||||
setupFilesAfterEnv: ['jest-expect-message'],
|
setupFilesAfterEnv: ['jest-expect-message'],
|
||||||
|
|
|
@ -6,5 +6,5 @@
|
||||||
"tsBuildInfoFile": "dist/build.tsbuildinfo"
|
"tsBuildInfoFile": "dist/build.tsbuildinfo"
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts"],
|
"include": ["src/**/*.ts"],
|
||||||
"exclude": ["test/**"]
|
"exclude": ["test/**", "src/**/__tests__/**"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
"baseUrl": "src",
|
"baseUrl": "src",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["./*"],
|
"@/*": ["./*"],
|
||||||
"@db/*": ["./databases/*"]
|
"@db/*": ["./databases/*"],
|
||||||
|
"@test/*": ["../test/shared/*"],
|
||||||
|
"@test-integration/*": ["../test/integration/shared/*"]
|
||||||
},
|
},
|
||||||
"tsBuildInfoFile": "dist/typecheck.tsbuildinfo",
|
"tsBuildInfoFile": "dist/typecheck.tsbuildinfo",
|
||||||
// TODO: remove all options below this line
|
// TODO: remove all options below this line
|
||||||
|
|
Loading…
Reference in a new issue