[BUG] rimraf causes failure with multiple browsers on Windows
See original GitHub issueContext:
- PlayWright Version: 0.10.0
- Operating System: Windows 2019
Might relate to #680
Code Snippet
Run npx jest
const { chromium } = require("playwright");
test("browser one success", async () => {
const context = await chromium.launch();
await context.close();
});
test("browser two failure", async () => {
const context = await chromium.launch();
await context.close();
});
Describe the bug
The second test throws this error.
assert(received)
Expected value to be equal to:
true
Received:
false
at fixWinEPERM (node_modules/rimraf/rimraf.js:175:5)
at node_modules/rimraf/rimraf.js:160:15
Others have seen this same issue with rimraf on windows. https://github.com/facebook/jest/issues/3942#issuecomment-313169747 https://github.com/GoogleChrome/lighthouse/pull/2641
I tried to force the playwright-core resolution to rimraf 3.0.1 but I ran into the same issue.
Is there a way to remove the rimraf dependency and replace it with fs-extra, that seems to be an approach that worked here. https://github.com/getgauge/taiko/issues/837
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:8 (8 by maintainers)
Top Results From Across the Web
How to fix 'rimraf is not a recognized command' in Windows 10
I have tried uninstalling/installing node.js multiple times and running multiple different npm commands. It seems like powershell is incorrectly ...
Read more >What to do if Microsoft Edge isn't working
To free up memory: Close every tab except for the one that's showing the error message. Close other apps or programs that are...
Read more >error AggregateException The NPM script 'start' exited without ...
I think the problem can be caused by incorrect environment you specified. Please try to set the environment to production with the line...
Read more >Issues on Internet Explorer & Microsoft Edge (MSAL.js)
Known issues on Internet Explorer and Microsoft Edge browsers (MSAL.js) ... This is usually accompanied by an invalid_state error in the ...
Read more >Error 10016 - DCOM Config. Crashing browsers multiple times.
Hi there, guys. So, I did a bit of research to find out that Microsoft suggests that Error 10016 is harmless and won't...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Once/if https://github.com/isaacs/rimraf/pull/209 is merged and a new version is released, we can roll the dependency. It’ll fix this bug.
We’ll probably wait for a week to see if we can land the fix to rimraf. If there’s a delay, we can detect jest environment and provide
rimraf
with custom fs hooks that re-throw vm-native errorsOk, we now know what’s going on!
Investigation
A reduced repro of this behavior looks like this:
Reproduction without JSDOM
This code prints “false” because:
instanceof
’ing.Now, rimraf is doing an instanceof check for some of the errors it’s getting from FS module:
https://github.com/isaacs/rimraf/blob/d709272f6122b008de66650616fda34c8ae6f954/rimraf.js#L168
This check fails and yields this error.
Mitigation
Unfortunately, configuring jest to run in a
testEnvironment: node
(and thus not bringing in JSDOM) doesn’t help to mitigate this issue, because jest’s NodeEnvironment is doing a very similar thing. (And there seem to be some workarounds for some similar problems)Short-term, we should try fixing this upstream in rimraf - instead of
instanceof
’ing errors, it’d be probably fine to check for existence of astack
property.Long-term, I wonder if there’s something Jest can do better on their side to avoid this cross-vm type passing.