summaryrefslogtreecommitdiff
path: root/test/parallel/test-npm-install.js
AgeCommit message (Collapse)Author
2019-11-25test: change object assign to spread objectpoutch
change object assign to spread object in test-npm-install.js PR-URL: https://github.com/nodejs/node/pull/30422 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2019-07-05test: create home for test-npm-installDaniel Bevenius
This test currently fails if run as root: npm ERR! makeDirectory homeless? npm WARN install-dir No description npm WARN install-dir No repository field. npm WARN install-dir No license field. npm ERR! path /root/node/test/.tmp.0/npm-sandbox/home npm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall stat npm ERR! enoent ENOENT: no such file or directory, stat '/root/node/test/.tmp.0/npm-sandbox/home' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent assert.js:89 throw new AssertionError(obj); ^ AssertionError [ERR_ASSERTION]: npm install got error code 254 at handleExit (/root/node/test/parallel/test-npm-install.js:60:10) at /root/node/test/common/index.js:371:15 at ChildProcess.exithandler (child_process.js:304:5) at ChildProcess.emit (events.js:203:13) at maybeClose (internal/child_process.js:1028:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) { generatedMessage: false, code: 'ERR_ASSERTION', actual: 254, expected: 0, operator: 'strictEqual' } The home directory will be created as expected by npm in the npmSandbox when run as non-root, but when run as root this directory has to exist. This commit creates the home directory to allow the test to pass also when run as the root user. Refs:https://github.com/npm/cli/blob/ 31718e72cb5a03cee7127fc36843e4b55c868d93/ lib/utils/correct-mkdir.js#L82-L105 PR-URL: https://github.com/nodejs/node/pull/28510 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-01-31test: move tmpdir to submodule of commonRich Trott
Move tmpdir functionality to its own module (common/tmpdir). PR-URL: https://github.com/nodejs/node/pull/17856 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2017-12-08test: replace fs.accessSync with fs.existsSyncLeko
PR-URL: https://github.com/nodejs/node/pull/17446 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-10-08test: replace fixturesDir with fixtures moduleBinarySo1o
PR-URL: https://github.com/nodejs/node/pull/15961 Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-09-03test: remove envPlus, use Object.assign everywhereGibson Fahnestock
PR-URL: https://github.com/nodejs/node/pull/14845 Fixes: https://github.com/nodejs/node/issues/14823 Refs: https://github.com/nodejs/node/pull/14822 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
2017-08-26test: pipe some error output if npm failsJeremiah Senkpiel
This test now prints out some child error output if the npm child proc fails, allowing us to debug easier. PR-URL: https://github.com/nodejs/node/pull/12490 Refs: https://github.com/nodejs/node/pull/12480 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-07-04test: simplify test skippingVse Mozhet Byt
* Make common.skip() exit. Also add common.printSkipMessage() for partial skips. * Don't make needless things before skip PR-URL: https://github.com/nodejs/node/pull/14021 Fixes: https://github.com/nodejs/node/issues/14016 Reviewed-By: Refael Ackermann <refack@gmail.com>
2017-05-05test: reduce string concatenationsVse Mozhet Byt
PR-URL: https://github.com/nodejs/node/pull/12735 Refs: https://github.com/nodejs/node/pull/12455 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-02-01test: improve error messages in test-npm-installGonen Dukas
PR-URL: https://github.com/nodejs/node/pull/11027 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2017-01-11test: s/assert.equal/assert.strictEqual/Gibson Fahnestock
Use assert.strictEqual instead of assert.equal in tests, manually convert types where necessary. PR-URL: https://github.com/nodejs/node/pull/10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
2016-11-25test: refactor common.jsRich Trott
* remove unused common.faketimeCli * remove mosly-unused common.testDir * assert.ok(false...) -> fail() * alphabetize list of known globals * .indexOf() -> .includes() PR-URL: https://github.com/nodejs/node/pull/9732 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
2016-10-17test: use npm sandbox in test-npm-installJoão Reis
npm should run in a sandbox to avoid unwanted interactions. Without this change, npm would read the userconfig file $HOME/.npmrc which may contain configs that break this test. Fixes: https://github.com/nodejs/node/issues/9074 PR-URL: https://github.com/nodejs/node/pull/9079 Reviewed-By: Jeremiah Senkpiel <Fishrock123@rocketmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-06-08test: fix tests for non-crypto buildsAnna Henningsen
Fix running the tests when node was compiled without crypto support. Some of these are cleanup after 52bae222a3a8480b2, where common was used before it was required. PR-URL: https://github.com/nodejs/node/pull/7056 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-05-17test: robust handling of env for npm-test-installMyles Borins
Currently we are overwriting the entire env object of the child-process spawned in `npm-test-install`. This commit alternatively clones the `process.env` object and modifies it with the neccessary changes before passing it the the spawned process. Fixes: https://github.com/nodejs/node/issues/6736 PR-URL: https://github.com/nodejs/node/pull/6797 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-05-11test: ensure test-npm-install uses correct nodeMyles Borins
Currently it is possible that the shelled out instance of npm will use the system copy of node. This PR changes the test to shim the build directory into the path. This will ensure that npm will use the correct version of node. fixes: https://github.com/nodejs/node/issues/6648 PR-URL: https://github.com/nodejs/node/pull/6658 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-03-14test: improve test-npm-installSantiago Gimeno
Make npm install a dependency that is defined as a relative path, so it avoids any network interaction. PR-URL: https://github.com/nodejs/node/pull/5613 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com>
2016-03-07test: add test-npm-install to parallel tests suiteMyles Borins
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: https://github.com/nodejs/node/pull/5166 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Alexis Campailla <orangemocha@nodejs.org>