From cbce5905b01ddde3b8c0e063d6304597d137f8ef Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Fri, 7 May 2021 11:43:19 -0400 Subject: [PATCH 1/3] deps: update dev dependencies --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c4c031a21..ebe134bf4 100644 --- a/package.json +++ b/package.json @@ -64,12 +64,12 @@ "eslint": "^7.21.0", "eslint-config-prettier": "^8.1.0", "eslint-plugin-prettier": "^3.3.1", - "fs-extra": "^9.1.0", + "fs-extra": "^10.0.0", "prettier": "^2.2.1", "proxyquire": "^2.1.3", "rewire": "^5.0.0", "string-to-stream": "^3.0.1", - "tap": "^14.11.0", + "tap": "^15.0.9", "tap-parser": "^10.1.0", "xml2js": "^0.4.23" }, From 95765a250d45d9af99782af5e263c1b8590e9c7b Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Fri, 7 May 2021 11:50:54 -0400 Subject: [PATCH 2/3] tools: add tap configuration to package.json --- package.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index ebe134bf4..44e42c6cc 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "scripts": { "coverage-html": "npm run tap -- --coverage-report=html", "lint": "eslint bin/* lib/ test/ --cache", - "tap": "tap -J --timeout 480 \"test/**/test-*.js\"", + "tap": "tap -J \"test/**/test-*.js\"", "test": "npm run lint && npm run tap", "test-ci": "npm run lint && npm run tap -- --coverage-report=lcov" }, @@ -85,5 +85,9 @@ } } ] + }, + "tap": { + "timeout": 480, + "check-coverage": false } } From e27965bd91175748adc104aa870fa001df8d2506 Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Fri, 7 May 2021 11:51:11 -0400 Subject: [PATCH 3/3] test: replace deprecated tap APIs --- test/bin/test-citgm-all.js | 36 +++++++++---------- test/npm/test-npm-author-name.js | 10 +++--- test/npm/test-npm-install.js | 6 ++-- test/npm/test-npm-test.js | 12 +++---- test/reporter/test-reporter-junit.js | 10 +++--- test/reporter/test-reporter-logger.js | 6 ++-- test/reporter/test-reporter-markdown.js | 6 ++-- test/reporter/test-reporter-tap.js | 12 +++---- test/reporter/test-reporter-util.js | 36 +++++++++---------- test/reporter/test-reporter.js | 8 ++--- test/test-check-tags.js | 48 ++++++++++++------------- test/test-citgm-timeout.js | 2 +- test/test-citgm.js | 6 ++-- test/test-create-options.js | 14 ++++---- test/test-grab-module-data.js | 8 ++--- test/test-grab-project.js | 2 +- test/test-lookup.js | 20 +++++------ test/test-match-conditions.js | 28 +++++++-------- test/test-out.js | 10 +++--- test/test-spawn.js | 10 ++---- test/test-timeout.js | 24 ++++++------- test/test-unpack.js | 4 +-- test/yarn/test-yarn-install.js | 6 ++-- test/yarn/test-yarn-test.js | 12 +++---- 24 files changed, 164 insertions(+), 172 deletions(-) diff --git a/test/bin/test-citgm-all.js b/test/bin/test-citgm-all.js index 0ea275df6..148a3e872 100644 --- a/test/bin/test-citgm-all.js +++ b/test/bin/test-citgm-all.js @@ -22,7 +22,7 @@ test('citgm-all: /w markdown /w -j', (t) => { t.fail('we should not get an error testing omg-i-pass'); }); proc.on('close', (code) => { - t.equals(code, 0, 'citgm-all should run all the tests in the lookup'); + t.equal(code, 0, 'citgm-all should run all the tests in the lookup'); }); }); @@ -36,11 +36,7 @@ test('citgm-all: /w missing lookup.json', (t) => { t.error(err); }); proc.on('close', (code) => { - t.equals( - code, - 1, - 'citgm-all should fail if the lookup.json does not exist' - ); + t.equal(code, 1, 'citgm-all should fail if the lookup.json does not exist'); }); }); @@ -54,7 +50,7 @@ test('citgm-all: /w bad lookup.json', (t) => { t.error(err); }); proc.on('close', (code) => { - t.equals( + t.equal( code, 1, 'citgm-all should fail if the lookup.json contains errors' @@ -74,7 +70,7 @@ test('citgm-all: fail /w tap /w junit', (t) => { t.error(err); }); proc.on('close', (code) => { - t.equals(code, 1, 'citgm-all should have failed'); + t.equal(code, 1, 'citgm-all should have failed'); }); }); @@ -88,7 +84,7 @@ test('citgm-all: flaky-fail', (t) => { t.error(err); }); proc.on('close', (code) => { - t.equals(code, 0, 'citgm-all should exit with signal 0'); + t.equal(code, 0, 'citgm-all should exit with signal 0'); }); }); @@ -102,7 +98,7 @@ test('citgm-all: fail expectFail', (t) => { t.error(err); }); proc.on('close', (code) => { - t.equals(code, 0, 'citgm-all should exit with signal 0'); + t.equal(code, 0, 'citgm-all should exit with signal 0'); }); }); @@ -116,7 +112,7 @@ test('citgm-all: pass expectFail', (t) => { t.error(err); }); proc.on('close', (code) => { - t.equals(code, 1, 'citgm-all should exit with signal 1'); + t.equal(code, 1, 'citgm-all should exit with signal 1'); }); }); @@ -130,7 +126,7 @@ test('citgm-all: test with replace', (t) => { t.error(err); }); proc.on('close', (code) => { - t.equals(code, 0, 'citgm-all should exit with signal 0'); + t.equal(code, 0, 'citgm-all should exit with signal 0'); }); }); @@ -145,7 +141,7 @@ test('citgm-all: flaky-fail ignoring flakyness', (t) => { t.error(err); }); proc.on('close', (code) => { - t.equals(code, 1, 'citgm-all should exit with signal 1'); + t.equal(code, 1, 'citgm-all should exit with signal 1'); }); }); @@ -161,7 +157,7 @@ test('citgm-all: includeTags', (t) => { t.error(err); }); proc.on('close', (code) => { - t.equals(code, 0, 'citgm-all should only run omg-i-pass'); + t.equal(code, 0, 'citgm-all should only run omg-i-pass'); }); }); @@ -177,7 +173,7 @@ test('citgm-all: excludeTags', (t) => { t.error(err); }); proc.on('close', (code) => { - t.equals(code, 0, 'citgm-all should not run omg-i-fail'); + t.equal(code, 0, 'citgm-all should not run omg-i-fail'); }); }); @@ -193,7 +189,7 @@ test('citgm-all: includeTags multiple', (t) => { t.error(err); }); proc.on('close', (code) => { - t.equals(code, 0, 'citgm-all should only run omg-i-pass'); + t.equal(code, 0, 'citgm-all should only run omg-i-pass'); }); }); @@ -209,7 +205,7 @@ test('citgm-all: excludeTags modulename', (t) => { t.error(err); }); proc.on('close', (code) => { - t.equals(code, 0, 'citgm-all should not run omg-i-fail'); + t.equal(code, 0, 'citgm-all should not run omg-i-fail'); }); }); @@ -225,7 +221,7 @@ test('citgm-all: includeTags modulename multiple', (t) => { t.error(err); }); proc.on('close', (code) => { - t.equals(code, 0, 'citgm-all should only run omg-i-pass'); + t.equal(code, 0, 'citgm-all should only run omg-i-pass'); }); }); @@ -245,7 +241,7 @@ test('citgm-all: skip /w rootcheck /w tap to fs /w junit to fs /w append', (t) = t.error(err); }); proc.on('close', (code) => { - t.equals(code, 0, 'it should run omg-i-pass and skip omg-i-fail'); + t.equal(code, 0, 'it should run omg-i-pass and skip omg-i-fail'); }); }); @@ -260,7 +256,7 @@ test('citgm-all: install with yarn', (t) => { t.error(err); }); proc.on('close', (code) => { - t.equals(code, 0, 'citgm-all should only run omg-i-pass'); + t.equal(code, 0, 'citgm-all should only run omg-i-pass'); }); }); diff --git a/test/npm/test-npm-author-name.js b/test/npm/test-npm-author-name.js index 9e4bcf5cf..dceb1c6bc 100644 --- a/test/npm/test-npm-author-name.js +++ b/test/npm/test-npm-author-name.js @@ -16,8 +16,8 @@ test('npm.test() authorName:', (t) => { url: 'omg.html' }; const authorExpected = 'Randy Savage (omg.html)'; - t.equals(authorName(name), name, 'it should return any string'); - t.equals( + t.equal(authorName(name), name, 'it should return any string'); + t.equal( authorName(author), authorExpected, 'it should return the expected' + ' string when given an object' @@ -36,13 +36,13 @@ test('npm.test() authorName partial data:', (t) => { email: 'thedude@abides.net' }; const authorTwoExpected = ''; - t.equals(authorName(name), name, 'it should return any string'); - t.equals( + t.equal(authorName(name), name, 'it should return any string'); + t.equal( authorName(authorOne), authorOneExpected, 'it should return the' + ' expected string when given an object' ); - t.equals( + t.equal( authorName(authorTwo), authorTwoExpected, 'it should return the' + ' expected string when given an object' diff --git a/test/npm/test-npm-install.js b/test/npm/test-npm-install.js index 9a743969c..90ff24d0d 100644 --- a/test/npm/test-npm-install.js +++ b/test/npm/test-npm-install.js @@ -76,7 +76,7 @@ test('npm-install: no package.json', async (t) => { try { await packageManagerInstall('npm', context); } catch (err) { - t.equals(err && err.message, 'Install Failed'); + t.equal(err && err.message, 'Install Failed'); t.notOk(context.module.flaky, 'Module failed but is not flaky'); } }); @@ -96,7 +96,7 @@ test('npm-install: timeout', async (t) => { await packageManagerInstall('npm', context); } catch (err) { t.notOk(context.module.flaky, 'Time out should not mark module flaky'); - t.equals(err && err.message, 'Install Timed Out'); + t.equal(err && err.message, 'Install Timed Out'); } }); @@ -118,7 +118,7 @@ test('npm-install: failed install', async (t) => { await packageManagerInstall('npm', context); } catch (err) { t.notOk(context.module.flaky, 'Module failed is not flaky'); - t.equals(err && err.message, 'Install Failed'); + t.equal(err && err.message, 'Install Failed'); t.match(context, expected, 'Install error reported'); } }); diff --git a/test/npm/test-npm-test.js b/test/npm/test-npm-test.js index e44d4389e..ffe802f50 100644 --- a/test/npm/test-npm-test.js +++ b/test/npm/test-npm-test.js @@ -71,7 +71,7 @@ test('npm-test: basic module failing', async (t) => { try { await packageManagerTest('npm', context); } catch (err) { - t.equals(err && err.message, 'The canary is dead:'); + t.equal(err && err.message, 'The canary is dead:'); } }); @@ -85,7 +85,7 @@ test('npm-test: basic module no test script', async (t) => { try { await packageManagerTest('npm', context); } catch (err) { - t.equals(err && err.message, 'Module does not support npm-test!'); + t.equal(err && err.message, 'Module does not support npm-test!'); } }); @@ -99,7 +99,7 @@ test('npm-test: no package.json', async (t) => { try { await packageManagerTest('npm', context); } catch (err) { - t.equals(err && err.message, 'Package.json Could not be found'); + t.equal(err && err.message, 'Package.json Could not be found'); } }); @@ -118,7 +118,7 @@ test('npm-test: alternative test-path', async (t) => { try { await packageManagerTest('npm', context); } catch (err) { - t.equals(err && err.message, 'The canary is dead:'); + t.equal(err && err.message, 'The canary is dead:'); } }); @@ -137,7 +137,7 @@ test('npm-test: timeout', async (t) => { 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'); + t.equal(err && err.message, 'Test Timed Out'); } }); @@ -171,7 +171,7 @@ test('npm-test: module with no test script failing', async (t) => { try { await packageManagerTest('npm', context); } catch (err) { - t.equals(err && err.message, 'Module does not support npm-test!'); + t.equal(err && err.message, 'Module does not support npm-test!'); } }); diff --git a/test/reporter/test-reporter-junit.js b/test/reporter/test-reporter-junit.js index f6c74f688..2245f40aa 100644 --- a/test/reporter/test-reporter-junit.js +++ b/test/reporter/test-reporter-junit.js @@ -64,7 +64,7 @@ test('reporter.junit(): passing', (t) => { } junit(logger, passingInput); - t.equals( + t.equal( output, passingExpected, 'we should get expected output when all' + ' modules pass' @@ -105,7 +105,7 @@ test('reporter.junit(): failing', (t) => { } junit(logger, failingInput); - t.equals(output, failingExpected), + t.equal(output, failingExpected), 'we should get the expected output when a' + ' module fails'; t.end(); }); @@ -120,7 +120,7 @@ test('reporter.junit(): parser', async (t) => { junit(logger, failingInput); const result = await parseString(output); - t.deepEquals( + t.same( result, junitParserExpected, 'we should get the expected output when a module fails' @@ -131,7 +131,7 @@ test('reporter.junit(): write to disk', (t) => { t.plan(1); junit(outputFile, passingInput); const expected = fs.readFileSync(outputFile, 'utf8'); - t.equals(expected, passingExpected), + t.equal(expected, passingExpected), 'the file on disk should match the' + ' expected output'; t.end(); }); @@ -142,7 +142,7 @@ test('reporter.junit(): append to disk', (t) => { fs.writeFileSync(outputFileAppend, appendStartFile); junit(outputFileAppend, passingInput, true); const expected = fs.readFileSync(outputFileAppend, 'utf-8'); - t.equals(expected, passingExpectedAppend), + t.equal(expected, passingExpectedAppend), 'the file on disk should match the' + ' expected output'; t.end(); }); diff --git a/test/reporter/test-reporter-logger.js b/test/reporter/test-reporter-logger.js index 4d7c777dd..38f8e7adc 100644 --- a/test/reporter/test-reporter-logger.js +++ b/test/reporter/test-reporter-logger.js @@ -36,7 +36,7 @@ test('single passing module:', (t) => { expected += 'The smoke test has passed.'; output = ''; loggerReporter(logger, fixtures.iPass); - t.equals(output, expected, 'we should have the expected logged output'); + t.equal(output, expected, 'we should have the expected logged output'); t.end(); }); @@ -51,7 +51,7 @@ test('single failing module:', (t) => { expected += 'The smoke test has failed.'; output = ''; loggerReporter(logger, fixtures.iFail); - t.equals(output, expected, 'we should have the expected logged output'); + t.equal(output, expected, 'we should have the expected logged output'); t.end(); }); @@ -75,6 +75,6 @@ test('multiple modules passing, with a flaky module that fails:', (t) => { fixtures.iFlakyPass, fixtures.iFlakyFail ]); - t.equals(output, expected, 'we should have the expected logged output'); + t.equal(output, expected, 'we should have the expected logged output'); t.end(); }); diff --git a/test/reporter/test-reporter-markdown.js b/test/reporter/test-reporter-markdown.js index b8313cc6f..0304a58f8 100644 --- a/test/reporter/test-reporter-markdown.js +++ b/test/reporter/test-reporter-markdown.js @@ -14,7 +14,7 @@ test('single passing module:', (t) => { let expected = '## 🎉🎉 CITGM Passed 🎉🎉'; expected += '### Passing Modules'; expected += ' * iPass v4.2.2 duration:50ms'; - t.equals(output, expected, 'we should have the expected markdown output'); + t.equal(output, expected, 'we should have the expected markdown output'); t.end(); }); @@ -29,7 +29,7 @@ test('single failing module:', (t) => { expected += ' * iFail v3.0.1 duration:50ms'; expected += ' - I dun wurk'; expected += ' - Thanks for testing!'; - t.equals(output, expected, 'we should have the expected markdown output'); + t.equal(output, expected, 'we should have the expected markdown output'); t.end(); }); @@ -51,6 +51,6 @@ test('multiple modules passing, with a flaky module that fails:', (t) => { expected += ' * iFlakyFail v3.3.3 duration:50ms'; expected += ' - I dun wurk'; expected += ' - Thanks for testing!'; - t.equals(output, expected, 'we should have the expected markdown output'); + t.equal(output, expected, 'we should have the expected markdown output'); t.end(); }); diff --git a/test/reporter/test-reporter-tap.js b/test/reporter/test-reporter-tap.js index c6ca208ef..37250394f 100644 --- a/test/reporter/test-reporter-tap.js +++ b/test/reporter/test-reporter-tap.js @@ -56,7 +56,7 @@ test('reporter.tap(): passing', (t) => { } tap(logger, passingInput); - t.equals( + t.equal( output, passingExpected, 'we should get expected output when all' + ' modules pass' @@ -73,7 +73,7 @@ test('reporter.tap(): failing', (t) => { } tap(logger, failingInput); - t.equals(output, failingExpected), + t.equal(output, failingExpected), 'we should get the expected output when a' + ' module fails'; t.end(); }); @@ -87,7 +87,7 @@ test('reporter.tap(): parser', (t) => { tap(logger, failingInput); const p = new Parser((results) => { - t.deepEquals(results, tapParserExpected), + t.same(results, tapParserExpected), 'the tap parser should correctly' + ' parse the tap file'; t.end(); }); @@ -98,7 +98,7 @@ test('reporter.tap(): write to disk', (t) => { t.plan(1); tap(outputFile, passingInput); const expected = fs.readFileSync(outputFile, 'utf8'); - t.equals(expected, passingExpected), + t.equal(expected, passingExpected), 'the file on disk should match the' + ' expected output'; t.end(); }); @@ -109,7 +109,7 @@ test('reporter.tap(): append to disk', (t) => { fs.writeFileSync(outputFileAppend, appendStartFile); tap(outputFileAppend, passingInput, true); const expected = fs.readFileSync(outputFileAppend, 'utf8'); - t.equals(expected, passingExpectedAppend), + t.equal(expected, passingExpectedAppend), 'the file on disk should match the' + ' expected output'; t.end(); }); @@ -118,7 +118,7 @@ test('reporter.tap(): append to disk when file does not exist', (t) => { t.plan(1); tap(outputFileAppendBlank, passingInput, true); const expected = fs.readFileSync(outputFileAppendBlank, 'utf8'); - t.equals(expected, passingExpected), + t.equal(expected, passingExpected), 'the file on disk should match the' + ' expected output'; t.end(); }); diff --git a/test/reporter/test-reporter-util.js b/test/reporter/test-reporter-util.js index 6aa005d0e..c2fb8b66a 100644 --- a/test/reporter/test-reporter-util.js +++ b/test/reporter/test-reporter-util.js @@ -48,22 +48,22 @@ const flakeCityUsa = [ test('getPassing:', (t) => { t.plan(4); - t.equals( + t.equal( util.getPassing(noPassing).length, 0, 'there should be no passing modules in the noPassing list' ); - t.equals( + t.equal( util.getPassing(somePassing).length, 2, 'there should be two passing modules in the somePassing list' ); - t.equals( + t.equal( util.getPassing(allPassing).length, 3, 'there should be three passing modules in the allPassing list' ); - t.equals( + t.equal( util.getPassing(flakeCityUsa).length, 3, 'there should be two passing modules in the flakeCityUsa list' @@ -73,17 +73,17 @@ test('getPassing:', (t) => { test('getSkipped:', (t) => { t.plan(3); - t.equals( + t.equal( util.getSkipped(noPassing).length, 1, 'there should be one skipped module in the noPassing list' ); - t.equals( + t.equal( util.getSkipped(somePassing).length, 1, 'there should be one skipped module in the somePassing list' ); - t.equals( + t.equal( util.getSkipped(allPassing).length, 1, 'there should be one skipped module in the allPassing list' @@ -93,22 +93,22 @@ test('getSkipped:', (t) => { test('getFlakyFails:', (t) => { t.plan(4); - t.equals( + t.equal( util.getFlakyFails(noPassing).length, 4, 'there should be two flaky failing modules in the noPassing list' ); - t.equals( + t.equal( util.getFlakyFails(somePassing).length, 1, 'there should be one flaky failing modules in the somePassing list' ); - t.equals( + t.equal( util.getFlakyFails(allPassing).length, 0, 'there should be no flaky failing modules in the allPassing list' ); - t.equals( + t.equal( util.getFlakyFails(flakeCityUsa).length, 2, 'there should be two flaky failing modules in the flakeCityUsa list' @@ -118,22 +118,22 @@ test('getFlakyFails:', (t) => { test('getFails:', (t) => { t.plan(4); - t.equals( + t.equal( util.getFails(noPassing).length, 3, 'there should be three failing modules in the noPassing list' ); - t.equals( + t.equal( util.getFails(somePassing).length, 1, 'there should be one failing modules in the somePassing list' ); - t.equals( + t.equal( util.getFails(allPassing).length, 0, 'there should be no failing modules in the allPassing list' ); - t.equals( + t.equal( util.getFails(flakeCityUsa).length, 0, 'there should be no failing modules in the flakeCityUsa list' @@ -151,11 +151,11 @@ test('hasFailures:', (t) => { util.hasFailures(somePassing), 'there should be failures in the somePassing list' ); - t.notok( + t.notOk( util.hasFailures(allPassing), 'there should be no failures in the allPassing list' ); - t.notok( + t.notOk( util.hasFailures(flakeCityUsa), 'there should be no failures in the flakeCityUsa list' ); @@ -168,7 +168,7 @@ test('util.sanitizeOutput', (t) => { const expected = fs.readFileSync(carriageReturnExpectedPath, 'utf-8'); let result = util.sanitizeOutput(raw, '#'); result += '\n'; - t.equals( + t.equal( result, expected, 'there should be a # on every line & escape char' + 'should be removed' diff --git a/test/reporter/test-reporter.js b/test/reporter/test-reporter.js index ae7161756..c924043a2 100644 --- a/test/reporter/test-reporter.js +++ b/test/reporter/test-reporter.js @@ -8,27 +8,27 @@ const reporter = require('../../lib/reporter'); test('reporter.markdown():', (t) => { t.plan(2); t.ok(reporter.markdown, 'it should have a markdown reporter'); - t.equals(typeof reporter.markdown, 'function', 'markdown is a function'); + t.equal(typeof reporter.markdown, 'function', 'markdown is a function'); t.end(); }); test('reporter.logger():', (t) => { t.plan(2); t.ok(reporter.logger, 'it should have a logger reporter'); - t.equals(typeof reporter.logger, 'function', 'logger is a function'); + t.equal(typeof reporter.logger, 'function', 'logger is a function'); t.end(); }); test('reporter.tap():', (t) => { t.plan(2); t.ok(reporter.logger, 'it should have a tap reporter'); - t.equals(typeof reporter.logger, 'function', 'tap is a function'); + t.equal(typeof reporter.logger, 'function', 'tap is a function'); t.end(); }); test('reporter.junit():', (t) => { t.plan(2); t.ok(reporter.junit, 'it should have a junit reporter'); - t.equals(typeof reporter.junit, 'function', 'junit is a function'); + t.equal(typeof reporter.junit, 'function', 'junit is a function'); t.end(); }); diff --git a/test/test-check-tags.js b/test/test-check-tags.js index e6c055bad..6ddd81d9c 100644 --- a/test/test-check-tags.js +++ b/test/test-check-tags.js @@ -15,7 +15,7 @@ test('test includeTags and matching tag multiple', (t) => { tags: ['a', 'b'] }; const result = checkTags(options, mod, 'test', log); - t.false(result, 'should return false'); + t.notOk(result, 'should return false'); }); test('test includeTags and matching tag', (t) => { @@ -28,7 +28,7 @@ test('test includeTags and matching tag', (t) => { tags: 'a' }; const result = checkTags(options, mod, 'test', log); - t.false(result, 'should return false'); + t.notOk(result, 'should return false'); }); test('test includeTags and no matching tag', (t) => { @@ -41,7 +41,7 @@ test('test includeTags and no matching tag', (t) => { tags: 'b' }; const result = checkTags(options, mod, 'test', log); - t.true(result, 'should return true'); + t.ok(result, 'should return true'); }); test('test includeTags and no tag', (t) => { @@ -54,7 +54,7 @@ test('test includeTags and no tag', (t) => { tags: [] }; const result = checkTags(options, mod, 'test', log); - t.true(result, 'should return true'); + t.ok(result, 'should return true'); }); test('test excludeTags and matching tag multiple', (t) => { @@ -67,7 +67,7 @@ test('test excludeTags and matching tag multiple', (t) => { tags: ['a', 'b'] }; const result = checkTags(options, mod, 'test', log); - t.true(result, 'should return true'); + t.ok(result, 'should return true'); }); test('test excludeTags and matching tag', (t) => { @@ -80,7 +80,7 @@ test('test excludeTags and matching tag', (t) => { tags: 'a' }; const result = checkTags(options, mod, 'test', log); - t.true(result, 'should return true'); + t.ok(result, 'should return true'); }); test('test excludeTags and no matching tag', (t) => { @@ -93,7 +93,7 @@ test('test excludeTags and no matching tag', (t) => { tags: 'b' }; const result = checkTags(options, mod, 'test', log); - t.false(result, 'should return false'); + t.notOk(result, 'should return false'); }); test('test excludeTags and no tag', (t) => { @@ -106,7 +106,7 @@ test('test excludeTags and no tag', (t) => { tags: [] }; const result = checkTags(options, mod, 'test', log); - t.false(result, 'should return false'); + t.notOk(result, 'should return false'); }); test('test includeTags and matching tag multiple', (t) => { @@ -119,7 +119,7 @@ test('test includeTags and matching tag multiple', (t) => { tags: ['a', 'b'] }; const result = checkTags(options, mod, 'test', log); - t.false(result, 'should return false'); + t.notOk(result, 'should return false'); }); test('test includeTags and no matching tag', (t) => { @@ -132,7 +132,7 @@ test('test includeTags and no matching tag', (t) => { tags: 'a' }; const result = checkTags(options, mod, 'test', log); - t.true(result, 'should return true'); + t.ok(result, 'should return true'); }); test('test includeTags and matching tag', (t) => { @@ -145,7 +145,7 @@ test('test includeTags and matching tag', (t) => { tags: 'b' }; const result = checkTags(options, mod, 'test', log); - t.false(result, 'should return false'); + t.notOk(result, 'should return false'); }); test('test includeTags and no tag', (t) => { @@ -158,7 +158,7 @@ test('test includeTags and no tag', (t) => { tags: [] }; const result = checkTags(options, mod, 'test', log); - t.true(result, 'should return true'); + t.ok(result, 'should return true'); }); test('test excludeTags and matching tag multiple', (t) => { @@ -171,7 +171,7 @@ test('test excludeTags and matching tag multiple', (t) => { tags: ['a', 'b'] }; const result = checkTags(options, mod, 'test', log); - t.true(result, 'should return true'); + t.ok(result, 'should return true'); }); test('test excludeTags and no matching tag', (t) => { @@ -184,7 +184,7 @@ test('test excludeTags and no matching tag', (t) => { tags: 'a' }; const result = checkTags(options, mod, 'test', log); - t.false(result, 'should return false'); + t.notOk(result, 'should return false'); }); test('test excludeTags and matching tag', (t) => { @@ -197,7 +197,7 @@ test('test excludeTags and matching tag', (t) => { tags: 'b' }; const result = checkTags(options, mod, 'test', log); - t.true(result, 'should return true'); + t.ok(result, 'should return true'); }); test('test excludeTags and no tag', (t) => { @@ -210,7 +210,7 @@ test('test excludeTags and no tag', (t) => { tags: [] }; const result = checkTags(options, mod, 'test', log); - t.false(result, 'should return false'); + t.notOk(result, 'should return false'); }); test('test excludeTags, includeTags and matching tag', (t) => { @@ -223,7 +223,7 @@ test('test excludeTags, includeTags and matching tag', (t) => { tags: ['a', 'b'] }; const result = checkTags(options, mod, 'test', log); - t.true(result, 'should return true'); + t.ok(result, 'should return true'); }); test('test excludeTags,includeTags and matching includeTags tag', (t) => { @@ -236,7 +236,7 @@ test('test excludeTags,includeTags and matching includeTags tag', (t) => { tags: 'a' }; const result = checkTags(options, mod, 'test', log); - t.false(result, 'should return false'); + t.notOk(result, 'should return false'); }); test('test excludeTags,includeTags and matching excludeTags tag', (t) => { @@ -249,7 +249,7 @@ test('test excludeTags,includeTags and matching excludeTags tag', (t) => { tags: 'b' }; const result = checkTags(options, mod, 'test', log); - t.true(result, 'should return true'); + t.ok(result, 'should return true'); }); test('test excludeTags, includeTags and no matching tags', (t) => { @@ -260,7 +260,7 @@ test('test excludeTags, includeTags and no matching tags', (t) => { }; const mod = {}; const result = checkTags(options, mod, 'test', log); - t.true(result, 'should return true'); + t.ok(result, 'should return true'); }); test('test excludeTags, includeTags and matching tag', (t) => { @@ -273,7 +273,7 @@ test('test excludeTags, includeTags and matching tag', (t) => { tags: ['a', 'b'] }; const result = checkTags(options, mod, 'test', log); - t.true(result, 'should return true'); + t.ok(result, 'should return true'); }); test('test excludeTags,includeTags and matching excludeTags tag', (t) => { @@ -286,7 +286,7 @@ test('test excludeTags,includeTags and matching excludeTags tag', (t) => { tags: 'a' }; const result = checkTags(options, mod, 'test', log); - t.true(result, 'should return true'); + t.ok(result, 'should return true'); }); test('test excludeTags,includeTags and matching includeTags tag', (t) => { @@ -299,7 +299,7 @@ test('test excludeTags,includeTags and matching includeTags tag', (t) => { tags: 'b' }; const result = checkTags(options, mod, 'test', log); - t.false(result, 'should return false'); + t.notOk(result, 'should return false'); }); test('test excludeTags, includeTags and no matching tags', (t) => { @@ -312,7 +312,7 @@ test('test excludeTags, includeTags and no matching tags', (t) => { tags: [] }; const result = checkTags(options, mod, 'test', log); - t.true(result, 'should return true'); + t.ok(result, 'should return true'); }); test('test module name can be used in includeTags/excludeTags', (t) => { diff --git a/test/test-citgm-timeout.js b/test/test-citgm-timeout.js index ba74515d7..dbf4a6501 100644 --- a/test/test-citgm-timeout.js +++ b/test/test-citgm-timeout.js @@ -37,7 +37,7 @@ test('citgm: omg-i-timeout from local path', (t) => { const tester = new citgm.Tester(mod, options); tester .on('start', (name) => { - t.equals(name, mod, 'it should be the local path'); + t.equal(name, mod, 'it should be the local path'); }) .on('data', (type, key, msg) => { if (type === 'error' && key.endsWith('cleanup')) { diff --git a/test/test-citgm.js b/test/test-citgm.js index 53f42c0e1..82850fe0a 100644 --- a/test/test-citgm.js +++ b/test/test-citgm.js @@ -17,7 +17,7 @@ test('citgm: omg-i-pass', (t) => { new citgm.Tester(mod, options) .on('start', (name) => { - t.equals(name, mod, 'it should be omg-i-pass'); + t.equal(name, mod, 'it should be omg-i-pass'); }) .on('fail', (err) => { t.error(err); @@ -44,8 +44,8 @@ test('citgm: omg-i-pass from git url', (t) => { const tester = new citgm.Tester(mod, options); tester .on('start', (name) => { - t.equals(name, mod, 'it should be the raw URL'); - t.equals( + t.equal(name, mod, 'it should be the raw URL'); + t.equal( tester.module.name, `noname-44e9e903ceed542df23ff575629965f65eeaa51a` ); diff --git a/test/test-create-options.js b/test/test-create-options.js index c59212a64..dac9b807f 100644 --- a/test/test-create-options.js +++ b/test/test-create-options.js @@ -38,10 +38,10 @@ test('create-options:', (t) => { // Set dynamically to support Windows. env['npm_config_nodedir'] = path.resolve(process.cwd(), nodePath); - t.equals(typeof options, 'object', 'We should get back an object'); + t.equal(typeof options, 'object', 'We should get back an object'); t.notOk(options.uid, 'There should not be a uid in the options'); t.notOk(options.gid, 'There should not be a gid in the options'); - t.deepequal( + t.same( options.env, env, 'The created env should be a clone of' + @@ -63,13 +63,13 @@ test('create-options: with uid / gid', (t) => { const options = createOptions(cwd, context); - t.equals(typeof options, 'object', 'We should get back an object'); + t.equal(typeof options, 'object', 'We should get back an object'); if (process.platform === 'win32') { - t.equals(options.uid, undefined, 'The uid should not be set on Windows'); - t.equals(options.gid, undefined, 'The gid should not be set on Windows'); + t.equal(options.uid, undefined, 'The uid should not be set on Windows'); + t.equal(options.gid, undefined, 'The gid should not be set on Windows'); } else { - t.equals(options.uid, 1337, 'The uid should be set to the expected value'); - t.equals(options.gid, 1337, 'The gid should be set to the expected value'); + t.equal(options.uid, 1337, 'The uid should be set to the expected value'); + t.equal(options.gid, 1337, 'The gid should be set to the expected value'); } t.end(); }); diff --git a/test/test-grab-module-data.js b/test/test-grab-module-data.js index 418bee5b2..833955b85 100644 --- a/test/test-grab-module-data.js +++ b/test/test-grab-module-data.js @@ -23,7 +23,7 @@ test('grab-module-data: lodash', async (t) => { await grabModuleData(context); t.ok(context.meta, 'There should be a context.meta'); - t.equals( + t.equal( context.meta.name, 'lodash', 'The name of the results should be lodash' @@ -76,7 +76,7 @@ test('grab-module-data: hosted', async (t) => { }; await grabModuleData(context); - t.deepequals( + t.same( context.meta, expected, 'The returned meta object should' + @@ -121,12 +121,12 @@ test('grab-module-data: semver range', async (t) => { await grabModuleData(context); t.ok(context.meta, 'There should be a context.meta'); - t.equals( + t.equal( context.meta.name, 'omg-i-pass', 'The name of the results should be omg-i-pass' ); - t.equals( + t.equal( context.meta.version, '2.0.1', 'The version should be the latest satisfying the semver range' diff --git a/test/test-grab-project.js b/test/test-grab-project.js index b55f4129c..c64aa5ada 100644 --- a/test/test-grab-project.js +++ b/test/test-grab-project.js @@ -165,7 +165,7 @@ test('grab-project: timeout', async (t) => { try { await grabProject(context); } catch (err) { - t.equals(err && err.message, 'Download Timed Out'); + t.equal(err && err.message, 'Download Timed Out'); } }); diff --git a/test/test-lookup.js b/test/test-lookup.js index a6a6821db..1fd1b2529 100644 --- a/test/test-lookup.js +++ b/test/test-lookup.js @@ -78,7 +78,7 @@ test('lookup[getLookupTable]: custom table', (t) => { const table = getLookupTable({ lookup: 'test/fixtures/custom-lookup.json' }); - t.deepEquals( + t.same( table, { 'omg-i-pass': { @@ -143,7 +143,7 @@ test('lookup: module not in table with gitHead', (t) => { }; lookup(context); - t.equals( + t.equal( context.module.raw, 'https://github.com/nodejs/omg-i-pass/archive/abc123.tar.gz', 'raw should use commit SHA if package has gitHead' @@ -169,7 +169,7 @@ test('lookup: module in table', (t) => { }; lookup(context); - t.equals( + t.equal( context.module.raw, 'https://github.com/lodash/lodash/archive/HEAD.tar.gz', 'raw should be truthy if the module was in the list' @@ -196,7 +196,7 @@ test('lookup: module in table with gitHead', (t) => { }; lookup(context); - t.equals( + t.equal( context.module.raw, 'https://github.com/lodash/lodash/archive/abc123.tar.gz', 'raw should use commit SHA if package has gitHead' @@ -254,12 +254,12 @@ test('lookup: module in table with useGitClone', (t) => { }; lookup(context); - t.equals( + t.equal( context.module.raw, 'https://github.com/lodash/lodash.git', 'raw should be a git URL if useGitClone is true' ); - t.equals(context.module.ref, 'v1.2.3'); + t.equal(context.module.ref, 'v1.2.3'); t.end(); }); @@ -274,7 +274,7 @@ test('lookup: no table', (t) => { try { lookup(context); } catch (err) { - t.equals(err && err.message, 'Lookup table could not be loaded'); + t.equal(err && err.message, 'Lookup table could not be loaded'); t.end(); } }); @@ -299,7 +299,7 @@ test('lookup: replace with no repo', (t) => { try { lookup(context); } catch (err) { - t.equals(err && err.message, 'no-repository-field in package.json'); + t.equal(err && err.message, 'no-repository-field in package.json'); t.end(); } }); @@ -324,7 +324,7 @@ test('lookup: not found in lookup.json with --sha', (t) => { }; lookup(context); - t.equals( + t.equal( context.module.raw, 'https://github.com/test-org/test-repo/archive/customsha.tar.gz' ); @@ -351,7 +351,7 @@ test('lookup: --fail-flaky', (t) => { }; lookup(context); - t.false(context.module.flaky, 'flaky should be disabled'); + t.notOk(context.module.flaky, 'flaky should be disabled'); t.end(); }); diff --git a/test/test-match-conditions.js b/test/test-match-conditions.js index 4c7db3e32..b4d9a8248 100644 --- a/test/test-match-conditions.js +++ b/test/test-match-conditions.js @@ -56,11 +56,11 @@ function testVersions(t, testFunction) { 'the module is matched on the current platform' ); t.ok(testFunction('macos'), 'the distro is correct'); - t.notok( + t.notOk( testFunction('v2'), 'the module is not matched on the current platform' ); - t.notok( + t.notOk( testFunction('<=v2.0.0'), 'the module is not matched on the current platform' ); @@ -76,10 +76,10 @@ function testPlatforms(t, testFunction) { t.ok(testFunction('darwin'), 'darwin is matched'); t.ok(testFunction('x64'), 'x64 is matched'); t.ok(testFunction('darwin-x64'), 'darwin-x64 is matched'); - t.notok(testFunction('darwin-x86'), 'darwin-x86 is not matched'); - t.notok(testFunction('hurd-x86'), 'hurd-x86 is not matched'); - t.notok(testFunction('hurd-x64'), 'hurd-x64 is not matched'); - t.notok(testFunction('hurd'), 'hurd is not matched'); + t.notOk(testFunction('darwin-x86'), 'darwin-x86 is not matched'); + t.notOk(testFunction('hurd-x86'), 'hurd-x86 is not matched'); + t.notOk(testFunction('hurd-x64'), 'hurd-x64 is not matched'); + t.notOk(testFunction('hurd'), 'hurd is not matched'); revertShim(); } @@ -89,18 +89,18 @@ function testArrays(t, testFunction) { testFunction([match, match, notMatch, invalid]), 'matched array of object' ); - t.notok( + t.notOk( testFunction([notMatch, notMatch, notMatch, invalid]), 'not matched array of objects' ); t.ok(testFunction(['hurd', 'x86', 'v4', 'darwin']), 'matchy array of string'); - t.notok(testFunction(['hurd', 'x86', 'v4']), 'not matchy array of string'); + t.notOk(testFunction(['hurd', 'x86', 'v4']), 'not matchy array of string'); t.ok(testFunction([true, false, 123]), 'True evaluates to true'); - t.notok(testFunction([false, 123]), 'No truthy results evaluate to false'); + t.notOk(testFunction([false, 123]), 'No truthy results evaluate to false'); revertShim(); } @@ -108,12 +108,12 @@ function testArrays(t, testFunction) { function testObjects(t, testFunction) { shim(); t.ok(testFunction(match), 'it should be matched'); - t.notok(testFunction(notMatch), 'it should not be matched'); - t.notok( + t.notOk(testFunction(notMatch), 'it should not be matched'); + t.notOk( testFunction(invalid), 'invalid input should not give a false positive' ); - t.notok( + t.notOk( testFunction({ a: 123, v5: false @@ -148,7 +148,7 @@ test('isMatch', (t) => { testArrays(t, isMatch); testObjects(t, isMatch); t.ok(isMatch(true), 'true is matched'); - t.notok(isMatch(false), 'false is not matched'); - t.notok(isMatch(123), 'invalid input is not matched'); + t.notOk(isMatch(false), 'false is not matched'); + t.notOk(isMatch(123), 'invalid input is not matched'); t.end(); }); diff --git a/test/test-out.js b/test/test-out.js index 23d189235..5ea75d885 100644 --- a/test/test-out.js +++ b/test/test-out.js @@ -28,25 +28,25 @@ test('out: with color', (t) => { return true; }); const log = Logger(); - t.notok( + t.notOk( log.silly(), 'there should be a silly logging level that is a' + ' function with no return' ); - t.notok( + t.notOk( log.verbose(), 'there should be a verbose logging level that is a function with no' + ' return' ); - t.notok( + t.notOk( log.info(), 'there should be a info logging level that is a function with no return' ); - t.notok( + t.notOk( log.warn(), 'there should be a warn logging level that is a function with no return' ); - t.notok( + t.notOk( log.error(), 'there should be a error logging level that is a' + ' function with no return' diff --git a/test/test-spawn.js b/test/test-spawn.js index 8555fba07..4a958cbd7 100644 --- a/test/test-spawn.js +++ b/test/test-spawn.js @@ -24,12 +24,12 @@ test('spawn:', (t) => { }); child.on('close', () => { - t.equals( + t.equal( message, expectedMessage, 'we should receive "Hello world." on stdout' ); - t.equals(error, '', 'there should be no data on stderr'); + t.equal(error, '', 'there should be no data on stderr'); t.end(); }); @@ -65,10 +65,6 @@ test('spawn: windows mock', (t) => { value: platform }); - t.deepEqual( - result, - expected, - 'we should have the expected options for win32' - ); + t.same(result, expected, 'we should have the expected options for win32'); t.end(); }); diff --git a/test/test-timeout.js b/test/test-timeout.js index 5b1e4736c..f79ff4263 100644 --- a/test/test-timeout.js +++ b/test/test-timeout.js @@ -42,13 +42,13 @@ test('timeout:', (t) => { const finish = timeout('npm', context, proc, next, 'Tap'); setTimeout(() => { t.notOk(context.module.flaky, 'Time out should not mark module flaky'); - t.equals(proc.killed, 1); - t.equals(ret, null); + t.equal(proc.killed, 1); + t.equal(ret, null); t.ok(err instanceof Error, 'err should be an Error'); // Finish should be idempotent const r = finish(1, 2); - t.equals(r, undefined); - t.equals(proc.killed, 1); + t.equal(r, undefined); + t.equal(proc.killed, 1); t.end(); }, 200); }); @@ -82,17 +82,17 @@ test('timeout:', (t) => { }; const finish = timeout('npm', context, proc, next, 'Tap'); const r = finish(sentinel2, sentinel3); - t.equals(r, sentinel1); - t.equals(proc.killed, 0); - t.equals(err, sentinel2); - t.equals(ret, sentinel3); + t.equal(r, sentinel1); + t.equal(proc.killed, 0); + t.equal(err, sentinel2); + t.equal(ret, sentinel3); setTimeout(() => { const r = finish(1, 2); t.notOk(context.module.flaky, 'Module is not Flaky finish called'); - t.equals(r, undefined); - t.equals(proc.killed, 0); - t.equals(err, sentinel2); - t.equals(ret, sentinel3); + t.equal(r, undefined); + t.equal(proc.killed, 0); + t.equal(err, sentinel2); + t.equal(ret, sentinel3); t.end(); }, 200); }); diff --git a/test/test-unpack.js b/test/test-unpack.js index 8a7da9429..852ad94d0 100644 --- a/test/test-unpack.js +++ b/test/test-unpack.js @@ -18,7 +18,7 @@ test('unpack: context.unpack = null', async (t) => { try { await unpack(context); } catch (err) { - t.deepEquals( + t.same( err, new Error('Nothing to unpack... Ending'), 'it should error out' @@ -36,7 +36,7 @@ test('unpack: context.unpack is invalid path', async (t) => { try { await unpack(context); } catch (err) { - t.deepEquals( + t.same( err, new Error('Nothing to unpack... Ending'), 'it should error out' diff --git a/test/yarn/test-yarn-install.js b/test/yarn/test-yarn-install.js index 23f48ccfb..916a0c8cf 100644 --- a/test/yarn/test-yarn-install.js +++ b/test/yarn/test-yarn-install.js @@ -53,7 +53,7 @@ test('yarn-install: no package.json', async (t) => { try { await packageManagerInstall('yarn', context); } catch (err) { - t.equals(err && err.message, 'Install Failed'); + t.equal(err && err.message, 'Install Failed'); t.notOk(context.module.flaky, 'Module failed but is not flaky'); } }); @@ -72,7 +72,7 @@ test('yarn-install: timeout', async (t) => { 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'); + t.equal(err && err.message, 'Install Timed Out'); } }); @@ -90,7 +90,7 @@ test('yarn-install: failed install', async (t) => { await packageManagerInstall('yarn', context); } catch (err) { t.notOk(context.module.flaky, 'Module failed is not flaky'); - t.equals(err && err.message, 'Install Failed'); + t.equal(err && err.message, 'Install Failed'); t.match(context, expected, 'Install error reported'); } }); diff --git a/test/yarn/test-yarn-test.js b/test/yarn/test-yarn-test.js index 24a84ef5c..e89d7a17d 100644 --- a/test/yarn/test-yarn-test.js +++ b/test/yarn/test-yarn-test.js @@ -68,7 +68,7 @@ test('yarn-test: basic module failing', async (t) => { try { await packageManagerTest('yarn', context); } catch (err) { - t.equals(err && err.message, 'The canary is dead:'); + t.equal(err && err.message, 'The canary is dead:'); } }); @@ -82,7 +82,7 @@ test('yarn-test: basic module no test script', async (t) => { try { await packageManagerTest('yarn', context); } catch (err) { - t.equals(err && err.message, 'Module does not support yarn-test!'); + t.equal(err && err.message, 'Module does not support yarn-test!'); } }); @@ -96,7 +96,7 @@ test('yarn-test: no package.json', async (t) => { try { await packageManagerTest('yarn', context); } catch (err) { - t.equals(err && err.message, 'Package.json Could not be found'); + t.equal(err && err.message, 'Package.json Could not be found'); } }); @@ -114,7 +114,7 @@ test('yarn-test: alternative test-path', async (t) => { try { await packageManagerTest('yarn', context); } catch (err) { - t.equals(err && err.message, 'The canary is dead:'); + t.equal(err && err.message, 'The canary is dead:'); } }); @@ -132,7 +132,7 @@ test('yarn-test: timeout', async (t) => { await packageManagerTest('yarn', context); } catch (err) { t.notOk(context.module.flaky, 'Time out should not mark module flaky'); - t.equals(err && err.message, 'Test Timed Out'); + t.equal(err && err.message, 'Test Timed Out'); } }); @@ -167,7 +167,7 @@ test('yarn-test: module with no test script failing', async (t) => { try { await packageManagerTest('yarn', context); } catch (err) { - t.equals(err && err.message, 'Module does not support yarn-test!'); + t.equal(err && err.message, 'Module does not support yarn-test!'); } });