Skip to content

Commit a689501

Browse files
committed
Fix tsgo resolution in e2e tests
1 parent 0914bd3 commit a689501

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

packages/knip/test/helpers/tsgo.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { spawnSync } from 'node:child_process';
2+
import { createRequire } from 'node:module';
23
// oxlint-disable-next-line no-restricted-imports
34
import { dirname } from 'node:path';
4-
import { fileURLToPath } from 'node:url';
55
import { join } from '../../src/util/path.ts';
66

7-
const tsgoBin = join(dirname(fileURLToPath(import.meta.url)), '../../node_modules/.bin/tsgo');
7+
const require = createRequire(import.meta.url);
8+
const tsgoBin = join(dirname(require.resolve('@typescript/native-preview/package.json')), 'bin/tsgo.js');
89

910
export const tsgo = (cwd: string) =>
10-
spawnSync(tsgoBin, ['-p', '.'], { cwd, env: { PATH: process.env.PATH, NO_COLOR: '1' } });
11+
spawnSync(process.execPath, [tsgoBin, '-p', '.'], { cwd, env: { PATH: process.env.PATH, NO_COLOR: '1' } });

0 commit comments

Comments
 (0)