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

test: add test-npm-install to parallel tests suite #5166

Closed
wants to merge 1 commit into from

Conversation

MylesBorins
Copy link
Contributor

Currently we are not testing that npm install works.

This is a very naive / basic test that shells out to npm install
in an empty tempDir. While this test will not be able to check
that npm install is 100% working, it should catch certain edge
cases that break it.

This is currently blocked from being tested until #4525 lands

/cc @nodejs/npm @nodejs/testing

@MylesBorins
Copy link
Contributor Author

CI: https://ci.nodejs.org/job/node-test-pull-request/1613/
Expected to be all red as npm is broken on master

proc.on('exit', function(code) {
// npm install in tmpDir should be essentially a no-op
// if npm is not broken the process should always exit 0
// assert that there are no obvious failures
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: capitalization and (more importantly) punctuation in comments. I tried reading the first two lines four or five times before I figured out that each line is its own sentence.

@MylesBorins MylesBorins changed the title test: add test-npm-install to parallel tests suite WIP test: add test-npm-install to parallel tests suite Feb 9, 2016
@MylesBorins
Copy link
Contributor Author

It seems like whatever I had working locally is not working atm... digging in

proc.stderr.setEncoding('utf8');

proc.stdout.on('data', (data) => stdout += data);
proc.stdout.on('err', (data) => stderr += data);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably no need to capture stdout and stderr if nothing will be done with them.

@Trott
Copy link
Member

Trott commented Feb 9, 2016

If it passes again when npm is fixed on master, LGTM with comments.

@MylesBorins MylesBorins changed the title WIP test: add test-npm-install to parallel tests suite test: add test-npm-install to parallel tests suite Feb 9, 2016
@MylesBorins
Copy link
Contributor Author

@Trott updated which fixes all your nits

@mscdex mscdex added test Issues and PRs related to the tests. npm Issues and PRs related to the npm client dependency or the npm registry. labels Feb 9, 2016
'npm',
'bin',
'npm-cli.js'
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maxogden can you elaborate?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

less likely to break if npm changes their entry point. prob doesnt matter though :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see what you mean.

I'd prefer to not start grabbing package.json and resolving the path from there... lots of extra logic.

If npm changes their entry point this test will break when they send in a PR... it will be a pretty easy fix

@MylesBorins
Copy link
Contributor Author

closing in favor of #5163

will reopen if that does not land

@MylesBorins
Copy link
Contributor Author

@bnoordhuis
Copy link
Member

This test doesn't strike me as a very good idea for two reasons:

  1. It seems to require internet access, which makes it unsuitable for test/parallel. test/internet is a better place but it's not run on the CI.
  2. Correct me if I'm wrong, but a plain npm install will walk up the directory tree until it finds a node_modules directory, right? That means you could get some pretty arbitrary behavior based on what people have installed outside their node source tree.

@jasnell
Copy link
Member

jasnell commented Mar 2, 2016

Marking as don't land in v4 until we're certain this is going to work out.

@orangemocha
Copy link
Contributor

LGTM if CI is happy. The last CI run failed because a slave went offline. New run here: https://ci.nodejs.org/job/node-test-pull-request/1817/

Currently we are not testing that `npm install` works.

This is a very naive / basic test that shells out to `npm install`
in an empty `tempDir`. While this test will not be able to check
that `npm install` is 100% working, it should catch certain edge
cases that break it.
@MylesBorins
Copy link
Contributor Author

CI is all green. I attempted to look for network traffic but with wireshark, but I'm not familiar enough with it to really get a clear reading, too much noise.

I was talking to @zkat last night who implied there should be no network traffic. Maybe @iarna or @othiym23 can chime in

@iarna
Copy link
Member

iarna commented Mar 4, 2016

npm definitely doesn't do anything on the network with an empty package.json. Even with dependencies, it'll only touch the network if your deps require it (eg, registry, remote tarball, remote git repo).

@MylesBorins
Copy link
Contributor Author

I'm not seeing any -1's and I'm seeing 3 LGTM's

I'll land this at some point on Monday if no one else has objections

@santigimeno
Copy link
Member

Following @iarna comment, would it be a good idea to add a local path as a dependency? Something like this:

"test-module": "file:///path/to/test-module"

If I understand it correctly, it would not trigger any network operation.

@iarna
Copy link
Member

iarna commented Mar 5, 2016

@santigimeno you'd probably want a relative path, but yeah, that'd exercise a bit more. But I'd be -1 on holding back this PR any further. Seems like that'd make a fine new PR though.

(And for the record, I'm LGTM on this as is.)

@santigimeno
Copy link
Member

Ok, I can to that when this PR is merged. Thanks

MylesBorins pushed a commit to MylesBorins/node that referenced this pull request Mar 7, 2016
Currently we are not testing that `npm install` works.

This is a very naive / basic test that shells out to `npm install`
in an empty `tempDir`. While this test will not be able to check
that `npm install` is 100% working, it should catch certain edge
cases that break it.

PR-URL: nodejs#5166
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Alexis Campailla <orangemocha@nodejs.org>
@MylesBorins
Copy link
Contributor Author

landed in 061ebb3

@MylesBorins MylesBorins closed this Mar 7, 2016
@Fishrock123 Fishrock123 mentioned this pull request Mar 7, 2016
Fishrock123 pushed a commit that referenced this pull request Mar 8, 2016
Currently we are not testing that `npm install` works.

This is a very naive / basic test that shells out to `npm install`
in an empty `tempDir`. While this test will not be able to check
that `npm install` is 100% working, it should catch certain edge
cases that break it.

PR-URL: #5166
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Alexis Campailla <orangemocha@nodejs.org>
Fishrock123 pushed a commit that referenced this pull request Mar 8, 2016
Currently we are not testing that `npm install` works.

This is a very naive / basic test that shells out to `npm install`
in an empty `tempDir`. While this test will not be able to check
that `npm install` is 100% working, it should catch certain edge
cases that break it.

PR-URL: #5166
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Alexis Campailla <orangemocha@nodejs.org>
@santigimeno santigimeno mentioned this pull request Mar 9, 2016
4 tasks
@MylesBorins
Copy link
Contributor Author

@jasnell are you open to moving to lts watch?

@jasnell
Copy link
Member

jasnell commented Mar 11, 2016

I haven't been following how well this has been working since it landed. I assume no issues?

@MylesBorins
Copy link
Contributor Author

moving to lts-watch as there have been no issues

MylesBorins pushed a commit that referenced this pull request Mar 30, 2016
Currently we are not testing that `npm install` works.

This is a very naive / basic test that shells out to `npm install`
in an empty `tempDir`. While this test will not be able to check
that `npm install` is 100% working, it should catch certain edge
cases that break it.

PR-URL: #5166
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Alexis Campailla <orangemocha@nodejs.org>
MylesBorins pushed a commit that referenced this pull request Mar 30, 2016
Currently we are not testing that `npm install` works.

This is a very naive / basic test that shells out to `npm install`
in an empty `tempDir`. While this test will not be able to check
that `npm install` is 100% working, it should catch certain edge
cases that break it.

PR-URL: #5166
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Alexis Campailla <orangemocha@nodejs.org>
@MylesBorins MylesBorins deleted the test-npm branch April 16, 2016 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
npm Issues and PRs related to the npm client dependency or the npm registry. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.