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

Commit

Permalink
chore(bench): Fix imports in benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed Nov 2, 2021
1 parent 4801e4d commit f8afdbb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions bench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"license": "MIT",
"dependencies": {
"benchmark": "^2.1.4",
"human-format": "^0.7.0",
"node-memwatch": "^1.0.1",
"human-format": "^0.11.0",
"parse5": "*",
"promisify-event": "^1.0.0"
}
Expand Down
7 changes: 4 additions & 3 deletions bench/perf/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import Benchmark from 'benchmark';
import { loadTreeConstructionTestData } from '../../test/utils/generate-parsing-tests.js';
import { loadSAXParserTestData } from '../../test/utils/load-sax-parser-test-data.js';
import { treeAdapters, WritableStreamStub } from '../../test/utils/common.js';
import parse5 from '../../packages/parse5/lib/index.js';
import parse5Stream from '../../packages/parse5-parser-stream/lib/index.js';
import * as parse5 from '../../packages/parse5/lib/index.js';
import { ParserStream as parse5Stream } from '../../packages/parse5-parser-stream/lib/index.js';
import parse5Upstream from 'parse5';
import path from 'path';

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

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

// Utils
function getHz(suite, testName) {
Expand Down
4 changes: 2 additions & 2 deletions test/utils/generate-parsing-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ export function loadTreeConstructionTestData(dataDirs, treeAdapter) {

dataDirs.forEach((dataDirPath) => {
const testSetFileNames = fs.readdirSync(dataDirPath);
const dirName = path.basename(dataDirPath);
const dirName = path.basename(dataDirPath.pathname);

testSetFileNames.forEach((fileName) => {
if (path.extname(fileName) !== '.dat') {
return;
}

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

Expand Down

0 comments on commit f8afdbb

Please sign in to comment.