Skip to content
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

Ability to run Node for tests in the directory of the script #2143

Closed
nafg opened this issue Nov 25, 2022 · 3 comments
Closed

Ability to run Node for tests in the directory of the script #2143

nafg opened this issue Nov 25, 2022 · 3 comments
Labels
duplicate The issue is a duplicate of another one. Progress is tracked in another issue.

Comments

@nafg
Copy link
Contributor

nafg commented Nov 25, 2022

I'm trying to do something similar to scalajs-bundler in https://github.com/nafg/mill-bundler. One issue I'm hitting is that it needs to generate a package.json and npm install somewhere under out/, but IIUC because it's running Node from the base directory it won't see node_modules/.

This is even worse for JsDom, because with JsEnvConfig.NodeJs I can override fastLinkJSTest to inject a bundling step, producing a script that doesn't need node_modules anymore. But IIRC JsDom will require("jsdom") outside the script.

@nafg nafg changed the title Control of working directory for Node used for tests Ability to run Node for tests in the directory of the script Nov 25, 2022
@nafg
Copy link
Contributor Author

nafg commented Nov 25, 2022

On second thought...

I edited the title, because maybe the solution is not to have a new setting or parameter to pass in the working directory. Maybe it should automatically use the script's location as the working directory.

Although, I guess most people currently maintain a package.json by hand in the root directory and manually npm install. So I guess for them tests should run in the base directory. So maybe it does have to be a setting or parameter?

@lefou
Copy link
Member

lefou commented Nov 25, 2022

Typically in Mill, tests run in a forked process and support the setting of forkWorkingDir. Unfortunately, ScalaJSModule currently does not support this setting.

@lefou
Copy link
Member

lefou commented Nov 25, 2022

Duplicate of #1036

@lefou lefou marked this as a duplicate of #1036 Nov 25, 2022
@lefou lefou closed this as completed Nov 25, 2022
@lefou lefou added the duplicate The issue is a duplicate of another one. Progress is tracked in another issue. label Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate The issue is a duplicate of another one. Progress is tracked in another issue.
Projects
None yet
Development

No branches or pull requests

2 participants