@@ -328,7 +328,7 @@ if your project uses `@fastify/swagger`, `fastify-cli` can generate and write ou
328328
329329"scripts": {
330330+ "pretest": "standard",
331- "test": "tap test/**/*.test.js",
331+ "test": "node --test test/**/*.test.js",
332332 "start": "fastify start -l info app.js",
333333 "dev": "fastify start -l info -P app.js",
334334+ "lint": "standard --fix"
@@ -339,7 +339,7 @@ if your project uses `@fastify/swagger`, `fastify-cli` can generate and write ou
339339
340340When you use ` fastify-cli ` to run your project you need a way to load your application because you can run the CLI command.
341341To do so, you can use the this module to load your application and give you the control to write your assertions.
342- These utilities are async functions that you may use with the [ ` node-tap ` ] ( https://www.npmjs.com/package/tap ) testing framework .
342+ These utilities are async functions that you may use with the [ ` Node Test runner ` ] ( https://nodejs.org/api/test.html ) .
343343
344344There are two utilities provided:
345345
@@ -357,21 +357,23 @@ Both of these utilities have the `function(args, pluginOptions, serverOptions)`
357357const { build , listen } = require (' fastify-cli/helper' )
358358
359359// write a test
360- const { test } = require (' tap' )
360+ const { test } = require (' node:test' )
361+ const assert = require (' node:assert' )
362+
361363test (' test my application' , async t => {
362364 const argv = [' app.js' ]
363365 const app = await build (argv, {
364366 extraParam: ' foo'
365367 })
366- t .teardown (() => app .close ())
368+ t .after (() => app .close ())
367369
368370 // test your application here:
369371 const res = await app .inject (' /' )
370- t . same (res .json (), { hello: ' one' })
372+ assert . deepStrictEqual (res .json (), { hello: ' one' })
371373})
372374```
373375
374- Log output is consumed by tap . If log messages should be logged to the console
376+ Log output is consumed by Node Test runner . If log messages should be logged to the console
375377the logger needs to be configured to output to stderr instead of stdout.
376378
377379``` js
@@ -386,11 +388,11 @@ const logger = {
386388const argv = [' app.js' ]
387389test (' test my application with logging enabled' , async t => {
388390 const app = await build (argv, {}, { logger })
389- t .teardown (() => app .close ())
391+ t .after (() => app .close ())
390392
391393 // test your application here:
392394 const res = await app .inject (' /' )
393- t . same (res .json (), { hello: ' one' })
395+ assert . deepStrictEqual (res .json (), { hello: ' one' })
394396})
395397```
396398
0 commit comments