Skip to content

Commit

Permalink
ci: get ride of tap deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
cschanaj committed Aug 26, 2022
1 parent dc08e96 commit f4e8b72
Show file tree
Hide file tree
Showing 14 changed files with 164 additions and 164 deletions.
24 changes: 12 additions & 12 deletions test/add-all-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ t.test('outputs an empty coverage report for all files that are not excluded', a
const reports = (await nyc.coverageData()).filter(report => ap(report)[notLoadedPath])
const report = reports[0][notLoadedPath]

t.strictEqual(reports.length, 1)
t.strictEqual(report.s['0'], 0)
t.strictEqual(report.s['1'], 0)
t.equal(reports.length, 1)
t.equal(report.s['0'], 0)
t.equal(report.s['1'], 0)
})

t.test('outputs an empty coverage report for multiple configured extensions', async t => {
Expand All @@ -42,15 +42,15 @@ t.test('outputs an empty coverage report for multiple configured extensions', as
return apr[notLoadedPath1] || apr[notLoadedPath2]
})

t.strictEqual(reports.length, 1)
t.equal(reports.length, 1)

const report1 = reports[0][notLoadedPath1]
t.strictEqual(report1.s['0'], 0)
t.strictEqual(report1.s['1'], 0)
t.equal(report1.s['0'], 0)
t.equal(report1.s['1'], 0)

const report2 = reports[0][notLoadedPath2]
t.strictEqual(report2.s['0'], 0)
t.strictEqual(report2.s['1'], 0)
t.equal(report2.s['0'], 0)
t.equal(report2.s['1'], 0)
})

t.test('transpiles .js files added via addAllFiles', async t => {
Expand All @@ -72,8 +72,8 @@ t.test('transpiles .js files added via addAllFiles', async t => {
const reports = (await nyc.coverageData()).filter(report => ap(report)[needsTranspilePath])
const report = reports[0][needsTranspilePath]

t.strictEqual(reports.length, 1)
t.strictEqual(report.s['0'], 0)
t.equal(reports.length, 1)
t.equal(report.s['0'], 0)

await fs.unlink(needsTranspilePath)
})
Expand Down Expand Up @@ -120,8 +120,8 @@ t.test('transpiles non-.js files added via addAllFiles', async t => {
const reports = (await nyc.coverageData()).filter(report => ap(report)[needsTranspilePath])
const report = reports[0][needsTranspilePath]

t.strictEqual(reports.length, 1)
t.strictEqual(report.s['0'], 0)
t.equal(reports.length, 1)
t.equal(report.s['0'], 0)

await fs.unlink(needsTranspilePath)
})
2 changes: 1 addition & 1 deletion test/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async function cacheTest (t, script) {
env: {}
})

t.strictEqual(status, 0)
t.equal(status, 0)
}

t.test('cache handles collisions', t => cacheTest(t, './cache-collision-runner.js'))
Expand Down
26 changes: 13 additions & 13 deletions test/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,52 +11,52 @@ const { parseArgv } = require('./helpers')
test("loads 'exclude' patterns from package.json#nyc", async t => {
const nyc = new NYC(await parseArgv(path.resolve(__dirname, './fixtures')))

t.strictEqual(nyc.exclude.exclude.length, 8)
t.equal(nyc.exclude.exclude.length, 8)
})

test("loads 'extension' patterns from package.json#nyc", async t => {
const nyc = new NYC(await parseArgv(path.resolve(__dirname, './fixtures/conf-multiple-extensions')))

t.strictEqual(nyc.extensions.length, 3)
t.equal(nyc.extensions.length, 3)
})

test("ignores 'include' option if it's falsy or []", async t => {
const nyc1 = new NYC(await parseArgv(path.resolve(__dirname, './fixtures/conf-empty')))

t.strictEqual(nyc1.exclude.include, false)
t.equal(nyc1.exclude.include, false)

const nyc2 = new NYC({
include: []
})

t.strictEqual(nyc2.exclude.include, false)
t.equal(nyc2.exclude.include, false)
})

test("ignores 'exclude' option if it's falsy", async t => {
const nyc = new NYC(await parseArgv(path.resolve(__dirname, './fixtures/conf-empty')))

t.strictEqual(nyc.exclude.exclude.length, 27)
t.equal(nyc.exclude.exclude.length, 27)
})

