Skip to content

Commit

Permalink
chore: use benchmarks/typescript.js for now so we can fail if instant…
Browse files Browse the repository at this point in the history
…iations >= 100k

Re: #12037
Re: #11798
  • Loading branch information
vkarpov15 committed Jul 7, 2022
1 parent 0f32327 commit e324006
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions benchmarks/typescript.js
Expand Up @@ -21,6 +21,8 @@ async function run() {

const tsProjectsDirectories = await fs.readdir('benchmarks/typescript');

let failed = [];

for (const tsProjectDirectory of tsProjectsDirectories) {
let instantiations = 0;
let memoryUsed = 0;
Expand Down Expand Up @@ -62,11 +64,19 @@ async function run() {
totalTime,
testName: tsProjectDirectory
});

if (instantiations >= 100000) {
failed.push(tsProjectDirectory);
}
}

await persist({ results });

await mongoose.disconnect();

if (failed.length > 0) {
throw new Error(`Benchmarks ${failed.join(', ')} had over 100k instantiations`);
}
}

async function persist({ results }) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -98,7 +98,7 @@
"test-tsd": "node ./test/types/check-types-filename && tsd",
"tdd": "mocha ./test/*.test.js --inspect --watch --recursive --watch-files ./**/*.{js,ts}",
"test-coverage": "nyc --reporter=html --reporter=text npm test",
"ts-benchmark": "ts-benchmark -p ./benchmarks/typescript/simple -f 17 18 29 32",
"ts-benchmark": "node ./benchmarks/typescript.js",
"ts-benchmark-watch": "ts-benchmark -p ./benchmarks/typescript/simple -w ./types -i -s -f 17 18 29 32 -b master"
},
"main": "./index.js",
Expand Down

0 comments on commit e324006

Please sign in to comment.