KT-87304: Update karma.conf.js to use 'require(...)' instead plain strings#6499
KT-87304: Update karma.conf.js to use 'require(...)' instead plain strings#6499Anton Lakotka (antohaby) wants to merge 1 commit into
Conversation
|
This MR fixes the regression, but the root cause is not yet documented as required by the guideline This will allow our automation to copy the RCA into the issue comments and automatically apply the root-cause-defined tag. |
Code Owners
|
|
/dry-run |
This comment has been minimized.
This comment has been minimized.
…ings The karma tool treats plain strings differently that commonJs module specification. KGP uses workspaces model that leverages commonJs module system when searching for modules to load. i.e. when kotlin-web-helpers got installed to some inner workspace package (`js/packages/kmp-lib-test/node_modules/kotlin-web-helpers`) then code in kmp-lib-test that requires kotlin-web-helpers should find it. the kotlin-web-helpers can also be placed in the upper node_modules (`js/node_modules/kotlin-web-helpers`). But when karma plugin is passed as plain string, 'my-plugin/plugin.js' karma will look up for it only in the upper node_modules of the root npm project. So when all inner packages had the kotlin-web-helpers in their node_modules but not in the root one, karma will fail because it can't find it. But karma config is a js script that can use commonJS module system. And it should do it, as any other js tooling code. ^KT-87304 Verification Pending
4b30772 to
6cc360c
Compare
|
/dry-run |
|
THIS IS A DRY RUN Quality gate is triggered at https://buildserver.labs.intellij.net/build/992306819 — use this link to get full insight. Quality gate was triggered with the following revisions:
Quality gate finished successfully. |
| """ | ||
| config.plugins = config.plugins || []; | ||
| config.plugins.push('kotlin-web-helpers/dist/karma-kotlin-reporter.js'); | ||
| config.plugins.push(require('kotlin-web-helpers/dist/karma-kotlin-reporter')); |
There was a problem hiding this comment.
I still don't understand why it might not be installed in root node_modules...
And I am sure that Karma does it on its side (https://github.com/karma-runner/karma/blob/84f85e7016efc2266fa6b3465f494a3fa151c85c/lib/plugin.js#L17)
However it requires the module related to karma which is supposed to be installed in root node_modules, so agree it is not equivalent things, require here and in karma package
| rootLevelWebHelpers.moveTo(packageLevelWebHelpers) | ||
|
|
||
| // -x kotlinNpmInstall to prevent overwriting | ||
| if (isTeamCityRun) { // Should be fixed by KTI-3326, but only in master branch |
There was a problem hiding this comment.
I'm not sure that it will work for karma even with the new configurations. There are no pre-bundled browsers on agent
Fixes KT-87304