Skip to content

Commit

Permalink
Convert shrinkwrap test script from bash to Node.
Browse files Browse the repository at this point in the history
Works better on Windows.
  • Loading branch information
domenic authored and isaacs committed Dec 5, 2012
1 parent 223cada commit 390cc40
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion test/packages/npm-test-shrinkwrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"minimatch": "~0.1.0"
},
"scripts": {
"test": "bash test.sh"
"test": "node test.js"
}
}
19 changes: 19 additions & 0 deletions test/packages/npm-test-shrinkwrap/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
var path = require("path")
var assert = require("assert")

process.env.npm_config_prefix = process.cwd()
delete process.env.npm_config_global
delete process.env.npm_config_depth

var npm = path.resolve(process.env.npm_config_prefix, "../../npm")

require("child_process").exec(npm + " ls --json", {
stdio: "pipe", env: process.env, cwd: process.cwd() },
function (err, stdout, stderr) {
if (err) throw err

var actual = JSON.parse(stdout).dependencies
var expected = require("./npm-shrinkwrap.json").dependencies

assert.deepEqual(actual, expected)
})
20 changes: 0 additions & 20 deletions test/packages/npm-test-shrinkwrap/test.sh

This file was deleted.

0 comments on commit 390cc40

Please sign in to comment.