• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict'
2var test = require('tap').test
3var common = require('../common-tap.js')
4var path = require('path')
5var rimraf = require('rimraf')
6var mkdirp = require('mkdirp')
7var basepath = common.pkg
8var fixturepath = path.resolve(basepath, 'npm-test-platform-all')
9var modulepath = path.resolve(basepath, 'node_modules')
10var Tacks = require('tacks')
11var File = Tacks.File
12var Dir = Tacks.Dir
13
14var fixture = new Tacks(
15  Dir({
16    README: File(
17      'just an npm test\n'
18    ),
19    'package.json': File({
20      name: 'npm-test-platform-all',
21      version: '9.9.9-9',
22      homepage: 'http://www.zombo.com/',
23      os: [
24        'darwin',
25        'linux',
26        'win32',
27        'solaris',
28        'haiku',
29        'sunos',
30        'freebsd',
31        'openbsd',
32        'netbsd'
33      ],
34      cpu: [
35        'arm',
36        'arm64',
37        'mips',
38        'ia32',
39        'ppc64',
40        'ppc64el',
41        's390x',
42        'x64',
43        'sparc'
44      ]
45    })
46  })
47)
48
49test('setup', function (t) {
50  setup()
51  t.done()
52})
53
54test('platform-all', function (t) {
55  common.npm(['install', fixturepath], {cwd: basepath}, installCheckAndTest)
56  function installCheckAndTest (err, code, stdout, stderr) {
57    if (err) throw err
58    t.is(stderr, '', 'no error messages')
59    t.is(code, 0, 'install went ok')
60    t.done()
61  }
62})
63
64test('cleanup', function (t) {
65  cleanup()
66  t.done()
67})
68
69function setup () {
70  cleanup()
71  fixture.create(fixturepath)
72  mkdirp.sync(modulepath)
73}
74function cleanup () {
75  fixture.remove(fixturepath)
76  rimraf.sync(basepath)
77}
78