Skip to content

chore: migrate from tap to node:test and c8 using borp #182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
"load-data": "docker exec -it fastify-postgres psql -c 'CREATE TABLE users(id serial PRIMARY KEY, username VARCHAR (50) NOT NULL);' -U postgres -d postgres",
"postgres": "docker run -p 5432:5432 --name fastify-postgres -e POSTGRES_PASSWORD=postgres -d postgres:11-alpine",
"test": "npm run test:unit && npm run test:typescript",
"test:unit": "tap test/*.test.js",
"test:report": "standard && tap --coverage-report=html test/*.test.js",
"test:typescript": "tsd",
"test:verbose": "standard && tap test/*.test.js -Rspec"
"test:unit": "borp --reporter=./test/test-reporter.mjs --coverage --check-coverage",
"test:report": "standard && c8 --reporter html borp --reporter=./test/test-reporter.mjs",
"test:typescript": "tsd"
},
"repository": {
"type": "git",
Expand All @@ -41,11 +40,13 @@
"devDependencies": {
"@tsconfig/node10": "^1.0.9",
"@types/pg": "^8.11.4",
"borp": "^0.18.0",
"c8": "^10.1.2",
"fastify": "^5.0.0",
"pg": "^8.11.3",
"pg-native": "^3.0.1",
"standard": "^17.1.0",
"tap": "^18.7.1",
"tap": "^21.0.1",
"tsd": "^0.31.1",
"typescript": "~5.4.3"
},
Expand Down
20 changes: 9 additions & 11 deletions test/add-handler.test.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
'use strict'

const { test } = require('tap')
const { test } = require('node:test')
const addHandler = require('../lib/add-handler')

test('The addHandler lib should return the right handlers structure', t => {
t.test('When the existingHandler argument is undefined', t => {
test('The addHandler lib should return the right handlers structure', async t => {
await t.test('When the existingHandler argument is undefined', t => {
t.plan(1)

const handlers = addHandler(
undefined,
'test'
)

t.same(handlers, ['test'])
t.assert.deepStrictEqual(handlers, ['test'])
})

t.test('When the existingHandler argument is an array', t => {
await t.test('When the existingHandler argument is an array', t => {
t.plan(1)

const handlers = addHandler(
['test'],
'again'
)

t.same(handlers, ['test', 'again'])
t.assert.deepStrictEqual(handlers, ['test', 'again'])
})

t.test('When the existingHandler argument is a function', t => {
await t.test('When the existingHandler argument is a function', t => {
t.plan(2)

const stub = () => 'test'
Expand All @@ -36,9 +36,7 @@ test('The addHandler lib should return the right handlers structure', t => {
'again'
)

t.same(handlers[0](), 'test')
t.same(handlers[1], 'again')
t.assert.deepStrictEqual(handlers[0](), 'test')
t.assert.deepStrictEqual(handlers[1], 'again')
})

t.end()
})
Loading
Loading