-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
test: update test-npm to work with npm 3 #3308
Conversation
Unfortunately, I don't think this will quite work. We moved to this change a while ago so that we could run Is it possible to fix this on npm's end? I'll take a deeper look when I am back at my computer. |
Oh yes, I remember that now, yeah, the version you have currently doesn't do what you want with npm 3 either, because our scripts are built a few layers deep. I'll update this patch in a little bit. |
147ea7b
to
e31128c
Compare
Ok, I've updated the PR, making this the npm@3 equivalent of the old npm@2 incantation. |
@iarna hmm, something isn't right here. I'm using node @ (This and #3310)
(And also the following diff, to simplify output.) diff --git a/src/node_version.h b/src/node_version.h
index 37dee1e..39b52ae 100644
--- a/src/node_version.h
+++ b/src/node_version.h
@@ -5,7 +5,7 @@
#define NODE_MINOR_VERSION 0
#define NODE_PATCH_VERSION 0
-#define NODE_VERSION_IS_RELEASE 0
+#define NODE_VERSION_IS_RELEASE 1
#ifndef NODE_STRINGIFY
#define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n)
diff --git a/tools/test-npm.sh b/tools/test-npm.sh
index cbb76cc..ccaa716 100755
--- a/tools/test-npm.sh
+++ b/tools/test-npm.sh
@@ -31,7 +31,7 @@ export npm_config_tmp="npm-tmp"
# install npm devDependencies and run npm's tests
../$NODE cli.js install --ignore-scripts
-../$NODE cli.js run-script test-legacy
+# ../$NODE cli.js run-script test-legacy
../$NODE cli.js run-script tap -- \"test/tap/*.js\"
# clean up everything one single shot And I'm getting this output, where tap just hangs forever at the end.
So I think, maybe this doesn't quite interact correctly with how we are setting up the test environment from the shell script? |
Ok, I built my own integration branch and merged these two and also took my existing node/npm's out of my path and I'm running the test suite now. As soon as it passes I'll push an update to the |
Ok, I've pushed an update that runs through all the tests successfully (at least in my integration branch). Alternatively, I've ALSO prepared a patch to npm itself (which we will likely integrate regardless) to make it very careful to always use the version of node and npm that the test suite was originally initiated with. You can see that over here: npm/npm#9982 |
@iarna does npm/npm#9982 mean we could just run |
@Fishrock123 Yes, but I have to convince folks that we should land something that can't work on windows. (Our test suite currently is mostly broken on windows, but this wouldn't be helping. Making it all work on windows will be a Project.) |
../$NODE cli.js install --ignore-scripts | ||
../$NODE cli.js run-script test-legacy | ||
../$NODE cli.js run-script test | ||
NODEPATH="$(../$NODE -e 'console.log(require("path").resolve(".."))')" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
node -p
:)
Fwiw I had previously attempted to do something similar in a previous version of PR 1984: #1984 (comment)
Does the npm patch remove the need for this? I.e. will the new npm patch run without a global node? If so, that would be great for us. :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it should, as it executes all other instances w/ the NODE
env var set by npm based on process.execPath
.
And oh, that's much easier =D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushing w/ -p
@iarna The changes to If so, maybe it would be better to float that and only fix test-legacy here. |
@Fishrock123 Yes, and I'm sure there will be no objection to landing those. It's the whole way npm now builds its lifecycles out of other lifecycles that's painful. Previously it was just |
Ok then I think the path forward would to be call the commands that As far as I can tell that should make the PRs good-to-go, but I'll also do a test run in it's current state. |
I am slightly concerned that |
@Fishrock123 I was concerned about that too! So I double checked its source and it uses |
NODEPATH="$(../$NODE -p 'require("path").resolve("..")')" | ||
PATH="$NODEPATH:$PATH" ../$NODE cli.js install --ignore-scripts | ||
PATH="$NODEPATH:$PATH" ../$NODE test/run.js | ||
PATH="$NODEPATH:$PATH" ../$NODE cli.js run-script tap -- "test/tap/*.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok one thing here: could you do export PATH="$NODEPATH:$PATH"
above these three lines? To my understanding it should give the same effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct, it'll only matter if there's other work in this script that cares about PATH, which there isn't
LGTM minus a comment. |
../$NODE cli.js install --ignore-scripts | ||
../$NODE cli.js run-script test-legacy | ||
../$NODE cli.js run-script test | ||
NODEPATH="$(../$NODE -p 'require("path").resolve("..")')" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rvagg can I get a quick LGTM on changing this line to export PATH="$(../$NODE -p 'require("path").resolve("..")'):$PATH"
?
That will mean we no longer require the PATH="$NODEPATH:$PATH"
on the 3 lines below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @nodejs/build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, that'll do, can be improved later perhaps
Refs: #3308 PR-URL: #3489 Reviewed-By: Rod Vagg <[email protected]>
Replaced by #3489 / ecab7a6...9b88864 - thanks for finding this in advance though! |
This is a prerequisite for bringing in npm 3. This will still work with npm 2.
The reason this is a problem is that in npm 3,
test-legacy
andtest
both runstandard
against the source tree. Whentest-legacy
runs it installs things into its temp directory, which with node'smake test-npm
, is located in the npm folder itself. So whennpm run-script test
executes, it runs standard, which sees the things installed bytest-legacy
and refuses to continue. Usingtest-all
solves this problem by combiningtest-legacy
withtest
all in a single command.npm itself never puts the temp folder in npm's source folder and so had never encountered this on its own.
r: @Fishrock123
r: @chrisdickinson