Files
qwen-code/scripts/tests/macos-ci-groups.test.js
易良andQwen-Coder 84aee5b9b7 test(web-shell): include transcript coverage in recovery fixture (#15883)
* test(web-shell): include transcript coverage in recovery fixture

Co-authored-by: Qwen-Coder <[email protected]>

* test(web-shell): complete recovery event fixtures

Remove the unevaluated transcript type guard and supply required event terminal flags without changing assertions.

Co-authored-by: Qwen-Coder <[email protected]>

* fix(ci): use runner temp for Web Shell browser smoke (#15884)

* fix(ci): use runner temp for Web Shell browser smoke

Co-authored-by: Qwen-Coder <[email protected]>

* fix(ci): resolve runner temp in the browser step context

Co-authored-by: Qwen-Coder <[email protected]>

---------

Co-authored-by: Qwen-Coder <[email protected]>

* fix(ci): partition the complete macOS test suite into bounded jobs (#15888)

* fix(ci): use runner temp for Web Shell browser smoke

Co-authored-by: Qwen-Coder <[email protected]>

* fix(ci): resolve runner temp in the browser step context

Co-authored-by: Qwen-Coder <[email protected]>

* fix(ci): partition the complete macOS test suite into bounded jobs

Co-authored-by: Qwen-Coder <[email protected]>

* fix(ci): account for the macOS aggregate job budget

Record the additional five-minute aggregate without changing any test execution timeout.

Co-authored-by: Qwen-Coder <[email protected]>

* test(install): isolate Windows fixtures from persistent PATH (#15889)

Co-authored-by: Qwen-Coder <[email protected]>

* fix(ci): write the macOS shard matrix in block style and pin its gates

The seven-row matrix used YAML flow mappings, which `.yamllint.yml`
forbids (`braces: forbid: 'non-empty'`), so the `Run yamllint` step
cannot go green on this branch. Rewrite the rows in the block style
every other workflow matrix in this repo already uses.

Add the test pins the shard plumbing was missing:

- the `cli`/`core` dispatch argv, including the bare `--` that keeps
  `--shard` forwarded to vitest instead of consumed by npm, and the
  per-group `NODE_OPTIONS` choice
- `id: 'install'` on `test_macos_shards`, which the suite's
  `steps.install.outcome` gate silently reads as '' if it is renamed
- the aggregate `test_macos` gate against the shards' gate, so the
  preserved check name cannot report `skipped` while the legs fail

Co-authored-by: Qwen-Coder <[email protected]>
Patrol-Run: qwen-pr-closeout/jmvu6810z1y

* fix(ci): preserve shell fixture gates on macOS system Bash

Handle empty issue families under nounset without mapfile and explicitly reject either missing OSS credential. Keep failure assertions and include shell diagnostics.

Co-authored-by: Qwen-Coder <[email protected]>

---------

Co-authored-by: Qwen-Coder <[email protected]>

* fix(ci): keep macOS aggregate failures eligible for infra retry

Co-authored-by: Qwen-Coder <[email protected]>

---------

Co-authored-by: Qwen-Coder <[email protected]>
2026-10-30 18:24:19 +08:00

94 lines
2.8 KiB
JavaScript

/**
* @license
* Copyright 2026 Qwen Team
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, expect, it, vi } from 'vitest';
import { runMacOsGroup } from '../run-macos-ci-group.js';
describe('macOS CI groups', () => {
it('includes newly added workspace suites without duplicating heavy groups', () => {
const spawn = vi
.fn()
.mockReturnValueOnce({
status: 0,
stdout: JSON.stringify({
'@qwen-code/qwen-code': 'vitest run',
'@qwen-code/qwen-code-core': 'vitest run',
'@qwen-code/new-package': 'vitest run',
'@qwen-code/sdk': 'npm run typecheck && vitest run',
'@qwen-code/no-tests': {},
}),
})
.mockReturnValueOnce({ status: 7 });
expect(runMacOsGroup('rest', '', spawn)).toBe(7);
expect(spawn.mock.calls[1][1]).toEqual([
'run',
'test:ci',
'--workspace=@qwen-code/new-package',
'--workspace=@qwen-code/sdk',
]);
});
it('shards both heavy groups by workspace path and keeps their heap cap', () => {
for (const [group, shard] of [
['cli', '2/3'],
['core', '1/2'],
]) {
const spawn = vi.fn().mockReturnValue({ status: 0 });
expect(runMacOsGroup(group, shard, spawn)).toBe(0);
// Without the bare '--', npm consumes --shard itself and every leg
// re-runs the whole workspace suite — the overrun this split removes.
expect(spawn.mock.calls[0][1]).toEqual([
'run',
'test:ci',
`--workspace=packages/${group}`,
'--',
`--shard=${shard}`,
]);
expect(spawn.mock.calls[0][2].env.NODE_OPTIONS).toBe(
'--max-old-space-size=3072',
);
}
});
it('leaves the scripts group on the ambient environment', () => {
const spawn = vi.fn().mockReturnValue({ status: 0 });
expect(runMacOsGroup('scripts', '', spawn)).toBe(0);
expect(spawn.mock.calls[0][2].env).toBe(process.env);
});
it('runs helper tests after standalone failure and preserves either failure', () => {
for (const [standalone, scripts] of [
[3, 0],
[0, 5],
[3, 5],
]) {
const spawn = vi
.fn()
.mockReturnValueOnce({ status: standalone })
.mockReturnValueOnce({ status: scripts });
expect(runMacOsGroup('scripts', '', spawn)).not.toBe(0);
expect(spawn.mock.calls.map((call) => call[1])).toEqual([
['run', 'test:standalone:runtimes:ci'],
['run', 'test:scripts:unit'],
]);
}
});
it('fails closed when workspace discovery fails or yields no suites', () => {
expect(
runMacOsGroup('rest', '', vi.fn().mockReturnValue({ status: null })),
).toBe(1);
expect(() =>
runMacOsGroup(
'rest',
'',
vi.fn().mockReturnValue({ status: 0, stdout: '{}' }),
),
).toThrow('No remaining workspace');
});
});