first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { defineConfig } from 'vitest/config';
|
||||
import type { InlineConfig } from 'vitest/node';
|
||||
|
||||
export const createVitestConfig = (options: InlineConfig = {}) => {
|
||||
const vitestConfig = defineConfig({
|
||||
test: {
|
||||
silent: true,
|
||||
globals: true,
|
||||
environment: 'jsdom',
|
||||
setupFiles: ['./src/__tests__/setup.ts'],
|
||||
reporters: process.env.CI === 'true' ? ['default', 'junit'] : ['default'],
|
||||
outputFile: { junit: './junit.xml' },
|
||||
coverage: {
|
||||
enabled: false,
|
||||
all: false,
|
||||
provider: 'v8',
|
||||
reporter: ['text-summary', 'lcov', 'html-spa'],
|
||||
},
|
||||
css: {
|
||||
modules: {
|
||||
classNameStrategy: 'non-scoped',
|
||||
},
|
||||
},
|
||||
...options,
|
||||
},
|
||||
});
|
||||
|
||||
if (process.env.COVERAGE_ENABLED === 'true' && vitestConfig.test?.coverage) {
|
||||
const { coverage } = vitestConfig.test;
|
||||
coverage.enabled = true;
|
||||
if (process.env.CI === 'true' && coverage.provider === 'v8') {
|
||||
coverage.all = true;
|
||||
coverage.reporter = ['cobertura'];
|
||||
}
|
||||
}
|
||||
|
||||
return vitestConfig;
|
||||
};
|
||||
|
||||
export const vitestConfig = createVitestConfig();
|
||||
@@ -0,0 +1,36 @@
|
||||
import swc from 'unplugin-swc';
|
||||
import { mergeConfig } from 'vitest/config';
|
||||
import type { InlineConfig } from 'vitest/node';
|
||||
import { createVitestConfig } from './node.js';
|
||||
|
||||
const swcPlugin = swc.vite({
|
||||
jsc: {
|
||||
parser: {
|
||||
syntax: 'typescript',
|
||||
decorators: true,
|
||||
},
|
||||
transform: {
|
||||
legacyDecorator: true,
|
||||
decoratorMetadata: true,
|
||||
},
|
||||
target: 'es2022',
|
||||
},
|
||||
// Include node_modules TypeScript files (like @n8n/tournament)
|
||||
exclude: [],
|
||||
});
|
||||
|
||||
export const createVitestConfigWithDecorators = (options: InlineConfig = {}) => {
|
||||
const baseConfig = createVitestConfig(options);
|
||||
return mergeConfig(baseConfig, {
|
||||
plugins: [swcPlugin],
|
||||
esbuild: false, // Disable esbuild - it doesn't support decoratorMetadata
|
||||
server: {
|
||||
deps: {
|
||||
// Inline all dependencies so SWC can transform them (including TypeScript in node_modules)
|
||||
inline: [/.*/],
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const vitestConfigWithDecorators = createVitestConfigWithDecorators();
|
||||
@@ -0,0 +1,29 @@
|
||||
import { defineConfig } from 'vitest/config';
|
||||
import type { InlineConfig } from 'vitest/node';
|
||||
|
||||
export const createVitestConfig = (options: InlineConfig = {}) => {
|
||||
const vitestConfig = defineConfig({
|
||||
test: {
|
||||
silent: true,
|
||||
globals: true,
|
||||
environment: 'node',
|
||||
reporters: process.env.CI === 'true' ? ['default', 'junit'] : ['default'],
|
||||
outputFile: { junit: './junit.xml' },
|
||||
...(process.env.COVERAGE_ENABLED === 'true'
|
||||
? {
|
||||
coverage: {
|
||||
enabled: true,
|
||||
provider: 'v8',
|
||||
reporter: process.env.CI === 'true' ? 'cobertura' : 'text-summary',
|
||||
all: true,
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
...options,
|
||||
},
|
||||
});
|
||||
|
||||
return vitestConfig;
|
||||
};
|
||||
|
||||
export const vitestConfig = createVitestConfig();
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"name": "@n8n/vitest-config",
|
||||
"version": "1.7.0",
|
||||
"type": "module",
|
||||
"peerDependencies": {
|
||||
"vite": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
},
|
||||
"dependencies": {
|
||||
"unplugin-swc": "^1.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@n8n/typescript-config": "workspace:*",
|
||||
"@swc/core": "^1.10.7",
|
||||
"vite": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
},
|
||||
"files": [
|
||||
"backend.mjs",
|
||||
"frontend.mjs"
|
||||
],
|
||||
"exports": {
|
||||
"./backend": {
|
||||
"import": "./backend.mjs",
|
||||
"require": "./backend.mjs",
|
||||
"types": "./backend.d.ts"
|
||||
},
|
||||
"./frontend": {
|
||||
"import": "./dist/frontend.js",
|
||||
"require": "./dist/frontend.js",
|
||||
"types": "./dist/frontend.d.ts"
|
||||
},
|
||||
"./node": {
|
||||
"import": "./dist/node.js",
|
||||
"require": "./dist/node.js",
|
||||
"types": "./dist/node.d.ts"
|
||||
},
|
||||
"./node-decorators": {
|
||||
"import": "./dist/node-decorators.js",
|
||||
"require": "./dist/node-decorators.js",
|
||||
"types": "./dist/node-decorators.d.ts"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf dist .turbo",
|
||||
"dev": "pnpm watch",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"build": "tsc -p tsconfig.build.json",
|
||||
"format": "biome format --write .",
|
||||
"format:check": "biome ci .",
|
||||
"watch": "tsc -p tsconfig.build.json --watch"
|
||||
},
|
||||
"license": "See LICENSE.md file in the root of the repository"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": ["./tsconfig.json", "@n8n/typescript-config/tsconfig.build.json"],
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"rootDir": ".",
|
||||
"outDir": "dist",
|
||||
"tsBuildInfoFile": "dist/build.tsbuildinfo"
|
||||
},
|
||||
"include": ["**/*.ts"],
|
||||
"exclude": ["dist", "**/*.test.ts"]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"extends": "@n8n/typescript-config/tsconfig.common.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": ".",
|
||||
"types": ["node"],
|
||||
"baseUrl": ".",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"tsBuildInfoFile": "dist/typecheck.tsbuildinfo"
|
||||
},
|
||||
"include": ["**/*.ts"],
|
||||
"exclude": ["dist"]
|
||||
}
|
||||
Reference in New Issue
Block a user