CodSpeedHQ / codspeed-node

Node.js libraries to create CodSpeed benchmarks
https://codspeed.io
Apache License 2.0
11 stars 2 forks source link

fix: fix file path when running in ESM #10

Closed art049 closed 1 year ago

art049 commented 1 year ago

Before:

[CodSpeed] running with @codspeed/tinybench v1.1.0
    ✔ Measured file:/home/arthur/Projects/arthur-node-test/tests/bench.mjs::test_recursive_fibo_10
    ✔ Measured file:/home/arthur/Projects/arthur-node-test/tests/bench.mjs::test_recursive_fibo_20
    ✔ Measured file:/home/arthur/Projects/arthur-node-test/tests/bench.mjs::test_recursive_cached_fibo_10
    ✔ Measured file:/home/arthur/Projects/arthur-node-test/tests/bench.mjs::test_recursive_cached_fibo_100
    ✔ Measured file:/home/arthur/Projects/arthur-node-test/tests/bench.mjs::test_recursive_cached_fibo_1000

After:

[CodSpeed] running with @codspeed/tinybench v1.1.0
    ✔ Measured tests/bench.mjs::test_recursive_fibo_10
    ✔ Measured tests/bench.mjs::test_recursive_fibo_20
    ✔ Measured tests/bench.mjs::test_recursive_cached_fibo_10
    ✔ Measured tests/bench.mjs::test_recursive_cached_fibo_20

@adriencaccia I'm gonna merge this now. But maybe we could add some tests to check this behavior. Do you now an easy way to run jest both in CJS & ESM ?

codspeed-hq[bot] commented 1 year ago

CodSpeed Performance Report

Merging #10 fix/esm-path (a2d0d88) will not alter performances.

Summary

🔥 0 improvements ❌ 0 regressions ✅ 4 untouched benchmarks

🆕 0 new benchmarks ⁉️ 0 dropped benchmarks

adriencaccia commented 1 year ago

@adriencaccia I'm gonna merge this now. But maybe we could add some tests to check this behavior. Do you now an easy way to run jest both in CJS & ESM ?

This should do the trick https://jestjs.io/docs/ecmascript-modules