修正 sccache 测试的平台隔离
Project CI / Repository checks (pull_request) Failing after 13s
Project CI / Backend tests (pull_request) Failing after 10s
Project CI / Frontend tests (pull_request) Successful in 3m38s
Project CI / Native shell tests (pull_request) Successful in 20m22s

为启用 sccache 的用例补充 Windows platform mock

确保 POSIX 环境下测试不会误走 env wrapper 分支
This commit is contained in:
2026-09-14 05:56:28 +00:00
parent 4bb0704d3e
commit 2315883b1f
+23 -8
View File
@@ -658,16 +658,31 @@ describe('dev scheduler local worker cleanup', () => {
describe('dev scheduler Rust build env', () => {
test('local dev Rust env enables available sccache wrapper', () => {
const env = buildLocalRustProcessEnv(
{
RUSTC_WRAPPER: '/usr/bin/sccache',
CARGO_BUILD_RUSTC_WRAPPER: 'sccache',
},
{ log: false, sccacheAvailable: true },
const originalPlatform = Object.getOwnPropertyDescriptor(
process,
'platform',
);
Object.defineProperty(process, 'platform', {
configurable: true,
value: 'win32',
});
expect(env.RUSTC_WRAPPER).toBe('sccache');
expect(env.CARGO_BUILD_RUSTC_WRAPPER).toBe(env.RUSTC_WRAPPER);
try {
const env = buildLocalRustProcessEnv(
{
RUSTC_WRAPPER: '/usr/bin/sccache',
CARGO_BUILD_RUSTC_WRAPPER: 'sccache',
},
{ log: false, sccacheAvailable: true },
);
expect(env.RUSTC_WRAPPER).toBe('sccache');
expect(env.CARGO_BUILD_RUSTC_WRAPPER).toBe(env.RUSTC_WRAPPER);
} finally {
if (originalPlatform) {
Object.defineProperty(process, 'platform', originalPlatform);
}
}
});
test('local dev Rust env keeps healthy custom wrapper untouched', () => {