mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-12 02:19:43 +00:00
test: Make test resource acquisition and cleanup safe (#37923)
This commit is contained in:
@@ -24,7 +24,11 @@ import { fileURLToPath } from 'node:url';
|
||||
import { dirname, join } from 'node:path';
|
||||
|
||||
const write = process.argv.includes('--write');
|
||||
const baselineFile = join(dirname(fileURLToPath(import.meta.url)), '..', '.boundaries-baseline.json');
|
||||
const baselineFile = join(
|
||||
dirname(fileURLToPath(import.meta.url)),
|
||||
'..',
|
||||
'.boundaries-baseline.json',
|
||||
);
|
||||
const baseline = JSON.parse(readFileSync(baselineFile, 'utf8')).issues;
|
||||
|
||||
// turbo exits non-zero when issues exist; we read the output regardless.
|
||||
@@ -44,6 +48,11 @@ if (!match) {
|
||||
const exemptedHarness = (output.match(/import `@nodes-testing\/[^`]+` leaves the package/g) ?? [])
|
||||
.length;
|
||||
|
||||
// Container tests use this path to share the test-only stack implementation.
|
||||
const exemptedContainerHarness = (
|
||||
output.match(/import `\.\.\/\.\.\/\.\.\/containers\/[^`]+` leaves the package/g) ?? []
|
||||
).length;
|
||||
|
||||
// The editor's browser shim for `@n8n/expression-runtime` re-exports that package's
|
||||
// source directly: the barrel reaches IsolatedVmBridge, which requires isolated-vm, a
|
||||
// native Node module that cannot be bundled for a browser. The shim is the sanctioned
|
||||
@@ -67,7 +76,7 @@ const exemptedBrowserShim = (
|
||||
) ?? []
|
||||
).length;
|
||||
|
||||
const exempted = exemptedHarness + exemptedBrowserShim;
|
||||
const exempted = exemptedHarness + exemptedContainerHarness + exemptedBrowserShim;
|
||||
const current = Number(match[1]) - exempted;
|
||||
|
||||
if (write) {
|
||||
@@ -77,7 +86,7 @@ if (write) {
|
||||
}
|
||||
|
||||
console.log(
|
||||
`turbo boundaries: ${current} issues (baseline ${baseline}, ${exemptedHarness} node-test-harness + ${exemptedBrowserShim} browser-shim imports exempted)`,
|
||||
`turbo boundaries: ${current} issues (baseline ${baseline}, ${exemptedHarness} node-test-harness + ${exemptedContainerHarness} container-harness + ${exemptedBrowserShim} browser-shim imports exempted)`,
|
||||
);
|
||||
|
||||
if (current > baseline) {
|
||||
|
||||
Reference in New Issue
Block a user