]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - scripts/benchmark.ts
Use node 14 for lighthouse
[github/Chocobozzz/PeerTube.git] / scripts / benchmark.ts
index 071c4dea7c639042fac715e83c085123f1efa2ec..788318313ffe84976837468b1e393095b9f2d96b 100644 (file)
@@ -1,10 +1,10 @@
-import * as autocannon from 'autocannon'
+import { registerTSPaths } from '../server/helpers/register-ts-paths'
+registerTSPaths()
+
+import autocannon, { printResult } from 'autocannon'
 import { writeJson } from 'fs-extra'
 import { createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
 import { Video, VideoPrivacy } from '@shared/models'
-import { registerTSPaths } from '../server/helpers/register-ts-paths'
-
-registerTSPaths()
 
 let server: PeerTubeServer
 let video: Video
@@ -135,7 +135,7 @@ async function run () {
       title: 'API - config',
       path: '/api/v1/config',
       expecter: (body, status) => {
-        return status === 200 && body.startsWith('{"instance":')
+        return status === 200 && body.startsWith('{"client":')
       }
     }
   ]
@@ -149,7 +149,7 @@ async function run () {
     Object.assign(testResult, { title: test.title, path: test.path })
     finalResult.push(testResult)
 
-    console.log(autocannon.printResult(testResult))
+    console.log(printResult(testResult))
   }
 
   if (outfile) await writeJson(outfile, finalResult)
@@ -232,7 +232,7 @@ async function prepare () {
   }
 
   for (const caption of [ 'ar', 'fr', 'en', 'zh' ]) {
-    await server.captions.createVideoCaption({
+    await server.captions.add({
       language: caption,
       videoId: video.id,
       fixture: 'subtitle-good2.vtt'