Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: log an error while trying to register ts-node (backport to v7) #805

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
};
Loading