Skip to content

Commit 82fcbd4

Browse files
committed
test(runner): invoke tsc via node for Windows CI compatibility
1 parent 1c4fe14 commit 82fcbd4

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎tests/__tests__/runner-shared-bundler-compat.spec.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import { WebpackModule } from '@tarojs/webpack5-runner/dist/webpack/WebpackModul
77
import WebpackPlugin from '@tarojs/webpack5-runner/dist/webpack/WebpackPlugin'
88

99
const repoRoot = path.resolve(__dirname, '../..')
10-
const tscBin = path.resolve(repoRoot, 'node_modules/.bin/tsc')
10+
const tscScript = require.resolve('typescript/bin/tsc', { paths: [repoRoot] })
1111
const runnerUtilsRoot = path.resolve(repoRoot, 'packages/taro-runner-utils')
1212
const webpack5RunnerRoot = path.resolve(repoRoot, 'packages/taro-webpack5-runner')
1313

1414
function runTsc (cwd: string, args: string[]) {
15-
return spawnSync(tscBin, args, {
15+
return spawnSync(process.execPath, [tscScript, ...args], {
1616
cwd,
1717
encoding: 'utf8',
1818
})
@@ -90,17 +90,17 @@ describe('shared bundler compatibility', () => {
9090
try {
9191
const taroScopeDir = path.join(tmpDir, 'node_modules', '@tarojs')
9292
fs.mkdirSync(taroScopeDir, { recursive: true })
93-
fs.symlinkSync(webpack5RunnerRoot, path.join(taroScopeDir, 'webpack5-runner'), 'dir')
94-
fs.symlinkSync(runnerUtilsRoot, path.join(taroScopeDir, 'runner-utils'), 'dir')
93+
fs.symlinkSync(webpack5RunnerRoot, path.join(taroScopeDir, 'webpack5-runner'), 'junction')
94+
fs.symlinkSync(runnerUtilsRoot, path.join(taroScopeDir, 'runner-utils'), 'junction')
9595

9696
const consumerFile = path.join(tmpDir, 'consumer.ts')
9797
fs.writeFileSync(
9898
consumerFile,
9999
[
100100
"import type { WebpackModule as DistWebpackModule } from '@tarojs/webpack5-runner/dist/webpack/WebpackModule'",
101101
"import type DistWebpackPlugin from '@tarojs/webpack5-runner/dist/webpack/WebpackPlugin'",
102-
`import type { WebpackModule as SrcWebpackModule } from '${path.join(webpack5RunnerRoot, 'src/webpack/WebpackModule').replace(/\\/g, '/')}'`,
103-
`import type SrcWebpackPlugin from '${path.join(webpack5RunnerRoot, 'src/webpack/WebpackPlugin').replace(/\\/g, '/')}'`,
102+
"import type { WebpackModule as SrcWebpackModule } from '@tarojs/webpack5-runner/src/webpack/WebpackModule'",
103+
"import type SrcWebpackPlugin from '@tarojs/webpack5-runner/src/webpack/WebpackPlugin'",
104104
'export function accept (a: DistWebpackModule, b: DistWebpackPlugin, c: SrcWebpackModule, d: SrcWebpackPlugin) {',
105105
' return [a, b, c, d]',
106106
'}',

0 commit comments

Comments
 (0)