Fix tests

This commit is contained in:
Chocobozzz 2024-02-23 16:29:52 +01:00
parent 0eff76f800
commit e2b2c46339
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 4 additions and 3 deletions

View File

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

View File

@ -1,6 +1,5 @@
import { expect } from 'chai'
import { readFile } from 'fs/promises'
import parseTorrent from 'parse-torrent'
import { basename, join } from 'path'
import type { Instance, Torrent } from 'webtorrent'
import { VideoFile } from '@peertube/peertube-models'
@ -26,7 +25,9 @@ export async function parseTorrentVideo (server: PeerTubeServer, file: VideoFile
const data = await readFile(torrentPath)
return parseTorrent(data)
// FIXME: use classic import, on node 18.18 we have an error
// "[ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in .../node_modules/parse-torrent/package.json"
return require('parse-torrent')(data)
}
// ---------------------------------------------------------------------------