Skip to content

Commit

Permalink
Merge pull request #12838 from Automattic/vkarpov15/gh-12770
Browse files Browse the repository at this point in the history
chore: fix typescript benchmarks by removing ts-benchmark
  • Loading branch information
vkarpov15 committed Dec 28, 2022
2 parents 2aa009b + 6a8aee9 commit d9ae2dc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/benchmark.yml
Expand Up @@ -34,10 +34,4 @@ jobs:

- run: node ./scripts/create-tarball.js

- run: npm install
working-directory: benchmarks/typescript/simple

- run: npx ts-benchmark -p ./ -f 17/110000 18 29 32 -b master -g -t --colors
working-directory: benchmarks/typescript/simple
env:
DB_URL: ${{ secrets.DB_URL }}
- run: npm run ts-benchmark
5 changes: 4 additions & 1 deletion benchmarks/typescript/simple/package.json
@@ -1,6 +1,9 @@
{
"dependencies": {
"mongoose": "file:../../../mongoose.tgz",
"typescript": "4.8.x"
"typescript": "4.9.x"
},
"scripts": {
"benchmark": "tsc --extendedDiagnostics"
}
}
6 changes: 2 additions & 4 deletions package.json
Expand Up @@ -61,9 +61,8 @@
"q": "1.5.1",
"sinon": "15.0.0",
"stream-browserify": "3.0.0",
"ts-benchmark": "^1.1.10",
"tsd": "0.25.0",
"typescript": "4.8.4",
"typescript": "4.9.4",
"uuid": "9.0.0",
"webpack": "5.75.0"
},
Expand Down Expand Up @@ -100,8 +99,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/110000 18 29 32",
"ts-benchmark-watch": "ts-benchmark -p ./benchmarks/typescript/simple -w ./types -i -s -f 17/100000 18 29 32 -b master"
"ts-benchmark": "cd ./benchmarks/typescript/simple && npm install && npm run benchmark | node ../../../scripts/tsc-diagnostics-check"
},
"main": "./index.js",
"types": "./types/index.d.ts",
Expand Down
15 changes: 15 additions & 0 deletions scripts/tsc-diagnostics-check.js
@@ -0,0 +1,15 @@
'use strict';

const fs = require('fs');

const stdin = fs.readFileSync(0).toString('utf8');
const maxInstantiations = isNaN(process.argv[2]) ? 100000 : parseInt(process.argv[2], 10);

console.log(stdin);

const numInstantiations = parseInt(stdin.match(/Instantiations:\s+(\d+)/)[1], 10);
if (numInstantiations > maxInstantiations) {
throw new Error(`Instantiations ${numInstantiations} > max ${maxInstantiations}`);
}

process.exit(0);

0 comments on commit d9ae2dc

Please sign in to comment.