修正 sccache 测试的平台隔离
为启用 sccache 的用例补充 Windows platform mock 确保 POSIX 环境下测试不会误走 env wrapper 分支
This commit is contained in:
+23
-8
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user