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: make error from swc/core shorter #1014

Merged
merged 1 commit into from
Sep 13, 2024
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
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
Loading