-
-
Notifications
You must be signed in to change notification settings - Fork 75
test: #5555 - move to node test runner #440
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
Changes from 38 commits
f45a705
1280440
a754488
3a4c5d6
ab32e9d
19adc59
e51ee0d
c0120d3
e76d97c
aba67ed
3f67a45
f8ffbd3
88a1c72
a605644
fe23056
f5740b7
371acca
54bd5e8
cf0c1d3
71a6660
d6f90b3
84a2ea3
6d55f55
0c8c652
63a3422
91b6645
a21aeb6
aedd7eb
aa22d4b
542ae9a
12ff679
6e403dc
c6c55c9
595b08d
3eab5ae
66e6abd
50499b1
a4e5cb2
34d752e
2418ee3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| files: | ||
| - 'test/issues/*/test.js' | ||
| - 'test/commonjs/*.js' | ||
| - 'test/module/*.js' | ||
This file was deleted.
|
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,51 +1,46 @@ | ||
| 'use strict' | ||
|
|
||
| const t = require('tap') | ||
| const { after, before, describe, it } = require('node:test') | ||
| const assert = require('node:assert') | ||
| const Fastify = require('fastify') | ||
|
|
||
| t.plan(13) | ||
|
|
||
| const app = Fastify() | ||
|
|
||
| app.register(require('./autohooks/basic')) | ||
| app.decorateRequest('hooked', '') | ||
| describe('Node test suite for autohooks-basic', function () { | ||
| const app = Fastify() | ||
| before(async function () { | ||
| app.register(require('./autohooks/basic')) | ||
| app.decorateRequest('hooked', '') | ||
| await app.ready() | ||
| }) | ||
|
|
||
| app.ready(function (err) { | ||
| t.error(err) | ||
| after(async function () { | ||
| await app.close() | ||
| }) | ||
|
|
||
| app.inject({ | ||
| url: '/' | ||
| }, function (err, res) { | ||
| t.error(err) | ||
| it('should respond correctly to /', async function () { | ||
| const res = await app.inject({ url: '/' }) | ||
|
|
||
| t.equal(res.statusCode, 200) | ||
| t.same(JSON.parse(res.payload), { hooked: ['root'] }) | ||
| assert.strictEqual(res.statusCode, 200) | ||
| assert.deepStrictEqual(JSON.parse(res.payload), { hooked: ['root'] }) | ||
| }) | ||
|
|
||
| app.inject({ | ||
| url: '/child' | ||
| }, function (err, res) { | ||
| t.error(err) | ||
| it('should respond correctly to /child', async function () { | ||
| const res = await app.inject({ url: '/child' }) | ||
|
|
||
| t.equal(res.statusCode, 200) | ||
| t.same(JSON.parse(res.payload), { hooked: ['child'] }) | ||
| assert.strictEqual(res.statusCode, 200) | ||
| assert.deepStrictEqual(JSON.parse(res.payload), { hooked: ['child'] }) | ||
| }) | ||
|
|
||
| app.inject({ | ||
| url: '/child/grandchild' | ||
| }, function (err, res) { | ||
| t.error(err) | ||
| it('should respond correctly to /child/grandchild', async function () { | ||
| const res = await app.inject({ url: '/child/grandchild' }) | ||
|
|
||
| t.equal(res.statusCode, 200) | ||
| t.same(JSON.parse(res.payload), { hooked: ['grandchild'] }) | ||
| assert.strictEqual(res.statusCode, 200) | ||
| assert.deepStrictEqual(JSON.parse(res.payload), { hooked: ['grandchild'] }) | ||
| }) | ||
|
|
||
| app.inject({ | ||
| url: '/sibling' | ||
| }, function (err, res) { | ||
| t.error(err) | ||
| it('should respond correctly to /sibling', async function () { | ||
| const res = await app.inject({ url: '/sibling' }) | ||
|
|
||
| t.equal(res.statusCode, 200) | ||
| t.same(JSON.parse(res.payload), { hooked: '' }) | ||
| assert.strictEqual(res.statusCode, 200) | ||
| assert.deepStrictEqual(JSON.parse(res.payload), { hooked: '' }) | ||
| }) | ||
| }) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,51 +1,46 @@ | ||
| 'use strict' | ||
|
|
||
| const t = require('tap') | ||
| const { after, before, describe, it } = require('node:test') | ||
| const assert = require('node:assert') | ||
| const Fastify = require('fastify') | ||
|
|
||
| t.plan(13) | ||
|
|
||
| const app = Fastify() | ||
|
|
||
| app.register(require('./autohooks/cascade')) | ||
| app.decorateRequest('hooked', '') | ||
| describe('Node test suite for autohooks-cascade', function () { | ||
| const app = Fastify() | ||
| before(async function () { | ||
| app.register(require('./autohooks/cascade')) | ||
| app.decorateRequest('hooked', '') | ||
| await app.ready() | ||
| }) | ||
|
|
||
| app.ready(function (err) { | ||
| t.error(err) | ||
| after(async function () { | ||
| await app.close() | ||
| }) | ||
|
|
||
| app.inject({ | ||
| url: '/' | ||
| }, function (err, res) { | ||
| t.error(err) | ||
| it('should respond correctly to /', async function () { | ||
| const res = await app.inject({ url: '/' }) | ||
|
|
||
| t.equal(res.statusCode, 200) | ||
| t.same(JSON.parse(res.payload), { hooked: ['root'] }) | ||
| assert.strictEqual(res.statusCode, 200) | ||
| assert.deepStrictEqual(JSON.parse(res.payload), { hooked: ['root'] }) | ||
| }) | ||
|
|
||
| app.inject({ | ||
| url: '/child' | ||
| }, function (err, res) { | ||
| t.error(err) | ||
| it('should respond correctly to /child', async function () { | ||
| const res = await app.inject({ url: '/child' }) | ||
|
|
||
| t.equal(res.statusCode, 200) | ||
| t.same(JSON.parse(res.payload), { hooked: ['root', 'child'] }) | ||
| assert.strictEqual(res.statusCode, 200) | ||
| assert.deepStrictEqual(JSON.parse(res.payload), { hooked: ['root', 'child'] }) | ||
| }) | ||
|
|
||
| app.inject({ | ||
| url: '/child/grandchild' | ||
| }, function (err, res) { | ||
| t.error(err) | ||
| it('should respond correctly to /child/grandchild', async function () { | ||
| const res = await app.inject({ url: '/child/grandchild' }) | ||
|
|
||
| t.equal(res.statusCode, 200) | ||
| t.same(JSON.parse(res.payload), { hooked: ['root', 'child', 'grandchild'] }) | ||
| assert.strictEqual(res.statusCode, 200) | ||
| assert.deepStrictEqual(JSON.parse(res.payload), { hooked: ['root', 'child', 'grandchild'] }) | ||
| }) | ||
|
|
||
| app.inject({ | ||
| url: '/sibling' | ||
| }, function (err, res) { | ||
| t.error(err) | ||
| it('should respond correctly to /sibling', async function () { | ||
| const res = await app.inject({ url: '/sibling' }) | ||
|
|
||
| t.equal(res.statusCode, 200) | ||
| t.same(JSON.parse(res.payload), { hooked: ['root'] }) | ||
| assert.strictEqual(res.statusCode, 200) | ||
| assert.deepStrictEqual(JSON.parse(res.payload), { hooked: ['root'] }) | ||
| }) | ||
| }) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,51 +1,46 @@ | ||
| 'use strict' | ||
|
|
||
| const t = require('tap') | ||
| const { after, before, describe, it } = require('node:test') | ||
| const assert = require('node:assert') | ||
| const Fastify = require('fastify') | ||
|
|
||
| t.plan(13) | ||
|
|
||
| const app = Fastify() | ||
|
|
||
| app.register(require('./autohooks/disabled')) | ||
| app.decorateRequest('hooked', 'disabled') | ||
| describe('Node test suite for autohooks-disabled', function () { | ||
| const app = Fastify() | ||
| before(async function () { | ||
| app.register(require('./autohooks/disabled')) | ||
| app.decorateRequest('hooked', 'disabled') | ||
| await app.ready() | ||
| }) | ||
|
|
||
| app.ready(function (err) { | ||
| t.error(err) | ||
| after(async function () { | ||
| await app.close() | ||
| }) | ||
|
|
||
| app.inject({ | ||
| url: '/' | ||
| }, function (err, res) { | ||
| t.error(err) | ||
| it('should respond correctly to /', async function () { | ||
| const res = await app.inject({ url: '/' }) | ||
|
|
||
| t.equal(res.statusCode, 200) | ||
| t.same(JSON.parse(res.payload), { hooked: 'disabled' }) | ||
| assert.strictEqual(res.statusCode, 200) | ||
| assert.deepStrictEqual(JSON.parse(res.payload), { hooked: 'disabled' }) | ||
| }) | ||
|
|
||
| app.inject({ | ||
| url: '/child' | ||
| }, function (err, res) { | ||
| t.error(err) | ||
| it('should respond correctly to /child', async function () { | ||
| const res = await app.inject({ url: '/child' }) | ||
|
|
||
| t.equal(res.statusCode, 200) | ||
| t.same(JSON.parse(res.payload), { hooked: 'disabled' }) | ||
| assert.strictEqual(res.statusCode, 200) | ||
| assert.deepStrictEqual(JSON.parse(res.payload), { hooked: 'disabled' }) | ||
| }) | ||
|
|
||
| app.inject({ | ||
| url: '/child/grandchild' | ||
| }, function (err, res) { | ||
| t.error(err) | ||
| it('should respond correctly to /child/grandchild', async function () { | ||
| const res = await app.inject({ url: '/child/grandchild' }) | ||
|
|
||
| t.equal(res.statusCode, 200) | ||
| t.same(JSON.parse(res.payload), { hooked: 'disabled' }) | ||
| assert.strictEqual(res.statusCode, 200) | ||
| assert.deepStrictEqual(JSON.parse(res.payload), { hooked: 'disabled' }) | ||
| }) | ||
|
|
||
| app.inject({ | ||
| url: '/sibling' | ||
| }, function (err, res) { | ||
| t.error(err) | ||
| it('should respond correctly to /sibling', async function () { | ||
| const res = await app.inject({ url: '/sibling' }) | ||
|
|
||
| t.equal(res.statusCode, 200) | ||
| t.same(JSON.parse(res.payload), { hooked: 'disabled' }) | ||
| assert.strictEqual(res.statusCode, 200) | ||
| assert.deepStrictEqual(JSON.parse(res.payload), { hooked: 'disabled' }) | ||
| }) | ||
| }) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,51 +1,46 @@ | ||
| 'use strict' | ||
|
|
||
| const t = require('tap') | ||
| const { after, before, describe, it } = require('node:test') | ||
| const assert = require('node:assert') | ||
| const Fastify = require('fastify') | ||
|
|
||
| t.plan(13) | ||
|
|
||
| const app = Fastify() | ||
|
|
||
| app.register(require('./autohooks/overwrite')) | ||
| app.decorateRequest('hooked', '') | ||
| describe('Node test suite for autohooks-overwrite', function () { | ||
| const app = Fastify() | ||
| before(async function () { | ||
| app.register(require('./autohooks/overwrite')) | ||
| app.decorateRequest('hooked', '') | ||
| await app.ready() | ||
| }) | ||
|
|
||
| app.ready(function (err) { | ||
| t.error(err) | ||
| after(async function () { | ||
| await app.close() | ||
| }) | ||
|
|
||
| app.inject({ | ||
| url: '/' | ||
| }, function (err, res) { | ||
| t.error(err) | ||
| it('should respond correctly to /', async function () { | ||
| const res = await app.inject({ url: '/' }) | ||
|
|
||
| t.equal(res.statusCode, 200) | ||
| t.same(JSON.parse(res.payload), { hooked: ['root'] }) | ||
| assert.strictEqual(res.statusCode, 200) | ||
| assert.deepStrictEqual(JSON.parse(res.payload), { hooked: ['root'] }) | ||
| }) | ||
|
|
||
| app.inject({ | ||
| url: '/child' | ||
| }, function (err, res) { | ||
| t.error(err) | ||
| it('should respond correctly to /child', async function () { | ||
| const res = await app.inject({ url: '/child' }) | ||
|
|
||
| t.equal(res.statusCode, 200) | ||
| t.same(JSON.parse(res.payload), { hooked: ['child'] }) | ||
| assert.strictEqual(res.statusCode, 200) | ||
| assert.deepStrictEqual(JSON.parse(res.payload), { hooked: ['child'] }) | ||
| }) | ||
|
|
||
| app.inject({ | ||
| url: '/child/grandchild' | ||
| }, function (err, res) { | ||
| t.error(err) | ||
| it('should respond correctly to /child/grandchild', async function () { | ||
| const res = await app.inject({ url: '/child/grandchild' }) | ||
|
|
||
| t.equal(res.statusCode, 200) | ||
| t.same(JSON.parse(res.payload), { hooked: ['grandchild'] }) | ||
| assert.strictEqual(res.statusCode, 200) | ||
| assert.deepStrictEqual(JSON.parse(res.payload), { hooked: ['grandchild'] }) | ||
| }) | ||
|
|
||
| app.inject({ | ||
| url: '/sibling' | ||
| }, function (err, res) { | ||
| t.error(err) | ||
| it('should respond correctly to /sibling', async function () { | ||
| const res = await app.inject({ url: '/sibling' }) | ||
|
|
||
| t.equal(res.statusCode, 200) | ||
| t.same(JSON.parse(res.payload), { hooked: ['root'] }) | ||
| assert.strictEqual(res.statusCode, 200) | ||
| assert.deepStrictEqual(JSON.parse(res.payload), { hooked: ['root'] }) | ||
| }) | ||
| }) |
Uh oh!
There was an error while loading. Please reload this page.