2 var test = require('tap').test
3 var common = require('../common-tap.js')
4 var path = require('path')
5 var rimraf = require('rimraf')
6 var mkdirp = require('mkdirp')
7 var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
8 var fixturepath = path.resolve(basepath, 'npm-test-test-package')
9 var modulepath = path.resolve(basepath, 'node_modules')
10 var installedpath = path.resolve(modulepath, 'npm-test-test-package')
11 var Tacks = require('tacks')
15 var fixture = new Tacks(
20 'package.json': File({
21 name: 'npm-test-test-package',
22 author: 'Testy McMock',
23 version: '1.2.3-99-b',
24 description: "This is a test package used for debugging. It has some random data and that's all."
29 test('setup', function (t) {
34 test('test-package', function (t) {
35 common.npm(['install', fixturepath], {cwd: basepath}, installCheckAndTest)
37 function installCheckAndTest (err, code, stdout, stderr) {
41 t.is(code, 0, 'install went ok')
42 common.npm(['test'], {cwd: installedpath}, testCheckAndRemove)
45 function testCheckAndRemove (err, code, stdout, stderr) {
49 t.is(code, 0, 'npm test w/o test is ok')
50 common.npm(['rm', fixturepath], {cwd: basepath}, removeCheckAndDone)
53 function removeCheckAndDone (err, code, stdout, stderr) {
57 t.is(code, 0, 'remove went ok')
62 test('cleanup', function (t) {
69 fixture.create(fixturepath)
70 mkdirp.sync(modulepath)
74 fixture.remove(fixturepath)