mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 09:36:44 +00:00
refactor: Consolidate tsconfig and eslintrc files (no-changelog) (#6816)
Co-authored-by: Csaba Tuncsik <csaba@n8n.io>
This commit is contained in:
committed by
GitHub
parent
31d8f478ee
commit
34df8b6238
@@ -6,10 +6,11 @@ const tsJestOptions = {
|
||||
...compilerOptions,
|
||||
declaration: false,
|
||||
sourceMap: true,
|
||||
skipLibCheck: true,
|
||||
},
|
||||
};
|
||||
|
||||
const { baseUrl, paths } = require('get-tsconfig').getTsconfig().config?.compilerOptions;
|
||||
|
||||
/** @type {import('jest').Config} */
|
||||
const config = {
|
||||
verbose: true,
|
||||
@@ -19,9 +20,14 @@ const config = {
|
||||
transform: {
|
||||
'^.+\\.ts$': ['ts-jest', tsJestOptions],
|
||||
},
|
||||
moduleNameMapper: {
|
||||
'^@/(.*)$': '<rootDir>/src/$1',
|
||||
},
|
||||
// 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 ? `/${mapping}` : '';
|
||||
acc[path] = '<rootDir>' + (baseUrl ? `/${baseUrl.replace(/^\.\//, '')}` : '') + mapping + '/$1';
|
||||
return acc;
|
||||
}, {}),
|
||||
setupFilesAfterEnv: ['jest-expect-message'],
|
||||
collectCoverage: true,
|
||||
coverageReporters: [process.env.COVERAGE_REPORT === 'true' ? 'text' : 'text-summary'],
|
||||
|
||||
Reference in New Issue
Block a user