-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
Mocha tests are escaping the sandbox #353
Conversation
Indeed they are. Mocha seems to be skirting around the node fs patches somehow. The
|
We optimized js_binary to not copy data files to bin, which works if programs say in their runfiles, but it fails if they skirt the fs patches and leave since the symlinks are followed back to the source tree. |
We'll have to look into what mocha is doing internally. I just hit the same with the Angular architect test rule, which uses mocha under the hood. It may be related or the same issue. |
Put this PR up. #354. It won't prevent mocha from leaving the sandbox (we have to dig further into mocha to figure that one out), but it will keep it from following symlinks all the way to the source tree. Setting that flag will land mocha in the output tree where it can still see all of its inputs. |
Setting that attribute to True on the test target,
keeps that test process in the output-tree,
|
This one fixes the reporter resolution failure, #355 |
I tracked this one down yesterday. It is happening as mocha is using the esm via which ends up in It is unclear why that code path doesn't get the fs monkey paches and the cjs require loader does. To confirm this issue, changing the |
Issued opened for underlying cause #362 |
The attached test fails with the following (snipping the error from #345):
As seen in the assertion failure,
__dirname
points into the source tree, indicating that this test has escaped the sandbox. In a real repository, this leads to require failures because from the source tree, tests can't resolve relative paths to .js outputs compiled from TypeScript.