统一项目路径并修复虚拟环境引用
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { JSDOM, ResourceLoader } from 'jsdom';
|
||||
import { patchEnvironment } from './scripts/jsdom-patch-env.mjs';
|
||||
|
||||
const ROOT = '/Users/yml/codes/douyu_login_py';
|
||||
// Resolve the repository from this file so the probe works after a checkout
|
||||
// is renamed or moved to another host.
|
||||
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../..');
|
||||
const taskId = process.argv[2] || '142265ef3d874ce6';
|
||||
const out = `${ROOT}/data/yyb-worker-dev/${taskId}/jsdom-order`;
|
||||
const goodsUrl = JSON.parse(fs.readFileSync(`${out}/device-fp.json`, 'utf8')).goods_url;
|
||||
const pageInfoPath = process.argv[3] || `${out}/web-page-info-response.json`;
|
||||
const out = path.join(ROOT, 'data', 'yyb-worker-dev', taskId, 'jsdom-order');
|
||||
const goodsUrl = JSON.parse(fs.readFileSync(path.join(out, 'device-fp.json'), 'utf8')).goods_url;
|
||||
const pageInfoPath = process.argv[3] || path.join(out, 'web-page-info-response.json');
|
||||
const pageInfo = fs.existsSync(pageInfoPath)
|
||||
? fs.readFileSync(pageInfoPath, 'utf8')
|
||||
: '{"ret":0,"msg":"","info":{}}';
|
||||
@@ -14,7 +18,7 @@ const pageInfo = fs.existsSync(pageInfoPath)
|
||||
const captured = [];
|
||||
const requests = [];
|
||||
const pageErrors = [];
|
||||
const dom = new JSDOM(fs.readFileSync(`${out}/goods.html`, 'utf8'), {
|
||||
const dom = new JSDOM(fs.readFileSync(path.join(out, 'goods.html'), 'utf8'), {
|
||||
url: goodsUrl,
|
||||
referrer: 'https://z.iwan.yyb.qq.com/',
|
||||
pretendToBeVisual: true,
|
||||
|
||||
Reference in New Issue
Block a user