fix: 单元测试问题修复

This commit is contained in:
binaryify
2023-09-09 18:15:10 +08:00
parent 2e933b3d61
commit 7fe9d36b73
3 changed files with 11 additions and 9 deletions

View File

@ -1,10 +1,12 @@
const fs = require('fs')
const path = require('path')
const serverMod = require('./server')
const tmpPath = require('os').tmpdir()
/** @type {import("express").Express & serverMod.ExpressExtension} */
let app
if (!fs.existsSync(path.resolve(tmpPath, 'anonymous_token'))) {
fs.writeFileSync(path.resolve(tmpPath, 'anonymous_token'), '', 'utf-8')
}
const serverMod = require('./server')
before(async () => {
app = await serverMod.serveNcmApi({})