Permalink
Browse files

failing test for pkg.name that can't be required

  • Loading branch information...
1 parent 4f3b8bc commit aa68ef74f835f529ce94b5f1e866d1b46b1c85fe @substack committed Jun 19, 2012
Showing with 41 additions and 2 deletions.
  1. +3 −2 package.json
  2. +29 −0 test/tap/false_name.js
  3. +1 −0 test/tap/false_name/index.js
  4. +8 −0 test/tap/false_name/package.json
View
5 package.json
@@ -102,14 +102,15 @@
"osenv"
],
"devDependencies": {
- "ronn": "https://github.com/isaacs/ronnjs/tarball/master"
+ "ronn": "https://github.com/isaacs/ronnjs/tarball/master",
+ "tap": "~0.2.5"
},
"engines": {
"node": "0.6 || 0.7 || 0.8",
"npm": "1"
},
"scripts": {
- "test": "node ./test/run.js",
+ "test": "node ./test/run.js && tap test/tap/*.js",
"prepublish": "npm prune ; make -j4 doc",
"dumpconf": "env | grep npm | sort | uniq"
},
View
29 test/tap/false_name.js
@@ -0,0 +1,29 @@
+var test = require('tap').test
+ , fs = require('fs')
+ , path = require('path')
+ , existsSync = fs.existsSync || path.existsSync
+ , spawn = require('child_process').spawn
+ , npm = require('../../')
+
+test('not every pkg.name can be required', function (t) {
+ t.plan(1)
+
+ setup(function () {
+ npm.install('.', function (err) {
+ if (err) return t.fail(err)
+ t.ok(existsSync(__dirname +
+ '/false_name/node_modules/tap/node_modules/buffer-equal'))
+ })
+ })
+})
+
+function setup (cb) {
+ process.chdir(__dirname + '/false_name')
+ npm.load(function () {
+ spawn('rm', [ '-rf', __dirname + '/false_name/node_modules' ])
+ .on('exit', function () {
+ fs.mkdirSync(__dirname + '/false_name/node_modules')
+ cb()
+ })
+ })
+}
View
1 test/tap/false_name/index.js
@@ -0,0 +1 @@
+module.exports = true
View
8 test/tap/false_name/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "buffer-equal",
+ "version": "0.0.0",
+ "main": "index.js",
+ "dependencies": {
+ "tap": "0.2.5"
+ }
+}

0 comments on commit aa68ef7

Please sign in to comment.