test: run "should remove temp dir on process.exit" on windows (#13568)

This commit is contained in:
Dmitry Gozman 2022-04-14 16:07:03 -07:00 committed by GitHub
parent aee6ba299a
commit 022f83d3b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 12 deletions

View File

@ -32,6 +32,18 @@ test('should close the browser when the node process closes', async ({ startRemo
expect(await remoteServer.childExitCode()).toBe(isWindows ? 1 : 0);
});
test('should remove temp dir on process.exit', async ({ startRemoteServer, server }, testInfo) => {
const file = testInfo.outputPath('exit.file');
const remoteServer = await startRemoteServer({ url: server.EMPTY_PAGE, exitOnFile: file });
const tempDir = await remoteServer.out('tempDir');
const before = fs.existsSync(tempDir);
fs.writeFileSync(file, 'data', 'utf-8');
expect(await remoteServer.childExitCode()).toBe(42);
const after = fs.existsSync(tempDir);
expect(before).toBe(true);
expect(after).toBe(false);
});
test.describe('signals', () => {
test.skip(({ platform }) => platform === 'win32');
@ -96,18 +108,6 @@ test.describe('signals', () => {
expect(after).toBe(false);
});
test('should remove temp dir on process.exit', async ({ startRemoteServer, server }, testInfo) => {
const file = testInfo.outputPath('exit.file');
const remoteServer = await startRemoteServer({ url: server.EMPTY_PAGE, exitOnFile: file });
const tempDir = await remoteServer.out('tempDir');
const before = fs.existsSync(tempDir);
fs.writeFileSync(file, 'data', 'utf-8');
expect(await remoteServer.childExitCode()).toBe(42);
const after = fs.existsSync(tempDir);
expect(before).toBe(true);
expect(after).toBe(false);
});
test('should kill the browser on SIGINT + SIGTERM', async ({ startRemoteServer, server }) => {
const remoteServer = await startRemoteServer({ stallOnClose: true, url: server.EMPTY_PAGE });
process.kill(remoteServer.child().pid, 'SIGINT');