mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-07-09 17:19:02 +00:00
67 lines
1.8 KiB
JavaScript
67 lines
1.8 KiB
JavaScript
/**
|
|
* @license
|
|
* Copyright 2025 Qwen Team
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
|
|
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(first).toBe(
|
|
'/runner/_work/_temp/qwen-code-linters/28501834362-1-test',
|
|
);
|
|
expect(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(first).toMatch(/\/qwen-code-linters\/local-[a-f0-9]{16}$/);
|
|
expect(second).toMatch(/\/qwen-code-linters\/local-[a-f0-9]{16}$/);
|
|
expect(first).not.toBe(second);
|
|
});
|
|
});
|