| @@ -1,5 +1,5 @@ | ||
| { "name":"npm-test-blerg" | ||
| , "version" : "0.0.2" | ||
| , "scripts" : { "test" : "node test.js" } | ||
| , "publishConfig": {"tag": "foo"} | ||
| } |
| @@ -0,0 +1,122 @@ | ||
| // this is a weird meta test. It verifies that all the instances of | ||
| // `npm.config.get(...)` are: | ||
| // a) Simple strings, and not variables | ||
| // b) Documented | ||
| // c) Defined in the `npmconf` package. | ||
|
|
||
| var test = require("tap").test | ||
| var fs = require("fs") | ||
| var path = require("path") | ||
| var root = path.resolve(__dirname, "..", "..") | ||
| var lib = path.resolve(root, "lib") | ||
| var nm = path.resolve(root, "node_modules") | ||
| var doc = path.resolve(root, "doc/misc/npm-config.md") | ||
| var FILES = [] | ||
| var CONFS = {} | ||
| var DOC = {} | ||
|
|
||
| var exceptions = [ | ||
| path.resolve(lib, "config.js"), | ||
| path.resolve(lib, "utils", "lifecycle.js") | ||
| ] | ||
|
|
||
| test("get files", function (t) { | ||
| walk(nm) | ||
| walk(lib) | ||
| t.pass("got files") | ||
| t.end() | ||
|
|
||
| function walk(lib) { | ||
| var files = fs.readdirSync(lib).map(function (f) { | ||
| return path.resolve(lib, f) | ||
| }) | ||
| files.forEach(function (f) { | ||
| if (fs.statSync(f).isDirectory()) | ||
| walk(f) | ||
| else if (f.match(/\.js$/)) | ||
| FILES.push(f) | ||
| }) | ||
| } | ||
| }) | ||
|
|
||
| test("get lines", function (t) { | ||
| FILES.forEach(function (f) { | ||
| console.error(f) | ||
| var lines = fs.readFileSync(f, 'utf8').split('\n') | ||
| lines.forEach(function (l, i) { | ||
| var matches = l.split(/conf(?:ig)?\.get\(/g) | ||
| matches.shift() | ||
| matches.forEach(function (m) { | ||
| m = m.split(')').shift() | ||
| var literal = m.match(/^['"].+['"]$/) | ||
| if (literal) { | ||
| m = m.slice(1, -1) | ||
| if (!m.match(/^\_/) && m !== 'argv') | ||
| CONFS[m] = { | ||
| file: f, | ||
| line: i | ||
| } | ||
| } else if (exceptions.indexOf(f) === -1) { | ||
| t.fail("non-string-literal config used in " + f + ":" + i) | ||
| } | ||
| }) | ||
| }) | ||
| }) | ||
| t.pass("got lines") | ||
| t.end() | ||
| }) | ||
|
|
||
| test("get docs", function (t) { | ||
| var d = fs.readFileSync(doc, "utf8").split("\n") | ||
| // walk down until the "## Config Settings" section | ||
| for (var i = 0; i < d.length && d[i] !== "## Config Settings"; i++); | ||
| i++ | ||
| // now gather up all the ^###\s lines until the next ^##\s | ||
| var doclines = [] | ||
| for (; i < d.length && !d[i].match(/^## /); i++) { | ||
| if (d[i].match(/^### /)) | ||
| DOC[ d[i].replace(/^### /, '').trim() ] = true | ||
| } | ||
| t.pass("read the docs") | ||
| console.error(DOC) | ||
| t.end() | ||
| }) | ||
|
|
||
| test("check configs", function (t) { | ||
| var defs = require("npmconf/config-defs.js") | ||
| var types = Object.keys(defs.types) | ||
| var defaults = Object.keys(defs.defaults) | ||
|
|
||
| for (var c in CONFS) { | ||
| if (CONFS[c].file.indexOf(lib) === 0) { | ||
| t.ok(DOC[c], "should be documented " + c + " " | ||
| + CONFS[c].file + ":" + CONFS[c].line) | ||
| t.ok(types.indexOf(c) !== -1, "should be defined in npmconf " + c) | ||
| t.ok(defaults.indexOf(c) !== -1, "should have default in npmconf " + c) | ||
| } | ||
| } | ||
|
|
||
| for (var c in DOC) { | ||
| if (c !== "versions" && c !== "version") { | ||
| t.ok(CONFS[c], "config in doc should be used somewhere " + c) | ||
| t.ok(types.indexOf(c) !== -1, "should be defined in npmconf " + c) | ||
| t.ok(defaults.indexOf(c) !== -1, "should have default in npmconf " + c) | ||
| } | ||
| } | ||
|
|
||
| types.forEach(function(c) { | ||
| if (!c.match(/^\_/) && c !== 'argv' && !c.match(/^versions?$/)) { | ||
| t.ok(DOC[c], 'defined type should be documented ' + c) | ||
| t.ok(CONFS[c], 'defined type should be used ' + c) | ||
| } | ||
| }) | ||
|
|
||
| defaults.forEach(function(c) { | ||
| if (!c.match(/^\_/) && c !== 'argv' && !c.match(/^versions?$/)) { | ||
| t.ok(DOC[c], 'defaulted type should be documented ' + c) | ||
| t.ok(CONFS[c], 'defaulted type should be used ' + c) | ||
| } | ||
| }) | ||
|
|
||
| t.end() | ||
| }) |
| @@ -0,0 +1,71 @@ | ||
| var test = require("tap").test | ||
| var npm = require.resolve("../../bin/npm-cli.js") | ||
|
|
||
| var spawn = require("child_process").spawn | ||
| var node = process.execPath | ||
|
|
||
| // ignore-scripts/package.json has scripts that always exit with non-zero error | ||
| // codes. The "install" script is omitted so that npm tries to run node-gyp, | ||
| // which should also fail. | ||
| var pkg = __dirname + "/ignore-scripts" | ||
|
|
||
| test("ignore-scripts: install using the option", function(t) { | ||
| createChild([npm, "install", "--ignore-scripts"]).on("close", function(code) { | ||
| t.equal(code, 0) | ||
| t.end() | ||
| }) | ||
| }) | ||
|
|
||
| test("ignore-scripts: install NOT using the option", function(t) { | ||
| createChild([npm, "install"]).on("close", function(code) { | ||
| t.notEqual(code, 0) | ||
| t.end() | ||
| }) | ||
| }) | ||
|
|
||
| var scripts = [ | ||
| "prepublish", "publish", "postpublish", | ||
| "preinstall", "install", "postinstall", | ||
| "preuninstall", "uninstall", "postuninstall", | ||
| "preupdate", "update", "postupdate", | ||
| "pretest", "test", "posttest", | ||
| "prestop", "stop", "poststop", | ||
| "prestart", "start", "poststart", | ||
| "prerestart", "restart", "postrestart" | ||
| ] | ||
|
|
||
| scripts.forEach(function(script) { | ||
| test("ignore-scripts: run-script"+script+" using the option", function(t) { | ||
| createChild([npm, "--ignore-scripts", "run-script", script]) | ||
| .on("close", function(code) { | ||
| t.equal(code, 0) | ||
| t.end() | ||
| }) | ||
| }) | ||
| }) | ||
|
|
||
| scripts.forEach(function(script) { | ||
| test("ignore-scripts: run-script "+script+" NOT using the option", function(t) { | ||
| createChild([npm, "run-script", script]).on("close", function(code) { | ||
| t.notEqual(code, 0) | ||
| t.end() | ||
| }) | ||
| }) | ||
| }) | ||
|
|
||
| function createChild (args) { | ||
| var env = { | ||
| HOME: process.env.HOME, | ||
| Path: process.env.PATH, | ||
| PATH: process.env.PATH | ||
| } | ||
|
|
||
| if (process.platform === "win32") | ||
| env.npm_config_cache = "%APPDATA%\\npm-cache" | ||
|
|
||
| return spawn(node, args, { | ||
| cwd: pkg, | ||
| stdio: "inherit", | ||
| env: env | ||
| }) | ||
| } |
| @@ -0,0 +1 @@ | ||
| bad_binding_file |
| @@ -0,0 +1,30 @@ | ||
| { | ||
| "author": "Milton the Aussie", | ||
| "name": "ignore-scripts", | ||
| "version": "0.0.0", | ||
| "scripts": { | ||
| "prepublish": "exit 123", | ||
| "publish": "exit 123", | ||
| "postpublish": "exit 123", | ||
| "preinstall": "exit 123", | ||
| "postinstall": "exit 123", | ||
| "preuninstall": "exit 123", | ||
| "uninstall": "exit 123", | ||
| "postuninstall": "exit 123", | ||
| "preupdate": "exit 123", | ||
| "update": "exit 123", | ||
| "postupdate": "exit 123", | ||
| "pretest": "exit 123", | ||
| "test": "exit 123", | ||
| "posttest": "exit 123", | ||
| "prestop": "exit 123", | ||
| "stop": "exit 123", | ||
| "poststop": "exit 123", | ||
| "prestart": "exit 123", | ||
| "start": "exit 123", | ||
| "poststart": "exit 123", | ||
| "prerestart": "exit 123", | ||
| "restart": "exit 123", | ||
| "postrestart": "exit 123" | ||
| } | ||
| } |
| @@ -0,0 +1,72 @@ | ||
| var test = require("tap").test | ||
| var rimraf = require("rimraf") | ||
|
|
||
| var mr = require("npm-registry-mock") | ||
|
|
||
| var spawn = require("child_process").spawn | ||
| var npm = require.resolve("../../bin/npm-cli.js") | ||
| var node = process.execPath | ||
| var pkg = "./url-dependencies" | ||
|
|
||
| var mockRoutes = { | ||
| "get": { | ||
| "/underscore/-/underscore-1.3.1.tgz": [200] | ||
| } | ||
| } | ||
|
|
||
| test("url-dependencies: download first time", function(t) { | ||
| rimraf.sync(__dirname + "/url-dependencies/node_modules") | ||
|
|
||
| performInstall(function(output){ | ||
| if(!tarballWasFetched(output)){ | ||
| t.fail("Tarball was not fetched") | ||
| }else{ | ||
| t.pass("Tarball was fetched") | ||
| } | ||
| t.end() | ||
| }) | ||
| }) | ||
|
|
||
| test("url-dependencies: do not download subsequent times", function(t) { | ||
| rimraf.sync(__dirname + "/url-dependencies/node_modules") | ||
|
|
||
| performInstall(function(){ | ||
| performInstall(function(output){ | ||
| if(tarballWasFetched(output)){ | ||
| t.fail("Tarball was fetched second time around") | ||
| }else{ | ||
| t.pass("Tarball was not fetched") | ||
| } | ||
| t.end() | ||
| }) | ||
| }) | ||
| }) | ||
|
|
||
| function tarballWasFetched(output){ | ||
| return output.indexOf("http GET http://localhost:1337/underscore/-/underscore-1.3.1.tgz") > -1 | ||
| } | ||
|
|
||
| function performInstall (cb) { | ||
| mr({port: 1337, mocks: mockRoutes}, function(s){ | ||
| var output = "" | ||
| , child = spawn(node, [npm, "install"], { | ||
| cwd: pkg, | ||
| env: { | ||
| npm_config_registry: "http://localhost:1337", | ||
| npm_config_cache_lock_stale: 1000, | ||
| npm_config_cache_lock_wait: 1000, | ||
| HOME: process.env.HOME, | ||
| Path: process.env.PATH, | ||
| PATH: process.env.PATH | ||
| } | ||
| }) | ||
|
|
||
| child.stderr.on("data", function(data){ | ||
| output += data.toString() | ||
| }) | ||
| child.on("close", function () { | ||
| s.close() | ||
| cb(output) | ||
| }) | ||
| }) | ||
| } |
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "author": "Steve Mason", | ||
| "name": "url-dependencies", | ||
| "version": "0.0.0", | ||
| "dependencies": { | ||
| "underscore": "http://localhost:1337/underscore/-/underscore-1.3.1.tgz" | ||
| } | ||
| } |
| @@ -0,0 +1,68 @@ | ||
| date: Thu Dec 19 09:02:48 PST 2013 | ||
| version: 0.10.24 | ||
| category: release | ||
| title: Node v0.10.24 (Stable) | ||
| slug: node-v0-10-24-stable | ||
|
|
||
| 2013.12.18, Version 0.10.24 (Stable) | ||
|
|
||
| * uv: Upgrade to v0.10.21 | ||
|
|
||
| * npm: upgrade to 1.3.21 | ||
|
|
||
| * v8: backport fix for CVE-2013-{6639|6640} | ||
|
|
||
| * build: unix install node and dep library headers (Timothy J Fontaine) | ||
|
|
||
| * cluster, v8: fix --logfile=%p.log (Ben Noordhuis) | ||
|
|
||
| * module: only cache package main (Wyatt Preul) | ||
|
|
||
|
|
||
| Source Code: http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz | ||
|
|
||
| Macintosh Installer (Universal): http://nodejs.org/dist/v0.10.24/node-v0.10.24.pkg | ||
|
|
||
| Windows Installer: http://nodejs.org/dist/v0.10.24/node-v0.10.24-x86.msi | ||
|
|
||
| Windows x64 Installer: http://nodejs.org/dist/v0.10.24/x64/node-v0.10.24-x64.msi | ||
|
|
||
| Windows x64 Files: http://nodejs.org/dist/v0.10.24/x64/ | ||
|
|
||
| Linux 32-bit Binary: http://nodejs.org/dist/v0.10.24/node-v0.10.24-linux-x86.tar.gz | ||
|
|
||
| Linux 64-bit Binary: http://nodejs.org/dist/v0.10.24/node-v0.10.24-linux-x64.tar.gz | ||
|
|
||
| Solaris 32-bit Binary: http://nodejs.org/dist/v0.10.24/node-v0.10.24-sunos-x86.tar.gz | ||
|
|
||
| Solaris 64-bit Binary: http://nodejs.org/dist/v0.10.24/node-v0.10.24-sunos-x64.tar.gz | ||
|
|
||
| Other release files: http://nodejs.org/dist/v0.10.24/ | ||
|
|
||
| Website: http://nodejs.org/docs/v0.10.24/ | ||
|
|
||
| Documentation: http://nodejs.org/docs/v0.10.24/api/ | ||
|
|
||
| Shasums: | ||
| ``` | ||
| 4a233e4e51ec24de3b2c3196b9128781665b4edc node-v0.10.24-darwin-x64.tar.gz | ||
| 1b018a372d919462e8ebef29a0de4816a83e38ff node-v0.10.24-darwin-x86.tar.gz | ||
| 423018f6a60b18d0dddf3007c325e0cc8cf55099 node-v0.10.24-linux-x64.tar.gz | ||
| fb99761ce4cef4a43743c1ed630b185545152264 node-v0.10.24-linux-x86.tar.gz | ||
| 9719b2b636d8f5caf5495e967cbe167fd16eb160 node-v0.10.24-sunos-x64.tar.gz | ||
| 84d7645d88dad9050f72c01d5f783cc018a8dc2b node-v0.10.24-sunos-x86.tar.gz | ||
| 4b3cd142e691033308bfab237b6bf79a1a7f5c10 node-v0.10.24-x86.msi | ||
| 74aba302d8b34e1fc93b3e0babc3f5d9bd8c09f3 node-v0.10.24.pkg | ||
| d162d01eb173cb5a0e7e46c9d706421c4c771039 node-v0.10.24.tar.gz | ||
| 782c0b437f1d4205d7ba012e02157fb984d656b0 node.exe | ||
| c3bf16e3e2e268340a96fca869a1e3ce3ead46b5 node.exp | ||
| b81ceddb831981b200f04403718b2adcd24fd5ed node.lib | ||
| 1c009c51c273512eb76ef3a1e36d5d1ccf1e4094 node.pdb | ||
| 8c90873802c40ecadb304002401ba857ad728f9c pkgsrc/nodejs-ia32-0.10.24.tgz | ||
| 94eda460e90dd59886ee2543bb55c8baea6daf1c pkgsrc/nodejs-x64-0.10.24.tgz | ||
| 9b36fd16d8a6eb95c375ced0e1929b88b3dbb3e6 x64/node-v0.10.24-x64.msi | ||
| 43c51bf9ff7c6aa421c4c89a4b14e0ab1cb0527a x64/node.exe | ||
| 74d67c1cad72c0231fdc3498a0ca90c09e49abfb x64/node.exp | ||
| 724463c1a1bd3ad386e1089f53c7fa0ca16c38b6 x64/node.lib | ||
| 58a6bcec861c0a8d20e90db348d3a4fbd49e88cc x64/node.pdb | ||
| ``` |