-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: #5555 - move to node test runner (#440)
* test: forceEsm from tap to node test runner * test: updated test/typescript/basic.ts * test: updated test/commonjs/autohooks-basic.js * test: updated test/commonjs/autohooks-*.js * test: updated test/commonjs/babel-node.js and basic.js * test: updated cyclic * test: updated deep * test: updated dependency * test: updated commonjs/error * test: updated graph-dependency * test: updated commonjs/index-package.js * test: updated commonjs/non-plugin.js * test: updated commonjs/options.js * test: updated commonjs/route-parametrs.js * test: use promises in forceEsm * test: removed assert if error after promises * test: removed nested suites * test: updated issue 369 * test: updated issue 374 * test: updated issue 376 * Revert "test: updated issue 376" This reverts commit 71a6660. * test: updated issue 376 * test: updated issue 388 * test: updated module/autohooks * test: updated module/basic * test: updated module/dependency * test: updated module/route-parameters * test: updated module/index-package * test: updated module/options * test: fixed /route-parameters * test: updated module/esm-import * chore: removed tap from package.json * test: added glob to make windows able to expand patterns * test: try using fast-glob instead of glob * test: use borp instead of fast-glob script * test: readded coverage * test: added check on code coverage * chore: newline
- Loading branch information
1 parent
2b3a6ec
commit e4ae352
Showing
35 changed files
with
1,430 additions
and
1,448 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: '' }) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] }) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' }) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] }) | ||
}) | ||
}) |
Oops, something went wrong.