简体   繁体   中英

Test coverage reports with Bazel + Typescript + Jest

I'm working on converting a Node.js library to use Bazel as the build system. So far I have managed to get my TS rules and a basic Jest test execution to work. You can my setup here:

https://github.com/lqc/bazel-examples/tree/master/nodejs_typescript_runnable

So running bazel test //app:test gives me a proper Junit report in bazel-testlogs .

Running bazel coverage //app:test runs the tests, but doesn't produce the LCOV report I would expect.

As far as I could tell, Bazel uses the C8 NPM package to enable the built-in coverage functionality in V8 (I had to add it to my dependencies). At the same time, Jest also has the option to use V8 as a coverage provider.

Should I configure this in Jest? Disable it in Jest? I would be totally fine with configuring this in Jest, but I don't see a way to disable the logic in Bazel around it.

I am sure you have forgotten to commit something, because of closing braces. Check below patch

--- a/nodejs_typescript_runnable/app/tests/some.spec.ts
+++ b/nodejs_typescript_runnable/app/tests/some.spec.ts
@@ -5,5 +5,5 @@ describe("Test suite", () => {
         run();
         expect(true).toBeTruthy();
-    });
+    })});

Just one question, how can we add a single npm package (no further dependencies) to this project

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM