-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Expand file tree
/
Copy pathchrome-devtools-start-stop.test.ts
More file actions
74 lines (62 loc) · 1.73 KB
/
chrome-devtools-start-stop.test.ts
File metadata and controls
74 lines (62 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import assert from 'node:assert';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import {describe, it, afterEach, beforeEach} from 'node:test';
import {
assertDaemonIsNotRunning,
assertDaemonIsRunning,
runCli,
} from '../utils.js';
describe('chrome-devtools', () => {
beforeEach(async () => {
await runCli(['stop']);
await assertDaemonIsNotRunning();
});
afterEach(async () => {
await runCli(['stop']);
await assertDaemonIsNotRunning();
});
it('can start and stop the daemon', async () => {
await assertDaemonIsNotRunning();
const startResult = await runCli(['start']);
assert.strictEqual(
startResult.status,
0,
`start command failed: ${startResult.stderr}`,
);
await assertDaemonIsRunning();
const stopResult = await runCli(['stop']);
assert.strictEqual(
stopResult.status,
0,
`stop command failed: ${stopResult.stderr}`,
);
await assertDaemonIsNotRunning();
});
it('can start the daemon with userDataDir', async () => {
const userDataDir = path.join(
os.tmpdir(),
`chrome-devtools-test-${crypto.randomUUID()}`,
);
fs.mkdirSync(userDataDir, {recursive: true});
const startResult = await runCli(['start', '--userDataDir', userDataDir]);
assert.strictEqual(
startResult.status,
0,
`start command failed: ${startResult.stderr}`,
);
assert.ok(
!startResult.stderr.includes(
'Arguments userDataDir and isolated are mutually exclusive',
),
`unexpected conflict error: ${startResult.stderr}`,
);
await assertDaemonIsRunning();
});
});