Skip to content

Commit 0d5411e

Browse files
committed
convert resolve to ts (tsx works inside child process)
1 parent 2cb528a commit 0d5411e

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

packages/server/lib/modes/run.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,7 @@ async function ready (options: ReadyOptions) {
11311131
socketId,
11321132
parallel,
11331133
onError,
1134+
// @ts-expect-error - browser is not typed correctly
11341135
browser,
11351136
project,
11361137
runUrl,

packages/server/lib/util/resolve.js

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import debugModule from 'debug'
2+
const debug = debugModule('cypress:server:plugins')
3+
4+
/**
5+
* Resolves the path to 'typescript' module.
6+
*
7+
* @param {projectRoot} path to the project root
8+
* @returns {string|null} path if typescript exists, otherwise null
9+
*/
10+
export const typescript = (projectRoot) => {
11+
if (process.env['CYPRESS_INTERNAL_NO_TYPESCRIPT'] === '1' || !projectRoot) {
12+
return null
13+
}
14+
15+
try {
16+
debug('resolving typescript with projectRoot %o', projectRoot)
17+
18+
const resolved = require.resolve('typescript', { paths: [projectRoot] })
19+
20+
debug('resolved typescript %s', resolved)
21+
22+
return resolved
23+
} catch (e) {
24+
debug('could not resolve typescript, error: %s', e.message)
25+
26+
return null
27+
}
28+
}

0 commit comments

Comments
 (0)