mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 09:36:44 +00:00
refactor(core): Support writing tests in cli/src (no-changelog) (#9646)
This commit is contained in:
@@ -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'],
|
||||
|
||||
Reference in New Issue
Block a user