Skip to content
This repository was archived by the owner on Mar 24, 2022. It is now read-only.

Commit f8afdbb

Browse files
committed
chore(bench): Fix imports in benchmarks
1 parent 4801e4d commit f8afdbb

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

bench/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
"license": "MIT",
88
"dependencies": {
99
"benchmark": "^2.1.4",
10-
"human-format": "^0.7.0",
11-
"node-memwatch": "^1.0.1",
10+
"human-format": "^0.11.0",
1211
"parse5": "*",
1312
"promisify-event": "^1.0.0"
1413
}

bench/perf/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import Benchmark from 'benchmark';
33
import { loadTreeConstructionTestData } from '../../test/utils/generate-parsing-tests.js';
44
import { loadSAXParserTestData } from '../../test/utils/load-sax-parser-test-data.js';
55
import { treeAdapters, WritableStreamStub } from '../../test/utils/common.js';
6-
import parse5 from '../../packages/parse5/lib/index.js';
7-
import parse5Stream from '../../packages/parse5-parser-stream/lib/index.js';
6+
import * as parse5 from '../../packages/parse5/lib/index.js';
7+
import { ParserStream as parse5Stream } from '../../packages/parse5-parser-stream/lib/index.js';
88
import parse5Upstream from 'parse5';
9+
import path from 'path';
910

1011
const hugePagePath = new URL('../../test/data/huge-page/huge-page.html', import.meta.url);
1112
const treeConstructionPath = new URL('../../test/data/html5lib-tests/tree-construction', import.meta.url);
@@ -52,7 +53,7 @@ global.runPages = function (parser) {
5253
};
5354

5455
// Stream data
55-
global.files = readdirSync(saxPath).map((dirName) => new URL('./src.html', dirName).pathname);
56+
global.files = readdirSync(saxPath).map((dirName) => path.join(saxPath.pathname, dirName, './src.html'));
5657

5758
// Utils
5859
function getHz(suite, testName) {

test/utils/generate-parsing-tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ export function loadTreeConstructionTestData(dataDirs, treeAdapter) {
1010

1111
dataDirs.forEach((dataDirPath) => {
1212
const testSetFileNames = fs.readdirSync(dataDirPath);
13-
const dirName = path.basename(dataDirPath);
13+
const dirName = path.basename(dataDirPath.pathname);
1414

1515
testSetFileNames.forEach((fileName) => {
1616
if (path.extname(fileName) !== '.dat') {
1717
return;
1818
}
1919

20-
const filePath = path.join(dataDirPath, fileName);
20+
const filePath = path.join(dataDirPath.pathname, fileName);
2121
const testSet = fs.readFileSync(filePath, 'utf-8');
2222
const setName = fileName.replace('.dat', '');
2323

0 commit comments

Comments
 (0)