question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test coverage for a custom test library (like postman) ?

See original GitHub issue

Hi, thanks for such a piece of work !

I didn’t really understood how to do that:

  • I have a nodeJS process running on localhost:9999
  • I have a custom test library that are targeting routes of an express api (same behaviour than postman)
  • I run my tests like "nyc npm run test-api" and test-api is node -e 'require(./core-scripts)(run-tests)'

Here is my config:

module.exports = {
    all: true,
    include: ['**/server/**/*'],
    exclude: ['*.spec.js'],
    reporter: ['json-summary', 'text'],
    'report-dir': './.jarvis'
};

And here is a sample of my report:

image

Can you help me understand why all is red and to 0 ?

Thanks for your lights 😃

EDIT: now I understand that it is not working because the server is not started with nyc command. How may I do that ? And how to output the coverage report ?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
fasatrixcommented, Oct 3, 2019

Hi there, you should ask a developer to help you if you feel that you need to as it is not only about running a command (npx nyc instrument src instrumented --compact=false **** assuming that your source code is in the “src” folder and you want the output to be in the “instrumented folder”), but the application after that will need to be serving the instrumented folder which means it will have to run no the original source code but instrumented one … then you run your test against that and the report will be created

1reaction
fasatrixcommented, Oct 5, 2019

Much more clear to me now 😃 Could be good to have this concept explained in the doc also.

Thank you very much 😃

Glad it helped 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

9 Best Code Coverage Tools for Java, Python, C, C++, C# ...
NET code coverage according to your customized needs; Helps you to test, track and manage a unified coverage number across entire teams ...
Read more >
Writing tests
Tests confirm that your API is working as expected, that integrations ... Use snippets from the right pane to add a test or...
Read more >
20 Most Popular Unit Testing Tools in 2023
List and comparison of the best Unit Testing Tools. Here is the list of top Unit Testing Frameworks used by developers to create...
Read more >
API Testing: Approaches, Tools, and Frameworks
API testing kills bugs early in the development cycle. How to test APIs, which tool to use: Postman, Rest Assured, or jMeter, why...
Read more >
Building A Scalable API Testing Framework With Jest And ...
Adding a new test requires editing in Postman, saving it in the ... test results; coverageDirectory: creates a custom directory for coverage reports ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found