Aktueller Stand
This commit is contained in:
10
backend/node_modules/fastify/test/bundler/README.md
generated
vendored
10
backend/node_modules/fastify/test/bundler/README.md
generated
vendored
@@ -1,12 +1,12 @@
|
||||
# Bundlers test stack
|
||||
|
||||
In some cases, developers bundle their apps for several targets such as serverless applications.
|
||||
Even if it's not recommended by Fastify team; we need to ensure we do not break the build process.
|
||||
In some cases, developers bundle their apps for several targets such as serverless applications.
|
||||
Even if it's not recommended by Fastify team; we need to ensure we do not break the build process.
|
||||
Please note this might result in features behaving differently, like the version handling check for plugins.
|
||||
|
||||
## Test bundlers
|
||||
|
||||
The bundler test stack has been defined separately from the rest of the Unit testing stack because it's not a
|
||||
The bundler test stack has been defined separately from the rest of the Unit testing stack because it's not a
|
||||
part of the fastify lib itself. Note that the tests run in CI only on NodeJs LTS version.
|
||||
Developers do not need to install every bundler to run unit tests.
|
||||
|
||||
@@ -23,7 +23,7 @@ stack dependencies. See:
|
||||
|
||||
## Bundler test development
|
||||
|
||||
To not break the fastify unit testing stack please name test files like this `*-test.js` and not `*.test.js`,
|
||||
To not break the fastify unit testing stack please name test files like this `*-test.js` and not `*.test.js`,
|
||||
otherwise it will be targeted by the regular expression used for unit tests for fastify.
|
||||
Tests need to ensure the build process works and the fastify application can be run,
|
||||
Tests need to ensure the build process works and the fastify application can be run,
|
||||
no need to go in deep testing unless an issue is raised.
|
||||
|
||||
19
backend/node_modules/fastify/test/bundler/esbuild/bundler-test.js
generated
vendored
19
backend/node_modules/fastify/test/bundler/esbuild/bundler-test.js
generated
vendored
@@ -1,31 +1,32 @@
|
||||
'use strict'
|
||||
|
||||
const t = require('tap')
|
||||
const test = t.test
|
||||
const { test } = require('node:test')
|
||||
const fastifySuccess = require('./dist/success')
|
||||
const fastifyFailPlugin = require('./dist/failPlugin')
|
||||
|
||||
test('Bundled package should work', (t) => {
|
||||
test('Bundled package should work', (t, done) => {
|
||||
t.plan(4)
|
||||
fastifySuccess.ready((err) => {
|
||||
t.error(err)
|
||||
t.assert.ifError(err)
|
||||
fastifySuccess.inject(
|
||||
{
|
||||
method: 'GET',
|
||||
url: '/'
|
||||
},
|
||||
(error, res) => {
|
||||
t.error(error)
|
||||
t.equal(res.statusCode, 200)
|
||||
t.same(res.json(), { hello: 'world' })
|
||||
t.assert.ifError(error)
|
||||
t.assert.strictEqual(res.statusCode, 200)
|
||||
t.assert.deepStrictEqual(res.json(), { hello: 'world' })
|
||||
done()
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
test('Bundled package should not work with bad plugin version', (t) => {
|
||||
test('Bundled package should not work with bad plugin version', (t, done) => {
|
||||
t.plan(1)
|
||||
fastifyFailPlugin.ready((err) => {
|
||||
t.match(err.message, /expected '9.x' fastify version/i)
|
||||
t.assert.match(err.message, /expected '9.x' fastify version/i)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
2
backend/node_modules/fastify/test/bundler/esbuild/package.json
generated
vendored
2
backend/node_modules/fastify/test/bundler/esbuild/package.json
generated
vendored
@@ -5,6 +5,6 @@
|
||||
"test": "npm run bundle && node bundler-test.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"esbuild": "^0.14.11"
|
||||
"esbuild": "^0.25.0"
|
||||
}
|
||||
}
|
||||
|
||||
19
backend/node_modules/fastify/test/bundler/webpack/bundler-test.js
generated
vendored
19
backend/node_modules/fastify/test/bundler/webpack/bundler-test.js
generated
vendored
@@ -1,31 +1,32 @@
|
||||
'use strict'
|
||||
|
||||
const t = require('tap')
|
||||
const test = t.test
|
||||
const { test } = require('node:test')
|
||||
const fastifySuccess = require('./dist/success')
|
||||
const fastifyFailPlugin = require('./dist/failPlugin')
|
||||
|
||||
test('Bundled package should work', (t) => {
|
||||
test('Bundled package should work', (t, done) => {
|
||||
t.plan(4)
|
||||
fastifySuccess.ready((err) => {
|
||||
t.error(err)
|
||||
t.assert.ifError(err)
|
||||
fastifySuccess.inject(
|
||||
{
|
||||
method: 'GET',
|
||||
url: '/'
|
||||
},
|
||||
(error, res) => {
|
||||
t.error(error)
|
||||
t.equal(res.statusCode, 200)
|
||||
t.same(res.json(), { hello: 'world' })
|
||||
t.assert.ifError(error)
|
||||
t.assert.strictEqual(res.statusCode, 200)
|
||||
t.assert.deepStrictEqual(res.json(), { hello: 'world' })
|
||||
done()
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
test('Bundled package should not work with bad plugin version', (t) => {
|
||||
test('Bundled package should not work with bad plugin version', (t, done) => {
|
||||
t.plan(1)
|
||||
fastifyFailPlugin.ready((err) => {
|
||||
t.match(err.message, /expected '9.x' fastify version/i)
|
||||
t.assert.match(err.message, /expected '9.x' fastify version/i)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user