-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update issue template and add changesets validation, improve b…
…enchmark output (#1679)
- Loading branch information
Showing
7 changed files
with
43 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ package-lock.json | |
test-command.txt | ||
benchmark_check.md | ||
benchmark_check.json | ||
benchmark_chart.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import fs from 'node:fs'; | ||
|
||
const content = fs.readFileSync('benchmark_check.json', 'utf8'); | ||
const json = JSON.parse(content); | ||
const arr = json.results.map((r) => [ | ||
r.command.replace(/^node node_modules\/([^/]+)\/.*/, (_, cliVersion) => cliVersion), | ||
r.mean, | ||
]); | ||
const min = Math.min(...arr.map(([_, mean]) => mean)); | ||
const max = Math.max(...arr.map(([_, mean]) => mean)); | ||
|
||
const constructBarForChart = (x) => { | ||
const length = Math.floor(x * 30); | ||
return '▓' + '▓'.repeat(length); | ||
}; | ||
|
||
const output = [ | ||
'| CLI Version | Performance benchmark (test duration) |', | ||
'|---|---|', | ||
...arr.map( | ||
([cliVersion, mean]) => | ||
`| ${cliVersion} | ${constructBarForChart((mean - min) / (max - min))} |` | ||
), | ||
].join('\n'); | ||
|
||
process.stdout.write(output); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
"version": "1.0.0", | ||
"description": "Test benchmark for Redocly CLI", | ||
"scripts": { | ||
"chart": "node chart.mjs > benchmark_chart.md", | ||
"make-test": "bash make-test-command.sh" | ||
}, | ||
"dependencies": { | ||
|
@@ -26,6 +27,8 @@ | |
"cli-1.17": "npm:@redocly/[email protected]", | ||
"cli-1.18": "npm:@redocly/[email protected]", | ||
"cli-1.19": "npm:@redocly/[email protected]", | ||
"cli-1.20": "npm:@redocly/[email protected]", | ||
"cli-1.21": "npm:@redocly/[email protected]", | ||
"cli-next": "file:../redocly-cli.tgz" | ||
} | ||
} |
8d3d990
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage report
Test suite run success
765 tests passing in 108 suites.
Report generated by 🧪jest coverage report action from 8d3d990