]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/legacy-url-dep.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / test / tap / legacy-url-dep.js
1 'use strict'
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-url-dep')
9 var modulepath = path.resolve(basepath, 'node_modules')
10 var Tacks = require('tacks')
11 var File = Tacks.File
12 var Dir = Tacks.Dir
13
14 var fixture = new Tacks(
15   Dir({
16     README: File(
17       'just an npm test\n'
18     ),
19     'package.json': File({
20       name: 'npm-test-url-dep',
21       version: '1.2.3',
22       dependencies: {
23         jsonify: 'https://github.com/substack/jsonify/tarball/master',
24         sax: 'isaacs/sax-js',
25         'canonical-host': 'git://github.com/isaacs/canonical-host'
26       }
27     })
28   })
29 )
30
31 test('setup', function (t) {
32   setup()
33   t.done()
34 })
35
36 test('url-dep', function (t) {
37   common.npm(['install', fixturepath], {cwd: basepath}, installCheckAndTest)
38   function installCheckAndTest (err, code, stdout, stderr) {
39     if (err) throw err
40     console.error(stderr)
41     console.log(stdout)
42     t.is(code, 0, 'install went ok')
43     t.done()
44   }
45 })
46
47 test('cleanup', function (t) {
48   cleanup()
49   t.done()
50 })
51
52 function setup () {
53   cleanup()
54   fixture.create(fixturepath)
55   mkdirp.sync(modulepath)
56 }
57
58 function cleanup () {
59   fixture.remove(fixturepath)
60   rimraf.sync(basepath)
61 }