fix(libnpmpack): obey foregroundScripts#5430
Conversation
|
This is failing due to the reduced test coverage. I can't figure out a way to test this behavior just from using What's the best way to go about this? |
While we haven't started using it in this repo, mocking spawn is a thing we do in other npm cli subdependencies, and in the npm tests too. We use https://github.com/wraithgar/spawk. For good patterns you can check out the
|
2e45bdd to
16fce25
Compare
|
@wraithgar I attempted to use spawk here, but am running into an issue. The command and arguments that are passed to |
|
It looks like overriding |
3037d35 to
f3b0c43
Compare
|
Hey @wraithgar, just bumping this in case you forgot about my last comment :) |
|
I did see it. We are currently focused on breaking changes for npm 9 and there isn't any bandwidth right now for anyone to help you on this. If you can figure the tests out, great. If not, this can wait a bit till someone can look at it. |
16fce25 to
a35ed95
Compare
a35ed95 to
d3d7dbc
Compare
|
I figured it out -- spawk needed to be initialized before everything else was imported. (Technically this would work all the same if I moved it before just a subset of the imports, but I figured this is best.) |
|
I guess I have to update |
|
How did you add |
|
|
After reverting |
|
Well fiddlesticks. Good news is you found a case that causes that error to happen so we can debug it now. Bad news is you can't install and update the md file. Go ahead and install with Can you also make sure your branch is rebased against |
|
@winterqt I am so sorry I told you to run the wrong command. It should be |
|
I feel really bad about this. You've worked really hard on this PR and I know it's probably frustrating that this is the part we're getting blocked on. The PR itself looks great and once we sort the problem of adding |
|
In the interest of getting this out today (release day!) I went ahead and fixed the spawk install in another branch, leaving your work in its own commit: #5645 |
Before this change,
npm packwould not respect--foreground-scripts, so when {pre,post}pack scripts were run, the output would be polluted with output from those scripts.I'm not sure how I'd test the output of this from
libnpmpacktests, like the arborist test does. If anyone can give me any pointers on that, I'd be happy to add a test.Also: tips on decreasing the length of the commit message are appreciated, the cutoff is a bit jarring.
References
Fixes #4121.