Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2016-02-06 01:33:29 +0300
committerRebecca Turner <me@re-becca.org>2016-05-04 02:13:30 +0300
commitef0dd74583be25c72343ed07d1127e4d0cc02df9 (patch)
tree30b4080431ff1d577e810ca823c66c2f3ea1dd8d /test/common-tap.js
parentf07e6430d4ca02f811138f6140a8bad927607a1f (diff)
test: fix Windows-specific test issues
This commit is a squash of many other commits. They all act on individual tests. Some of them have notable messages, which are preserved below: test: rewrite verify-no-lifecycle-on-repo to work on windows On windows, the previous version of this would open a new cmd window, run echo in it, and then leave it there, interactive, and wait for the window to be closed. test: Fix gently-rm-linked-module on windows We just need to make our link explicitly be a junction. This will work as long as you run tests on NTFS. It does NOT work on, for instance, vbox shared folders. test: Fix gently-rm-symlinked-global-dir to work on windows To do this we needed to do three things: 1. Be aware that npm doesn't use the same global path structure on windows. (No lib, bin, etc, all flat.) 2. Not tie the tests to platform-specific unicode support 3. Create our links as junctions, so ordinary users can make them test: Rewrite lifecycle-path to use `npm run env` This test predates the existence of `npm run env`-- by changing to use it we both get to get rid of an unneeded fixture and fix things to work on windows. test: fix config-edit on windows `child_process.spawn`, which is what the `editor` package uses does not support running straight-up scripts on Windows. Only `.exe`s For this reason, it's better to just explicitly use `node` here. test: Fix publish-access-unscoped-restricted-fails on windows This involved switching from a direct integration test to using common.npm, as the former method wasn't resulting in all files being closed which meant that `rimraf` of the test dir couldn't finish on Windows. test: Don't Object.keys on non typeof == object `Object.keys` is valid on any non-null, not undefined value in current versions of Node.js, but older versions would throw an error for any non typeof == object. test: fix gently-rm-linked-module when run from `npm run tap` `npm run tap` sets the npm_config_prefix env var, which was overriding the test's own attempt at setting the prefix (via the PREFIX env var). test: fix race in cache-shasum by using async rimraf Credit: @zkat Credit: @iarna PR-URL: https://github.com/npm/npm/pull/11444 Reviewed-By: @zkat Reviewed-By: @iarna Reviewed-By: @othiym23
Diffstat (limited to 'test/common-tap.js')
-rw-r--r--test/common-tap.js29
1 files changed, 24 insertions, 5 deletions
diff --git a/test/common-tap.js b/test/common-tap.js
index 9fe84b31b..847c87ba0 100644
--- a/test/common-tap.js
+++ b/test/common-tap.js
@@ -48,8 +48,7 @@ exports.npm = function (cmd, opts, cb) {
var stdout = ''
var stderr = ''
- var node = process.execPath
- var child = spawn(node, cmd, opts)
+ var child = spawn(nodeBin, cmd, opts)
if (child.stderr) {
child.stderr.on('data', function (chunk) {
@@ -97,6 +96,26 @@ exports.makeGitRepo = function (params, cb) {
chain(commands, cb)
}
-var isWindows = exports.isWindows = process.platform === 'win32'
-// Differentiate cmd/powershell from gitbash (mintty & mingw)
-exports.isWindowsShell = isWindows && process.env.TERM !== 'xterm'
+exports.readBinLink = function (path) {
+ if (isWindows) {
+ return readCmdShim.sync(path)
+ } else {
+ return fs.readlinkSync(path)
+ }
+}
+
+exports.skipIfWindows = function (why) {
+ if (!isWindows) return
+ console.log('1..1')
+ if (!why) why = 'this test not available on windows'
+ console.log('ok 1 # skip ' + why)
+ process.exit(0)
+}
+
+exports.pendIfWindows = function (why) {
+ if (!isWindows) return
+ console.log('1..1')
+ if (!why) why = 'this test is pending further changes on windows'
+ console.log('not ok 1 # todo ' + why)
+ process.exit(0)
+}