Browse Source

Fix tests

Chocobozzz 2 months ago
parent
commit
e2b2c46339
2 changed files with 4 additions and 3 deletions
  1. 1 1
      .mocharc.cjs
  2. 3 2
      packages/tests/src/shared/webtorrent.ts

+ 1 - 1
.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"
   ],

+ 3 - 2
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)
 }
 
 // ---------------------------------------------------------------------------