tap.test('labels: not "build" when Makefile in ./deps has been changed', (t) => { const labels = nodeLabels.resolveLabels([ 'deps/v8/Makefile' ]) t.notOk(labels.includes('build')) t.end() })
test('comparator testing', function (t) { var c = new Comparator('>=1.2.3') t.ok(c.test('1.2.4')) var c2 = new Comparator(c) t.ok(c2.test('1.2.4')) var c3 = new Comparator(c, true) t.ok(c3.test('1.2.4')) // test an invalid version, should not throw var c4 = new Comparator(c) t.notOk(c4.test('not a version string')) t.end() })
tap.test('parseAndExit > unexpected error', async t => { const io = await exec('release') t.ok(io.error) t.same(io.error.code, 1) t.notOk(io.stdout) t.match(io.stderr, /This is an unexpected error/) })
tap.test('parseAndExit > version', async t => { const promises = [] promises.push(exec('version')) promises.push(exec('-v')) promises.push(exec('build --version')) const [io1, io2, io3] = await Promise.all(promises) t.notOk(io1.error) t.notOk(io1.stderr) t.same(io1.stdout.trim(), '2.3.4') t.notOk(io2.error) t.notOk(io2.stderr) t.same(io2.stdout.trim(), '2.3.4') t.notOk(io3.error) t.notOk(io3.stderr) t.same(io3.stdout.trim(), '2.3.4') })
test('yarn-install: no package.json', async (t) => { t.plan(2); const context = makeContext.npmContext( 'omg-i-fail', packageManagers, sandbox ); try { await packageManagerInstall('yarn', context); } catch (err) { t.equals(err && err.message, 'Install Failed'); t.notOk(context.module.flaky, 'Module failed but is not flaky'); } });
test('\'npm install-test\' should not generate package-lock.json.*', function (t) { common.npm(['install-test'], EXEC_OPTS, function (err, code, stderr, stdout) { if (err) throw err t.comment(stdout.trim()) t.comment(stderr.trim()) t.is(code, 0, 'npm install did not raise error code') var files = fs.readdirSync(pkg).filter(function (f) { return f.indexOf('package-lock.json.') === 0 }) t.notOk( files.length > 0, 'package-lock.json.* should not be generated: ' + files ) t.end() }) })
test('tempDirectory.create:', async (t) => { t.plan(3); t.notOk(context.path, 'context should not have a path'); await tempDirectory.create(context); t.ok(context.path, 'context should now have a path'); const stats = await stat(context.path); t.ok(stats.isDirectory(), 'the path should exist and be a folder'); });
test('npm-test: timeout', async (t) => { t.plan(2); const context = makeContext.npmContext( 'omg-i-pass', packageManagers, sandbox, { npmLevel: 'silly', timeout: 100 } ); try { await packageManagerTest('npm', context); } catch (err) { t.notOk(context.module.flaky, 'Time out should not mark module flaky'); t.equals(err && err.message, 'Test Timed Out'); } });
test('\'npm install\' should install local packages', function (t) { common.npm( [ 'install', '.' ], EXEC_OPTS, function (err, code) { t.ifError(err, 'error should not exist') t.notOk(code, 'npm install exited with code 0') t.end() } ) })
test('grab-module-data: does not exist', async (t) => { t.plan(1); const context = { path: __dirname, module: { raw: 'FAIL', type: null, hosted: { type: null } }, emit: function () {}, options: {} }; await grabModuleData(context); t.notOk(context.meta, 'There should not be a context.meta'); });
test('lookup[getLookupTable]: custom table that does not exist', (t) => { t.plan(1); const table = getLookupTable({ lookup: 'test/fixtures/i-am-not-a.json' }); t.notOk(table, 'it should return falsey if the table does not exist'); t.end(); });
test('npm-install: custom install command', async (t) => { t.plan(1); const context = makeContext.npmContext( { name: 'omg-i-pass-with-install-param', install: ['install', '--extra-param'] }, packageManagers, sandbox, { npmLevel: 'silly' } ); await packageManagerInstall('npm', context); t.notOk(context.module.flaky, 'Module passed and is not flaky'); });
test('yarn-install: failed install', async (t) => { t.plan(3); const context = makeContext.npmContext( 'omg-bad-tree', packageManagers, sandbox ); const expected = { testError: /\/THIS-WILL-FAIL: Not found/ }; try { await packageManagerInstall('yarn', context); } catch (err) { t.notOk(context.module.flaky, 'Module failed is not flaky'); t.equals(err && err.message, 'Install Failed'); t.match(context, expected, 'Install error reported'); } });
test('yarn-install: timeout', async (t) => { t.plan(2); const context = makeContext.npmContext( 'omg-i-pass', packageManagers, sandbox, { timeout: 100 } ); try { await packageManagerInstall('yarn', context); } catch (err) { t.notOk(context.module.flaky, 'Time out should not mark module flaky'); t.equals(err && err.message, 'Install Timed Out'); } });
test('npm-install: no package.json', async (t) => { t.plan(2); const context = makeContext.npmContext( 'omg-i-fail', packageManagers, sandbox, { npmLevel: 'silly' } ); try { await packageManagerInstall('npm', context); } catch (err) { t.equals(err && err.message, 'Install Failed'); t.notOk(context.module.flaky, 'Module failed but is not flaky'); } });