-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathlint.test.js
More file actions
72 lines (61 loc) · 2.01 KB
/
Copy pathlint.test.js
File metadata and controls
72 lines (61 loc) · 2.01 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
/**
* @license
* Copyright 2025 Qwen Team
* SPDX-License-Identifier: Apache-2.0
*/
import path from 'node:path';
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
// getLinterTempDir joins with the platform separator; compare normalized
// paths so the suite also passes on the Windows gate.
const toPosix = (value) => value.replaceAll(path.sep, '/');
describe('getLinterTempDir', () => {
const originalArgv = process.argv;
beforeEach(() => {
process.argv = ['node', 'scripts/lint.js', '--test-import'];
});
afterEach(() => {
process.argv = originalArgv;
});
it('isolates GitHub Actions linter installs by run and job', async () => {
const { getLinterTempDir } = await import('../lint.js');
const first = getLinterTempDir({
cwd: '/runner/_work/qwen-code/qwen-code',
env: {
RUNNER_TEMP: '/runner/_work/_temp',
GITHUB_RUN_ID: '28501834362',
GITHUB_RUN_ATTEMPT: '1',
GITHUB_JOB: 'test',
},
});
const second = getLinterTempDir({
cwd: '/runner/_work/qwen-code/qwen-code',
env: {
RUNNER_TEMP: '/runner/_work/_temp',
GITHUB_RUN_ID: '28501834363',
GITHUB_RUN_ATTEMPT: '1',
GITHUB_JOB: 'integration_cli',
},
});
expect(toPosix(first)).toBe(
'/runner/_work/_temp/qwen-code-linters/28501834362-1-test',
);
expect(toPosix(second)).toBe(
'/runner/_work/_temp/qwen-code-linters/28501834363-1-integration_cli',
);
expect(first).not.toBe(second);
});
it('isolates local linter installs by workspace', async () => {
const { getLinterTempDir } = await import('../lint.js');
const first = getLinterTempDir({
cwd: '/tmp/qwen-code-a',
env: {},
});
const second = getLinterTempDir({
cwd: '/tmp/qwen-code-b',
env: {},
});
expect(toPosix(first)).toMatch(/\/qwen-code-linters\/local-[a-f0-9]{16}$/);
expect(toPosix(second)).toMatch(/\/qwen-code-linters\/local-[a-f0-9]{16}$/);
expect(first).not.toBe(second);
});
});