Fix typescript tests

This commit is contained in:
Chocobozzz 2024-02-23 08:33:01 +01:00
parent 007b845cab
commit db06d13c67
No known key found for this signature in database
GPG key ID: 583A612D890159BE
6 changed files with 12 additions and 13 deletions

View file

@ -2,7 +2,7 @@ process.env.TSX_TSCONFIG_PATH = './packages/tests/tsconfig.json'
module.exports = {
"node-option": [
"loader=tsx",
"import=tsx",
"no-warnings",
"conditions=peertube:tsx"
],

View file

@ -244,7 +244,7 @@
"swagger-cli": "^4.0.2",
"tsc-watch": "^6.0.0",
"tsx": "^4.7.1",
"typescript": "~5.3.3"
"typescript": "~5.2"
},
"bundlewatch": {
"files": [

View file

@ -1,5 +1,5 @@
import { expect } from 'chai'
import { wait } from '@peertube/peertube-core-utils'
import { arrayify, wait } from '@peertube/peertube-core-utils'
import { JobState, JobType, RunnerJobState } from '@peertube/peertube-models'
import { PeerTubeServer } from './server.js'
@ -16,10 +16,7 @@ async function waitJobs (
? parseInt(process.env.NODE_PENDING_JOB_WAIT, 10)
: 250
let servers: PeerTubeServer[]
if (Array.isArray(serversArg) === false) servers = [ serversArg ]
else servers = serversArg
const servers = arrayify(serversArg)
const states: JobState[] = [ 'waiting', 'active' ]
if (!skipDelayed) states.push('delayed')

View file

@ -1,5 +1,7 @@
import MarkdownItClass from 'markdown-it'
import markdownItEmoji from 'markdown-it-emoji/lib/light.mjs'
// FIXME: use direct import: import markdownItEmoji from 'markdown-it-emoji/lib/light.mjs' if it improves perf'
// when https://github.com/privatenumber/tsx/issues/334 is fixed
import { light as markdownItEmoji } from 'markdown-it-emoji'
import sanitizeHtml from 'sanitize-html'
import { getDefaultSanitizeOptions, getTextOnlySanitizeOptions, TEXT_WITH_HTML_RULES } from '@peertube/peertube-core-utils'

View file

@ -15,7 +15,7 @@ function asyncMiddleware (fun: RequestPromiseHandler | RequestPromiseHandler[])
}
try {
for (const f of fun) {
for (const f of (fun as RequestPromiseHandler[])) {
await new Promise<void>((resolve, reject) => {
return asyncMiddleware(f)(req, res, err => {
if (err) return reject(err)

View file

@ -10264,10 +10264,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==
typescript@~5.3.3:
version "5.3.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.3.tgz#b3ce6ba258e72e6305ba66f5c9b452aaee3ffe37"
integrity sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==
typescript@~5.2:
version "5.2.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78"
integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==
uc.micro@^2.0.0:
version "2.0.0"