Skip to content

Conversation

KuznetsovRoman
Copy link
Member

No description provided.

Comment on lines 113 to 126
const enableSourceMaps = (): void => {
if (areSourceMapsEnabled) {
return;
}

areSourceMapsEnabled = true;

revertTransformHook();

revertTransformHook = addHook(
(code, filename) => transformCode(code, { sourceFile: filename, sourceMaps: true, isSilent }),
{
exts: TRANSFORM_EXTENSIONS,
matcher: filename => !filename.includes("node_modules"),
ignoreNodeModules: false,
},
);
};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually we register transform hook without sourcemaps so we dont waste any time generating it

This function will re-register transform hook with sourcemaps

Copy link

pkg-pr-new bot commented Sep 22, 2025

Open in StackBlitz

npm i https://pkg.pr.new/gemini-testing/testplane@1138

commit: 56a12cd

matcher: filename => !filename.includes("node_modules"),
ignoreNodeModules: false,
},
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we get rid of duplication here (only value of sourceMaps flag changes)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

assert.notCalled(addHookStub);
});

it("should re-register transform hook with source maps", () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you didn't check that the flag sourceMap: true is specified on second call

Copy link
Member Author

@KuznetsovRoman KuznetsovRoman Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cant.
We just pass callback (code, filename) => transformCode(...) to "addHook"
So "addHook" was just called with some function and thats all we can get.
"flag sourceMap: true" is internal detail of "registerTransformHook" function implementation

@KuznetsovRoman KuznetsovRoman force-pushed the TESTPLANE-735.fix_test_location branch 2 times, most recently from f657808 to 0e3c950 Compare September 23, 2025 12:21
@KuznetsovRoman KuznetsovRoman force-pushed the TESTPLANE-735.fix_test_location branch from 0e3c950 to 56a12cd Compare September 23, 2025 12:22
@KuznetsovRoman KuznetsovRoman merged commit 22bacb8 into master Sep 23, 2025
5 checks passed
@KuznetsovRoman KuznetsovRoman deleted the TESTPLANE-735.fix_test_location branch September 23, 2025 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants