Skip to content

source map support in coverage reports #867

Closed

Description

@Toxicable

🚀 feature request

Relevant Rules

jasmine_node_test

Description

We should still use v8-coverage to collect coverage reports without having to fork the process.
However, c8 and transitively v8-to-istanbul provide better reporting due to having source map support and more up to date istanbul deps.

Activity

  1. Toxicable commented on Jun 15, 2019

    @Toxicable
    Author

    This however is blocked on #823
    Since the source map lib needs to resolve the souce map back to the source file from the executed file.

    Also blocked on and istanbuljs/v8-to-istanbul#31

  2. Toxicable commented on Jun 15, 2019

    @Toxicable
    Author

    Aside from the blocking issues it's minor changes needed on our side so just going to document that here for now:

            const Report = require('c8/lib/report');
            fs.mkdirpSync(path.join(covDir, 'tmp'));
            // we have to write it in a top level result object since thats what the lib expecets
            fs.writeFileSync(path.join(covDir, 'tmp', 'coverage-final.json'), JSON.stringify({result: sourceCoverge}));
    
            const report = Report({
              reportsDirectory: covDir,
              tempDirectory: path.join(covDir, 'tmp'),
              reporter: ['text', 'text-summary', 'html'],
              exclude: ['**/node_modules/**'],
            });
    
  3. Toxicable commented on Jun 17, 2019

    @Toxicable
    Author

    I think the best way to handle this would be to add a coverage flag to nodejs_binary which would then internally set the NODE_V8_COVERAGE to a dir where the collection will be written.
    We need to do this at a nodejs_binary level so that we don't have to use the inspector api and so that we don't have to use a fork later on.

    We'll still need to handle the reporting at the end of jasmine_node_test.

    However, if we switched to c8 for reporting and transitively v8-to-istanbul we'd need the source maps situation to be fixed, since they are unable to resolve our source files in the current setup.
    As mentioned above.
    Which is the same issue here: #823

  4. thesayyn commented on Jul 25, 2019

    @thesayyn
    Collaborator

    Hello @Toxicable is there any update on this

  5. Toxicable commented on Jul 25, 2019

    @Toxicable
    Author

    @thesayyn Yeah so I know what needs to be done to make this change
    However due to #823 the result will be broken since our source maps don't map back to sources correctly and after talking with @alexeagle I don't know if there is actually a solution to that problem.

    So untill we figure out source maps properly, this is blocked

  6. changed the title [-]switch jasmine_node_test from v8-coverage to c8 for reporting[/-] [+]source map support in coverage reports[/+] on Sep 18, 2019
  7. sjoerdvisscher commented on Sep 2, 2020

    @sjoerdvisscher

    Hi, @Toxicable, the issues you point to here are now closed. Does this mean this issue has a chance to progress?

  8. sjoerdvisscher commented on Sep 3, 2020

    @sjoerdvisscher

    I have working TS coverage now with two patches:

    1. feat: add support for 1:1 sourcesContent istanbuljs/v8-to-istanbul#115 (This prevents c8 from reading from the invalid source location) Add "resolutions": { "v8-to-istanbul": "6.0.0" } to package.json to apply this.
    2. patching lcov_merger-js to replace SF:../../../ with SF: in lcov.info
  9. github-actions commented on Dec 3, 2020

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had any activity for 90 days. It will be closed if no further activity occurs in two weeks. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs!

  10. added
    Can Close?
    on Dec 3, 2020
  11. github-actions commented on Dec 17, 2020

    @github-actions
    Contributor

    This issue was automatically closed because it went two weeks without a reply since it was labeled "Can Close?"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Can Close?blocked

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions