Skip to content

Commit 357d071

Browse files
committed
Canonicalize Vite test fixture paths.
1 parent b0a8df0 commit 357d071

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎packages/void/test/integration/native-asset-cache-policy.test.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
1+
import { mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';
22
import { tmpdir } from 'node:os';
33
import { join } from 'node:path';
44
import { fileURLToPath } from 'node:url';
@@ -54,7 +54,8 @@ let customAsset: string;
5454
let uncachedAsset: string;
5555

5656
beforeAll(async () => {
57-
directory = mkdtempSync(join(tmpdir(), 'void-native-asset-policy-'));
57+
// Match Vite's native realpath before deriving input paths and manifest keys.
58+
directory = realpathSync.native(mkdtempSync(join(tmpdir(), 'void-native-asset-policy-')));
5859
const assets = join(directory, 'client');
5960
const output = join(directory, 'output');
6061
const clientRoot = join(directory, 'app');

‎packages/void/test/unit/cf-build-output.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,8 @@ it('rejects a mismatching explicit target account', async () => {
521521
it(
522522
'preserves additional module types from a real Cloudflare Vite build',
523523
async () => {
524-
// Vite canonicalizes root; use the same path for Cloudflare's output directory.
525-
const root = realpathSync(mkdtempSync(join(tmpdir(), 'void-cf-additional-modules-')));
524+
// Match Vite's native realpath so Windows short-path aliases use one build root.
525+
const root = realpathSync.native(mkdtempSync(join(tmpdir(), 'void-cf-additional-modules-')));
526526
roots.push(root);
527527
writeFileSync(join(root, 'package.json'), JSON.stringify({ type: 'module' }));
528528
const assets = {

0 commit comments

Comments
 (0)