• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict'
2var fs = require('graceful-fs')
3var path = require('path')
4var mkdirpSync = require('mkdirp').sync
5var rimraf = require('rimraf')
6var test = require('tap').test
7var common = require('../common-tap.js')
8
9var base = common.pkg
10var cruft = path.join(base, 'node_modules', 'cruuuft')
11var pkg = {
12  name: 'example',
13  version: '1.0.0',
14  dependencies: {}
15}
16
17function setup () {
18  mkdirpSync(path.dirname(cruft))
19  fs.writeFileSync(cruft, 'this is some cruft for sure')
20  fs.writeFileSync(path.join(base, 'package.json'), JSON.stringify(pkg))
21}
22
23function cleanup () {
24  rimraf.sync(base)
25}
26
27test('setup', function (t) {
28  cleanup()
29  setup()
30  t.done()
31})
32
33test('cruft', function (t) {
34  common.npm(['ls'], {cwd: base}, function (er, code, stdout, stderr) {
35    t.is(stderr, '', 'no warnings or errors from ls')
36    t.done()
37  })
38})
39
40test('cleanup', function (t) {
41  cleanup()
42  t.done()
43})
44