From e2b2c463398375cda10bd3cac03898d06e373b8b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 23 Feb 2024 16:29:52 +0100 Subject: [PATCH] Fix tests --- .mocharc.cjs | 2 +- packages/tests/src/shared/webtorrent.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.mocharc.cjs b/.mocharc.cjs index 784465248..a9ed4037c 100644 --- a/.mocharc.cjs +++ b/.mocharc.cjs @@ -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" ], diff --git a/packages/tests/src/shared/webtorrent.ts b/packages/tests/src/shared/webtorrent.ts index 1be54426a..c226fd243 100644 --- a/packages/tests/src/shared/webtorrent.ts +++ b/packages/tests/src/shared/webtorrent.ts @@ -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) } // ---------------------------------------------------------------------------