Skip to content
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

test: migrate from tap to node:test and c8 #843

Merged
merged 8 commits into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 1 addition & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
module.exports = require('neostandard')({
ignores: [
...require('neostandard').resolveIgnoresFromGitignore(),
'static',
'tap-snapshots/*'
'static'
],
ts: true
})
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
"lint:fix": "eslint --fix",
"test": "npm run test:unit && npm run test:typescript",
"test:typescript": "tsd",
"test:unit": "tap",
"test:unit:report": "npm run test:unit -- --coverage-report=html",
"test:unit:verbose": "npm run test:unit -- -Rspec"
"test:unit": "c8 --100 node --test"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -43,13 +41,13 @@
"@fastify/cookie": "^11.0.1",
"@fastify/pre-commit": "^2.1.0",
"@types/node": "^22.0.0",
"c8": "^10.1.3",
"fastify": "^5.0.0",
"fluent-json-schema": "^5.0.0",
"joi": "^17.13.1",
"joi-to-json": "^4.2.1",
"neostandard": "^0.11.9",
"qs": "^6.12.1",
"tap": "18.7.2",
"tsd": "^0.31.0"
},
"dependencies": {
Expand Down
65 changes: 0 additions & 65 deletions tap-snapshots/test/mode/static.js.test.cjs

This file was deleted.

10 changes: 5 additions & 5 deletions test/decorator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const { test } = require('tap')
const { test } = require('node:test')
const Fastify = require('fastify')
const fastifySwagger = require('../index')

Expand All @@ -11,7 +11,7 @@ test('fastify.swagger should exist', async (t) => {
await fastify.register(fastifySwagger)

await fastify.ready()
t.ok(fastify.swagger)
t.assert.ok(fastify.swagger)
})

test('fastify.swagger should throw if called before ready', async (t) => {
Expand All @@ -20,7 +20,7 @@ test('fastify.swagger should throw if called before ready', async (t) => {

await fastify.register(fastifySwagger)

t.throws(fastify.swagger.bind(fastify))
t.assert.throws(fastify.swagger.bind(fastify))
})

test('fastify.swagger should throw if called before ready (openapi)', async (t) => {
Expand All @@ -31,7 +31,7 @@ test('fastify.swagger should throw if called before ready (openapi)', async (t)
openapi: {}
})

t.throws(fastify.swagger.bind(fastify))
t.assert.throws(fastify.swagger.bind(fastify))
})

test('decorator can be overridden', async (t) => {
Expand All @@ -41,5 +41,5 @@ test('decorator can be overridden', async (t) => {
await fastify.register(fastifySwagger, { decorator: 'customSwaggerDecorator' })

await fastify.ready()
t.ok(fastify.customSwaggerDecorator())
t.assert.ok(fastify.customSwaggerDecorator())
})
4 changes: 2 additions & 2 deletions test/esm/esm.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import t from 'tap'
import t from 'node:test'
import Fastify from 'fastify'
import swaggerDefault from '../../index.js'

Expand All @@ -10,5 +10,5 @@ t.test('esm support', async t => {
await fastify.ready()

const swaggerObject = fastify.swagger()
t.equal(swaggerObject.swagger, '2.0')
t.assert.strictEqual(swaggerObject.swagger, '2.0')
})
Loading
Loading