Skip to content

Commit

Permalink
Merge pull request #805 from gemini-testing/HERMIONE-1252.ts_node_err_v7
Browse files Browse the repository at this point in the history
fix: log an error while trying to register ts-node (backport to v7)
  • Loading branch information
KuznetsovRoman authored Nov 14, 2023
2 parents 5fb024a + 5ef3447 commit 21666a8
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/utils/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,19 @@ export const tryToRegisterTsNode = (): void => {
swc = true;
} catch {} // eslint-disable-line no-empty

register({
skipProject: JSON.parse(process.env.TS_NODE_SKIP_PROJECT ?? "true"),
transpileOnly: JSON.parse(process.env.TS_NODE_TRANSPILE_ONLY ?? "true"),
swc: JSON.parse(process.env.TS_NODE_SWC ?? swc.toString()),
});
const skipProjectRaw = process.env.TS_NODE_SKIP_PROJECT ?? "true";
const transpileOnlyRaw = process.env.TS_NODE_TRANSPILE_ONLY ?? "true";
const swcRaw = process.env.TS_NODE_SWC ?? swc.toString();

try {
register({
skipProject: JSON.parse(skipProjectRaw),
transpileOnly: JSON.parse(transpileOnlyRaw),
swc: JSON.parse(swcRaw),
});
} catch (err) {
const params = `swc: "${swcRaw}", transpileOnly: "${transpileOnlyRaw}", skipProject: "${skipProjectRaw}"`;
console.error(`hermione: an error occured while trying to register ts-node (${params}):`, err);
}
} catch {} // eslint-disable-line no-empty
};

0 comments on commit 21666a8

Please sign in to comment.