You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once the cypress test passes the import line, inside the window.__coverage__ object, under Prototype, there is this key-value pair: Symbol(wasm type): 0.
After the test is run, while code coverage is processed, the window.__coverage__ object reaches this filter:
and apparently the lodash omitBy method will also go through key,value pairs inside Prototype, which makes the isTestFile method be called with the Symbol(wasm type) key, causing the following line to fail (where filePath is Symbol):
TypeError: filePath.replace is not a function
Because this error occurred during a `after each` hook we are skipping all of the remaining tests.
at isTestFile (webpack:///../../node_modules/@cypress/code-coverage/support-utils.js:31:0)
at filterSpecsFromCoverage (webpack:///../../node_modules/@cypress/code-coverage/support-utils.js:41:0)
at filterFilesFromCoverage (webpack:///../../node_modules/@cypress/code-coverage/support-utils.js:12:0)
at sendCoverage (webpack:///../../node_modules/@cypress/code-coverage/support.js:20:0)
at eval (webpack:///../../node_modules/@cypress/code-coverage/support.js:146:0)
at Array.forEach (<anonymous>)
at Context.eval (webpack:///../../node_modules/@cypress/code-coverage/support.js:145:0)
Workaround
// delete the symbol from the coverage prototype after each test, before it is processed by cypress/code-coverageletwindowObj={};constsaveWindowCoverageObject=(win: any)=>windowObj=win;beforeEach(()=>{cy.on('window:load',saveWindowCoverageObject);});afterEach(()=>{letsymbolKey;// eslint-disable-next-line no-underscore-dangleCypress._.omitBy(windowObj.__coverage__,(_,key)=>{if(typeofkey==='symbol'){symbolKey=key;}returntypeofkey==='symbol';});// eslint-disable-next-line no-underscore-dangledeletewindowObj.__coverage__.__proto__[symbolKey];});
I tried to exclude the assets and the file that does the dynamic import from instrumentation, but the Symbol is still persisted inside the coverage object. I couldn't identify what actually adds the symbol or why.
It would be helpful if the post processing done inside filterSpecsFromCoverage could ignore the symbol keys in order to avoid this kind of failure.
The text was updated successfully, but these errors were encountered:
Logs
Versions
3.13.6
13.15.2
22.4.1
10.8.1
loader: '@skyux-sdk/istanbul-instrumenter-loader',
inside webpack configwindow.__coverage__
object? yes.nyc_output
folder? Is there a.nyc_output/out.json
file? yes, not emptypackage.json
(nyc
object) or in other NYC config files? noDescribe the bug
My app dynamically loads a wasm lib from assets at runtime:
Once the cypress test passes the import line, inside the
window.__coverage__
object, under Prototype, there is this key-value pair:Symbol(wasm type): 0
.After the test is run, while code coverage is processed, the
window.__coverage__
object reaches this filter:and apparently the lodash omitBy method will also go through key,value pairs inside Prototype, which makes the isTestFile method be called with the Symbol(wasm type) key, causing the following line to fail (where filePath is Symbol):
And eventually the test fails with:
Workaround
I tried to exclude the assets and the file that does the dynamic import from instrumentation, but the Symbol is still persisted inside the coverage object. I couldn't identify what actually adds the symbol or why.
It would be helpful if the post processing done inside
filterSpecsFromCoverage
could ignore the symbol keys in order to avoid this kind of failure.The text was updated successfully, but these errors were encountered: