Aktueller Stand
This commit is contained in:
10
backend/node_modules/fastify/test/esm/errorCodes.test.mjs
generated
vendored
10
backend/node_modules/fastify/test/esm/errorCodes.test.mjs
generated
vendored
@@ -1,10 +1,10 @@
|
||||
import { errorCodes } from '../../fastify.js'
|
||||
import t from 'tap'
|
||||
import { test } from 'node:test'
|
||||
|
||||
t.test('errorCodes in ESM', async t => {
|
||||
test('errorCodes in ESM', async t => {
|
||||
// test a custom fastify error using errorCodes with ESM
|
||||
const customError = errorCodes.FST_ERR_VALIDATION('custom error message')
|
||||
t.ok(typeof customError !== 'undefined')
|
||||
t.ok(customError instanceof errorCodes.FST_ERR_VALIDATION)
|
||||
t.equal(customError.message, 'custom error message')
|
||||
t.assert.ok(typeof customError !== 'undefined')
|
||||
t.assert.ok(customError instanceof errorCodes.FST_ERR_VALIDATION)
|
||||
t.assert.strictEqual(customError.message, 'custom error message')
|
||||
})
|
||||
|
||||
6
backend/node_modules/fastify/test/esm/esm.test.mjs
generated
vendored
6
backend/node_modules/fastify/test/esm/esm.test.mjs
generated
vendored
@@ -1,7 +1,7 @@
|
||||
import t from 'tap'
|
||||
import { test } from 'node:test'
|
||||
import Fastify from '../../fastify.js'
|
||||
|
||||
t.test('esm support', async t => {
|
||||
test('esm support', async t => {
|
||||
const fastify = Fastify()
|
||||
|
||||
fastify.register(import('./plugin.mjs'), { foo: 'bar' })
|
||||
@@ -9,5 +9,5 @@ t.test('esm support', async t => {
|
||||
|
||||
await fastify.ready()
|
||||
|
||||
t.equal(fastify.foo, 'bar')
|
||||
t.assert.strictEqual(fastify.foo, 'bar')
|
||||
})
|
||||
|
||||
14
backend/node_modules/fastify/test/esm/index.test.js
generated
vendored
14
backend/node_modules/fastify/test/esm/index.test.js
generated
vendored
@@ -1,18 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
const t = require('tap')
|
||||
const semver = require('semver')
|
||||
|
||||
if (semver.lt(process.versions.node, '14.13.0')) {
|
||||
t.skip('Skip named exports because Node version < 14.13.0')
|
||||
} else {
|
||||
// Node v8 throw a `SyntaxError: Unexpected token import`
|
||||
// even if this branch is never touch in the code,
|
||||
// by using `eval` we can avoid this issue.
|
||||
// eslint-disable-next-line
|
||||
new Function('module', 'return import(module)')('./named-exports.mjs').catch((err) => {
|
||||
import('./named-exports.mjs')
|
||||
.catch(err => {
|
||||
process.nextTick(() => {
|
||||
throw err
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
6
backend/node_modules/fastify/test/esm/named-exports.mjs
generated
vendored
6
backend/node_modules/fastify/test/esm/named-exports.mjs
generated
vendored
@@ -1,8 +1,8 @@
|
||||
import t from 'tap'
|
||||
import { test } from 'node:test'
|
||||
import { fastify } from '../../fastify.js'
|
||||
|
||||
// This test is executed in index.test.js
|
||||
t.test('named exports support', async t => {
|
||||
test('named exports support', async t => {
|
||||
const app = fastify()
|
||||
|
||||
app.register(import('./plugin.mjs'), { foo: 'bar' })
|
||||
@@ -10,5 +10,5 @@ t.test('named exports support', async t => {
|
||||
|
||||
await app.ready()
|
||||
|
||||
t.equal(app.foo, 'bar')
|
||||
t.assert.strictEqual(app.foo, 'bar')
|
||||
})
|
||||
|
||||
4
backend/node_modules/fastify/test/esm/other.mjs
generated
vendored
4
backend/node_modules/fastify/test/esm/other.mjs
generated
vendored
@@ -1,8 +1,8 @@
|
||||
// Imported in both index.test.js & esm.test.mjs
|
||||
import t from 'tap'
|
||||
import { strictEqual } from 'node:assert'
|
||||
|
||||
async function other (fastify, opts) {
|
||||
t.equal(fastify.foo, 'bar')
|
||||
strictEqual(fastify.foo, 'bar')
|
||||
}
|
||||
|
||||
export default other
|
||||
|
||||
Reference in New Issue
Block a user