Skip to content

Commit 07cee0a

Browse files
committed
fix: should use finalTsRunner for checking
1 parent 6a717c7 commit 07cee0a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export const isFile = (path: string) => {
135135
try {
136136
return !!fs.statSync(path, { throwIfNoEntry: false })?.isFile()
137137
} catch {
138+
/* istanbul ignore next */
138139
return false
139140
}
140141
}
@@ -302,6 +303,7 @@ function startWorkerThread<R, T extends AnyAsyncFn<R>>(
302303
const isTsxSupported =
303304
!tsUseEsm ||
304305
Number.parseFloat(process.versions.node) >= MTS_SUPPORTED_NODE_VERSION
306+
/* istanbul ignore if */
305307
if (!finalTsRunner) {
306308
throw new Error('No ts runner specified, ts worker path is not supported')
307309
} /* istanbul ignore if */ else if (
@@ -329,7 +331,7 @@ function startWorkerThread<R, T extends AnyAsyncFn<R>>(
329331
const useEval = isTs && !tsUseEsm
330332

331333
const worker = new Worker(
332-
tsUseEsm && tsRunner === TsRunner.TsNode
334+
tsUseEsm && finalTsRunner === TsRunner.TsNode
333335
? dataUrl(`import '${String(workerPathUrl)}'`)
334336
: useEval
335337
? // eslint-disable-next-line unicorn/prefer-string-replace-all -- compatibility

test/ts-runner.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ test(TsRunner.TSX, async () => {
109109
return
110110
}
111111

112-
syncFn = createSyncFn<AsyncWorkerFn>(workerMjsPath, {
112+
syncFn = createSyncFn<AsyncWorkerFn>(workerMtsPath, {
113113
tsRunner: TsRunner.TSX,
114114
})
115115
expect(syncFn(1)).toBe(1)

0 commit comments

Comments
 (0)