X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=org.simantics.maps.server%2Fnode%2Fnode-v4.8.0-win-x64%2Fnode_modules%2Fnpm%2Ftest%2Ftap%2Flegacy-array-bin.js;fp=org.simantics.maps.server%2Fnode%2Fnode-v4.8.0-win-x64%2Fnode_modules%2Fnpm%2Ftest%2Ftap%2Flegacy-array-bin.js;h=3e421ee23e3ff0f69a3808525ee69f832271d53e;hb=2529be6d456deeb07c128603ce4971f1dc29b695;hp=0000000000000000000000000000000000000000;hpb=2636fc31c16c23711cf2b06a4ae8537bba9c1d35;p=simantics%2Fdistrict.git diff --git a/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/legacy-array-bin.js b/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/legacy-array-bin.js new file mode 100644 index 00000000..3e421ee2 --- /dev/null +++ b/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/legacy-array-bin.js @@ -0,0 +1,80 @@ +'use strict' +var test = require('tap').test +var common = require('../common-tap.js') +var path = require('path') +var rimraf = require('rimraf') +var mkdirp = require('mkdirp') +var basepath = path.resolve(__dirname, path.basename(__filename, '.js')) +var fixturepath = path.resolve(basepath, 'npm-test-array-bin') +var modulepath = path.resolve(basepath, 'node_modules') +var installedpath = path.resolve(modulepath, 'npm-test-array-bin') +var Tacks = require('tacks') +var File = Tacks.File +var Dir = Tacks.Dir +var fixture = new Tacks( + Dir({ + bin: Dir({ + 'array-bin': File( + '#!/usr/bin/env node\n' + + "console.log('test ran ok')\n" + ) + }), + 'package.json': File({ + name: 'npm-test-array-bin', + version: '1.2.5', + bin: [ + 'bin/array-bin' + ], + scripts: { + test: 'node test.js' + } + }), + 'test.js': File( + "require('child_process').exec('array-bin', { env: process.env },\n" + + ' function (err, stdout, stderr) {\n' + + " if (err && err.code) throw new Error('exited badly with code = ' + err.code)\n" + + ' console.log(stdout)\n' + + ' console.error(stderr)\n' + + ' }\n' + + ')\n' + ) + }) +) +test('setup', function (t) { + setup() + t.done() +}) +test('array-bin', function (t) { + common.npm(['install', fixturepath], {cwd: basepath}, installCheckAndTest) + function installCheckAndTest (err, code, stdout, stderr) { + if (err) throw err + t.is(code, 0, 'install went ok') + t.equal(stderr, '', 'no error output') + common.npm(['test'], {cwd: installedpath}, testCheckAndRemove) + } + function testCheckAndRemove (err, code, stdout, stderr) { + t.ifError(err, 'npm test on array bin') + t.equal(code, 0, 'exited OK') + t.equal(stderr.trim(), '', 'no error output') + t.match(stdout, /test ran ok/, 'child script ran properly') + common.npm(['rm', fixturepath], {cwd: basepath}, removeCheckAndDone) + } + function removeCheckAndDone (err, code, stdout, stderr) { + if (err) throw err + t.is(code, 0, 'remove went ok') + t.done() + } +}) +test('cleanup', function (t) { + cleanup() + t.done() +}) +function setup () { + cleanup() + fixture.create(fixturepath) + mkdirp.sync(modulepath) +} +function cleanup () { + fixture.remove(fixturepath) + rimraf.sync(basepath) +}