Przeglądaj źródła

playwright_server now uses playwright.json shipped

George S. Baugh 5 lat temu
rodzic
commit
94fe4808ec
1 zmienionych plików z 4 dodań i 4 usunięć
  1. 4 4
      bin/playwright_server

+ 4 - 4
bin/playwright_server

@@ -8,12 +8,12 @@ const express = require('express');
 const { chromium, firefox, webkit, devices } = require('playwright');
 
 const fs = require('fs');
+const path = require('path');
 
 // Defines our interface
-let sharedir = "%SHAREDIR%"; // This is going to be filled in via a build script
-var theFile = 'share/api.json';
-theFile = fs.existsSync(theFile) ? theFile : sharedir + '/api.json';
-let rawdata = fs.readFileSync('share/api.json');
+let sharedir = require.resolve('playwright'); // api.json should be shipped with playwright itself
+var theFile = path.dirname(sharedir) + '/api.json';
+let rawdata = fs.readFileSync(theFile);
 let spec = JSON.parse(rawdata);
 
 const argv = yargs