Comments (5)
thanks a lot!! I also have it in English on that channel o/
from poku.
from poku.
Thanks, @1NxT 🚀
I think (0.000000ms)
should be good.
The idea would be:
- If the user use
test
, it will show the execution time for eachtest
performed - At the end of each file (using
test
method or not), it will show the total for each file - On exit, it will show the final total of the tests
It's important to note that Poku's assert
simplify the test process by turning test
, describe
and it
in a simple assert(true, "Describing it")
, so it's not necessary to include an execution time for each assertion 🙋🏻♂️
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 test
, file and total execution times:
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 🤝
from poku.
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.
from poku.
I was reading the code trying console log the time
@1NxT, I believe that perf_hooks
would be a good approach (I didn't get to try it):
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
Note to self
It would be interesting not to affect the execution time of the test itself with the Poku process, but we could think about this later.
from poku.
Related Issues (9)
- File path is not parsed when using assert with Bun
- Support for custom permissions when using Deno
- Allow to limit concurrency in parallel runs
- Improve logs for RegExp and Functions inside arrays
- Transparency: Codecov isn't in line with reality HOT 1
- startScript doesn't end on Bun and Deno HOT 9
- Falha ao rodar os testes no Bun HOT 2
- Interoperability with native Node.js test, describe and it
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from poku.