Projektstart

This commit is contained in:
2026-01-22 15:49:12 +01:00
parent 7212eb6f7a
commit 57e5f652f8
10637 changed files with 2598792 additions and 64 deletions

View File

@@ -0,0 +1,35 @@
'use strict'
const t = require('tap')
const test = t.test
const fs = require('node:fs')
const path = require('node:path')
const { code } = require('../../build/build-error-serializer')
function unifyLineBreak (str) {
return str.toString().replace(/\r\n/g, '\n')
}
test('check generated code syntax', async (t) => {
t.plan(1)
// standard is a esm, we import it like this
const { default: standard } = await import('standard')
const result = await standard.lintText(code)
// if there are any invalid syntax
// fatal count will be greater than 0
t.equal(result[0].fatalErrorCount, 0)
})
const isPrepublish = !!process.env.PREPUBLISH
test('ensure the current error serializer is latest', { skip: !isPrepublish }, async (t) => {
t.plan(1)
const current = await fs.promises.readFile(path.resolve('lib/error-serializer.js'))
// line break should not be a problem depends on system
t.equal(unifyLineBreak(current), unifyLineBreak(code))
})

View File

@@ -0,0 +1,15 @@
'use strict'
const fs = require('node:fs')
const path = require('node:path')
const t = require('tap')
const test = t.test
const fastify = require('../../fastify')()
test('should be the same as package.json', t => {
t.plan(1)
const json = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'package.json')).toString('utf8'))
t.equal(fastify.version, json.version)
})