test("allows for empty 'exclude'", async t => {
const nyc = new NYC({ exclude: [] })

// an empty exclude still has **/node_modules/**, node_modules/** and added.
t.strictEqual(nyc.exclude.exclude.length, 2)
t.equal(nyc.exclude.exclude.length, 2)
})

test("allows for completely empty 'exclude' with exclude-node-modules", async t => {
const nyc = new NYC({ exclude: [], excludeNodeModules: false })

t.strictEqual(nyc.exclude.exclude.length, 0)
t.equal(nyc.exclude.exclude.length, 0)
})

test('should resolve default cache folder to absolute path', async t => {
const nyc = new NYC({
cache: true
})

t.strictEqual(path.isAbsolute(nyc.cacheDirectory), true)
t.equal(path.isAbsolute(nyc.cacheDirectory), true)
})

test('should resolve custom cache folder to absolute path', async t => {
Expand All @@ -65,21 +65,21 @@ test('should resolve custom cache folder to absolute path', async t => {
cache: true
})

t.strictEqual(path.isAbsolute(nyc.cacheDirectory), true)
t.equal(path.isAbsolute(nyc.cacheDirectory), true)
})

test('if cache is false _disableCachingTransform is true', async t => {
const nycParent = new NYC({ cache: false, isChildProcess: false })
const nycChild = new NYC({ cache: false, isChildProcess: true })

t.strictEqual(nycParent._disableCachingTransform(), true)
t.strictEqual(nycChild._disableCachingTransform(), true)
t.equal(nycParent._disableCachingTransform(), true)
t.equal(nycChild._disableCachingTransform(), true)
})

test('if cache is true _disableCachingTransform is equal to !isChildProcess', async t => {
const nycParent = new NYC({ cache: true, isChildProcess: false })
const nycChild = new NYC({ cache: true, isChildProcess: true })

t.strictEqual(nycParent._disableCachingTransform(), true)
t.strictEqual(nycChild._disableCachingTransform(), false)
t.equal(nycParent._disableCachingTransform(), true)
t.equal(nycChild._disableCachingTransform(), false)
})
8 changes: 4 additions & 4 deletions test/cwd.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ t.beforeEach(async () => {
t.test('sets cwd to process.cwd() if no environment variable is set', async t => {
const nyc = new NYC(await parseArgv())

t.strictEqual(nyc.cwd, process.cwd())
t.equal(nyc.cwd, process.cwd())
})

t.test('uses NYC_CWD environment variable for cwd if it is set', async t => {
const fixtures = path.resolve(__dirname, './fixtures')
process.env.NYC_CWD = fixtures
const nyc = new NYC(await parseArgv())

t.strictEqual(nyc.cwd, fixtures)
t.equal(nyc.cwd, fixtures)
})

t.test('will look upwards for package.json from cwd', async t => {
const nyc = new NYC(await parseArgv(__dirname))

t.strictEqual(nyc.cwd, path.join(__dirname, '..'))
t.equal(nyc.cwd, path.join(__dirname, '..'))
})

t.test('uses --cwd for cwd if it is set (highest priority and does not look upwards for package.json) ', async t => {
const nyc = new NYC(await parseArgv(__dirname, ['--cwd', __dirname]))

t.strictEqual(nyc.cwd, __dirname)
t.equal(nyc.cwd, __dirname)
})
4 changes: 2 additions & 2 deletions test/helpers/env-check-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ async function envCheckConfig (t, { configArgs, checkOptions }) {

const config = JSON.parse(JSON.parse(stdout).NYC_CONFIG)

t.is(status, 0)
t.is(stderr, '')
t.equal(status, 0)
t.equal(stderr, '')
t.matchSnapshot(
JSON.stringify(
checkOptions.sort().map(option => [option, config[option]]),
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/temp-dir-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function tempDirSetup (t, testFile) {
return rimraf(this.tempDir)
})

t.tearDown(() => rimraf(tempDirBase))
t.teardown(() => rimraf(tempDirBase))
}

module.exports = tempDirSetup
Loading

0 comments on commit f4e8b72

Please sign in to comment.