test('clinic clean', function (t) { // collect data cli({}, [ 'clinic', 'doctor', '--no-open', '--', 'node', '-e', 'setTimeout(() => {}, 500)' ], function (err, stdout, stderr, tempdir) { t.ifError(err) fs.readdir(tempdir, function (err, files) { t.ifError(err) t.same(files, ['.clinic']) fs.writeFileSync(path.join(tempdir, 'some-other-file'), 'sup') cli({ cwd: tempdir }, ['clinic', 'clean'], function (err) { t.ifError(err) fs.readdir(tempdir, function (err, files) { t.ifError(err) t.deepEqual(files, ['some-other-file']) t.end() }) }) }) }) })
t.strictEqual(server.requests[0].url, '/protected/data', 'upload is private') const basename = path.basename(dirname) t.same(Object.keys(server.requests[0].files).sort(), [ `${basename}.html`, `${basename}/${basename}-inlinedfunctions`,
t.strictEqual(server.requests[0].url, '/protected/data', 'upload is private') const basename = path.basename(dirname) t.same(Object.keys(server.requests[0].files).sort(), [ `${basename}.html`, `${basename}/${basename}-inlinedfunctions`,
tap.test(`label: "${labels.join('","')}" when ./benchmark/${file} has been changed`, (t) => { const resolved = nodeLabels.resolveLabels([`benchmark/${file}`]) t.same(resolved, labels) t.end() })
test('test export default method detection', function (t) { const contents = ` export default function() {} `; const methods = ['module.exports']; const found = ast.findAllVulnerableFunctionsInScript( contents, methods, ); t.same(sorted(Object.keys(found)), sorted(methods)); t.equal(found[methods[0]].start.line, 2, 'export default aliased to module.exports'); t.end(); });
tap.test('array > not cumulative', async t => { const result = await Api.get() .array('--lastFlagWins', { cumulative: false }) .parse('--lastFlagWins a b --lastFlagWins c d --lastFlagWins e f') assertNoErrors(t, result) t.same(result.argv.lastFlagWins, ['e', 'f']) })
tap.test('label: "doc" when only ./doc/ files has been changed', (t) => { const labels = nodeLabels.resolveLabels([ 'doc/api/fs.md', 'doc/api/http.md', 'doc/onboarding.md' ]) t.same(labels, ['doc']) t.end() })
tap.test('label: not "c++" when ./src/*.py has been changed', (t) => { const labels = nodeLabels.resolveLabels([ 'src/nolttng_macros.py', 'src/notrace_macros.py', 'src/perfctr_macros.py' ]) t.same(labels, ['lib / src']) t.end() })
tap.test('label: "lib / src" when 4 or more JS sub-systems have been changed', (t) => { const labels = nodeLabels.resolveLabels([ 'lib/assert.js', 'lib/dns.js', 'lib/repl.js', 'lib/process.js', 'lib/module.js' ]) t.same(labels, ['lib / src']) t.end() })
tap.test('label: version labels (new, staging)', (t) => { const labels = nodeLabels.resolveLabels([ 'deps/v8/include/v8-version.h', 'deps/v8/src/crankshaft/hydrogen.cc', 'deps/v8/test/mjsunit/regress/regress-5033.js' ], 'v6.x-staging') t.same(labels, ['V8 Engine', 'v6.x']) t.end() })
tap.test(`label: "${labels.join('","')}" when ./test/${file} has been changed`, (t) => { const resolved = nodeLabels.resolveLabels([`test/${file}`]) t.same(resolved, labels) t.end() })
tap.test('label: add subsystem when ./doc/api/<subsystem>.md has been changed', (t) => { const labels = nodeLabels.resolveLabels([ 'doc/api/fs.md' ], false) t.same(labels, ['doc', 'fs']) t.end() })
tap.test('label: "inspector" when ./src/inspector_* has been changed', (t) => { const labels = nodeLabels.resolveLabels([ 'src/inspector_socket.cc' ]) t.same(labels, ['c++', 'inspector']) t.end() })
tap.test('label: no version labels (master)', (t) => { const labels = nodeLabels.resolveLabels([ 'deps/v8/include/v8-version.h', 'deps/v8/src/crankshaft/hydrogen.cc', 'deps/v8/test/mjsunit/regress/regress-5033.js' ], 'master') t.same(labels, ['V8 Engine']) t.end() })
tap.test('label: "build" when ./android-configure has been changed', (t) => { const labels = nodeLabels.resolveLabels([ 'android-configure' ]) t.same(labels, ['build']) t.end() })