Remove AfterAll hook and add --exit to e2e tests

Eliminates the AfterAll hook that forced process exit in cleanup.ts to prevent hanging after tests. Adds the --exit flag to the cucumber-js command in the e2e test script to ensure proper test process termination.
This commit is contained in:
lin onetwo 2026-01-21 21:36:24 +08:00
parent 17a87e7cb4
commit 0aacfb91ab
2 changed files with 2 additions and 12 deletions

View file

@ -1,4 +1,4 @@
import { After, AfterAll, Before } from '@cucumber/cucumber';
import { After, Before } from '@cucumber/cucumber';
import fs from 'fs-extra';
import path from 'path';
import { makeSlugPath } from '../supports/paths';
@ -128,13 +128,3 @@ After(async function(this: ApplicationWorld, { pickle }) {
// Scenario-specific logs are already in the right place, no need to move them
});
// Force exit after all tests complete to prevent hanging
AfterAll({ timeout: 5000 }, async function() {
// Give a short grace period for any final cleanup
await new Promise((resolve) => setTimeout(resolve, 1000));
// Force exit the process
// This is necessary because sometimes Electron/Playwright resources don't fully clean up
process.exit(0);
});

View file

@ -20,7 +20,7 @@
"test:unit": "cross-env ELECTRON_RUN_AS_NODE=1 ./node_modules/.bin/electron --max-old-space-size=8192 ./node_modules/vitest/vitest.mjs run",
"test:unit:coverage": "pnpm run test:unit --coverage",
"test:prepare-e2e": "cross-env READ_DOC_BEFORE_USING='docs/Testing.md' && pnpm run clean && pnpm run build:plugin && cross-env NODE_ENV=test DEBUG=electron-forge:* electron-forge package",
"test:e2e": "rimraf -- ./test-artifacts && cross-env NODE_ENV=test tsx scripts/developmentMkdir.ts && cross-env NODE_ENV=test cucumber-js --config features/cucumber.config.js",
"test:e2e": "rimraf -- ./test-artifacts && cross-env NODE_ENV=test tsx scripts/developmentMkdir.ts && cross-env NODE_ENV=test cucumber-js --config features/cucumber.config.js --exit",
"test:manual-e2e": "pnpm exec cross-env NODE_ENV=test tsx ./scripts/start-e2e-app.ts",
"make": "pnpm run build:plugin && cross-env NODE_ENV=production electron-forge make",
"make:analyze": "cross-env ANALYZE=true pnpm run make",