-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show individual and total test execution time #30
Comments
thanks a lot!! I also have it in English on that channel o/ |
Thanks, @1NxT 🚀 I think The idea would be:
It's important to note that Poku's For example: A) Shows only the file and total execution time: import { assert } from 'poku';
assert.strictEqual(1, 1, 'Describing it'); B) Shows both the import { test, assert } from 'poku';
// This should show the execution time
test(() => {
// This is just an assertion
assert.strictEqual(1, 1, 'Describing it too');
}); Feel free to discuss it 🤝 |
I was reading the code trying console log the time, I used the file parseAsssetion.ts to try to measure the time of each assert. var startTime = performance.now();
const isPoku =
typeof process.env?.FILE === 'string' && process.env?.FILE.length > 0;
const FILE = process.env.FILE;
try {
...
if (typeof options.message === 'string') {
var endTime = performance.now();
const message = isPoku
? `${format.bold(format.success(`✔ ${options.message}`))} ${format.dim(format.success(`› ${FILE}`))} ${format.dim(`(${(endTime - startTime).toFixed(6)}ms)`)}`
: format.bold(format.success(`✔ ${options.message}`)) + ` ${format.dim(`(${(endTime - startTime).toFixed(6)}ms)`)}`;
console.log(message);
} But I don't know if it's a good approach. |
@1NxT, I believe that import { performance } from 'node:perf_hooks';
const start = performance.now();
const end = performance.now();
const total = (end - start).toFixed(6); We could begin with the total time per file: Start: poku/src/services/run-test-file.ts Line 96 in 5664980
End: poku/src/services/run-test-file.ts Line 115 in 5664980
|
Inspiration
Source: https://youtu.be/iDaBo7ge604?si=x8hWjOH8ffHHOJ_6&t=2674
Credits to @ErickWendel 🇧🇷
The text was updated successfully, but these errors were encountered: