Skip to content

Commit 9be63c2

Browse files
test(context): canonicalize temporary roots
1 parent da4a56e commit 9be63c2

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎packages/context/tests/workspace.test.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises';
1+
import { mkdir, mkdtemp, realpath, rm, writeFile } from 'node:fs/promises';
22
import os from 'node:os';
33
import path from 'node:path';
44
import { expect, test } from '@rstest/core';
55
import { resolveContextWorkspace } from '../src/workspace.ts';
66

77
const withTempDirectory = async (callback: (rootPath: string) => Promise<void>): Promise<void> => {
8-
const rootPath = await mkdtemp(path.join(os.tmpdir(), 'rstack-context-workspace-'));
8+
const rootPath = await realpath(
9+
await mkdtemp(path.join(os.tmpdir(), 'rstack-context-workspace-')),
10+
);
911

1012
try {
1113
await callback(rootPath);

‎packages/rstack/tests/context/injection.test.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { mkdir, mkdtemp, readFile, rm, symlink, writeFile } from 'node:fs/promises';
1+
import { mkdir, mkdtemp, readFile, realpath, rm, symlink, writeFile } from 'node:fs/promises';
22
import os from 'node:os';
33
import path from 'node:path';
44
import { pathToFileURL } from 'node:url';
@@ -61,7 +61,9 @@ const withConfig = async (
6161
workspaceRoot: string;
6262
}) => Promise<void>,
6363
): Promise<void> => {
64-
const fixtureRoot = await mkdtemp(path.join(os.tmpdir(), 'rstack-context-injection-'));
64+
const fixtureRoot = await realpath(
65+
await mkdtemp(path.join(os.tmpdir(), 'rstack-context-injection-')),
66+
);
6567
const workspaceRoot = symlinked ? path.join(fixtureRoot, 'checkout') : fixtureRoot;
6668
await mkdir(workspaceRoot, { recursive: true });
6769
const configPath = path.join(workspaceRoot, 'rstack.config.ts');

0 commit comments

Comments
 (0)