Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: migrate from tap to node:test and c8
Browse files Browse the repository at this point in the history
R-Campbell committed Dec 13, 2024
1 parent 23ee1e2 commit 766303f
Showing 17 changed files with 775 additions and 805 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -148,8 +148,5 @@ yarn.lock
.vscode
.idea

#tap files
.tap/

# static files
static
3 changes: 1 addition & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -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
@@ -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",
@@ -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": {
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')

@@ -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) => {
@@ -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) => {
@@ -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) => {
@@ -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'

@@ -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.equal(swaggerObject.swagger, '2.0')
})
Loading

0 comments on commit 766303f

Please sign in to comment.