mirror of
https://github.com/n8n-io/n8n.git
synced 2026-07-29 03:55:15 +02:00
24 lines
927 B
TypeScript
24 lines
927 B
TypeScript
import { mergeConfig } from 'vitest/config';
|
|
import type { InlineConfig } from 'vitest/node';
|
|
import { createVitestConfig } from './node.js';
|
|
|
|
export const createVitestConfigWithDecorators = (options: InlineConfig = {}) => {
|
|
const baseConfig = createVitestConfig(options);
|
|
return mergeConfig(baseConfig, {
|
|
test: {
|
|
server: {
|
|
deps: {
|
|
// Load workspace packages that own the DI container or register services
|
|
// from their built dist instead of source. Otherwise Vitest's pipeline loads
|
|
// them as TS while CJS dist gets loaded via require, producing two `Container`
|
|
// instances — one where `@Config`/`@Service` decorators registered, one used
|
|
// by the test — and `Container.get(...)` returns undefined for everything.
|
|
external: [/@n8n\/(di|config|constants)/, /n8n-workflow/],
|
|
},
|
|
},
|
|
},
|
|
});
|
|
};
|
|
|
|
export const vitestConfigWithDecorators = createVitestConfigWithDecorators();
|