Skip to content

Commit

Permalink
fix: make error from swc/core shorter
Browse files Browse the repository at this point in the history
  • Loading branch information
DudaGod committed Sep 13, 2024
1 parent 9962f77 commit 84310c4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/utils/typescript.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import _ from "lodash";
import debug from "debug";
import logger from "./logger";

const swcDebugNamespace = "testplane:swc";
const swcDebugLog = debug(swcDebugNamespace);

export const tryToRegisterTsNode = (isSilent: boolean = false): void => {
if (process.env.TS_ENABLE === "false") {
return;
Expand Down Expand Up @@ -37,7 +41,15 @@ export const tryToRegisterTsNode = (isSilent: boolean = false): void => {
`testplane: you may install @swc/core for significantly faster reading of typescript tests.`,
);
} else {
logger.warn(`testplane: could not load @swc/core:`, err);
const isSwcDebugLogEnabled = debug.enabled(swcDebugNamespace);

if (isSwcDebugLogEnabled) {
swcDebugLog(err);
} else {
logger.warn(
`testplane: could not load @swc/core. Run Testplane with "DEBUG=testplane:swc" to see details.`,
);
}
}
}
}
Expand Down

0 comments on commit 84310c4

Please sign in to comment.