diff --git a/test/test-integration.mjs b/test/test-integration.mjs index 55bcd1f7..5b0faf6f 100644 --- a/test/test-integration.mjs +++ b/test/test-integration.mjs @@ -3,6 +3,7 @@ *--------------------------------------------------------*/ import * as path from 'path'; +import * as os from 'os'; import { createHelpers } from 'yeoman-test'; import * as cp from 'child_process'; import { describe, it, before } from 'node:test'; @@ -17,17 +18,16 @@ describe('integration tests', { timeout: 7 * 60 * 1000 }, () => { const appLocation = path.join(fileURLToPath(import.meta.url), '../../generators/app'); const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm'; - let helpers; - before(async function () { - helpers = createHelpers({}); - }); // Use a short temp dir to avoid exceeding the 103-char Unix socket path limit. // macOS TMPDIR resolves to a deep /private/var/folders/... path which, combined // with the .vscode-test/user-data/*.sock suffix, exceeds the limit. function makeTmpDir() { - return mkdtempSync('/tmp/vsc-'); + if (process.platform === 'darwin') { + return mkdtempSync('/tmp/foo-'); + } + return mkdtempSync(path.join(os.tmpdir(), 'foo-')); } async function checkAudit(cwd) { @@ -43,7 +43,7 @@ describe('integration tests', { timeout: 7 * 60 * 1000 }, () => { } it('command-ts integration test (install, compile and run extension tests)', async () => { - + const helpers = createHelpers({}); const runResult = await helpers.run(appLocation).inDir(makeTmpDir()).withAnswers({ type: 'ext-command-ts', name: 'testCom', @@ -74,7 +74,7 @@ describe('integration tests', { timeout: 7 * 60 * 1000 }, () => { }); it('command-ts-webpack integration test (install, pack and run extension tests)', async () => { - + const helpers = createHelpers({}); const runResult = await helpers.run(appLocation).inDir(makeTmpDir()).withAnswers({ type: 'ext-command-ts', name: 'testCom', @@ -104,7 +104,7 @@ describe('integration tests', { timeout: 7 * 60 * 1000 }, () => { }); it('command-ts-esbuild integration test (install, pack and run extension tests)', async () => { - + const helpers = createHelpers({}); const runResult = await helpers.run(appLocation).inDir(makeTmpDir()).withAnswers({ type: 'ext-command-ts', name: 'testCom', @@ -134,7 +134,7 @@ describe('integration tests', { timeout: 7 * 60 * 1000 }, () => { }); it('command-ts-web-webpack integration test (install, pack and run extension tests)', async () => { - + const helpers = createHelpers({}); const runResult = await helpers.run(appLocation).inDir(makeTmpDir()).withAnswers({ type: 'ext-command-web', name: 'testCom', @@ -164,7 +164,7 @@ describe('integration tests', { timeout: 7 * 60 * 1000 }, () => { }); it('command-ts-web-esbuild integration test (install, pack and run extension tests)', async () => { - + const helpers = createHelpers({}); const runResult = await helpers.run(appLocation).inDir(makeTmpDir()).withAnswers({ type: 'ext-command-web', name: 'testCom',