Skip to content

No coverage report generated when used with @embroider/compat@^2.1.0 #374

Closed

Description

@ArnaudWeyts
  • ember-cli version: ~4.8.0
  • ember-cli-code-coverage version: 2.0.0-beta-5,
  • @embroider/compat version: 2.1.0 and up
  • @embroider/core version: ^2.1.1
  • @embroider/webpack version: ^2.1.1

I've noticed that with starting from @embroider/compat@2.1.0, the code coverage report no longer gets generated. The test build still success, but nothing is outputted in the log and no /coverage folder is generated.

Once I downgrade @embroider/compat@2.0.2, everything seems to work again.

Activity

  1. AmauryD commented on Feb 18, 2023

    @AmauryD
    Contributor

    Same problem here. Nothing is generated when @embroider/compat is at version ~2.1.0.

    When downgrading, the coverage folder is only generated when using COVERAGE=true ember s and then going to http://localhost:4200/tests.
    Doing COVERAGE=true ember test does not generate the coverage folder.

    Repro repository: https://github.com/TRIPTYK/ember-boilerplate .

    • "ember-source": "~4.10.0"
    • "ember-cli-code-coverage": "2.0.0"
    • "@embroider/compat": "~2.1.1"
    • "@embroider/core": "~2.1.1"
    • "@embroider/router": "~2.0.0"
    • "@embroider/webpack": "~2.1.1"
  2. elidupuis commented on Mar 22, 2023

    @elidupuis

    Just ran into this issue as well after upgrading embroider to 2.1.1 and ember-cli-code-coverage to 2.0.0. Reverting the embroider packages to ~2.0.2 appears to fix it for now.

    Note that, for me, after reverting embroider everything is generated properly regardless of the command:

  3. AmauryD commented on Mar 28, 2023

    @AmauryD
    Contributor

    Doing COVERAGE=true ember test does not generate the coverage folder.

    This problem was on my side. There was a misconfiguration of a service worker. It now works when downgrading to ~2.0.2.

  4. tniezurawski commented on May 19, 2023

    @tniezurawski

    Same here. I guess the changelog might help to understand where the issue came from:

    image

    Does anything ring a bell to anyone?

  5. AmauryD commented on May 19, 2023

    @AmauryD
    Contributor

    After some digging in Embroider and Ember-cli-code-coverage, I found the problem. (thanks @tniezurawski for the idea to look at the diff between the 2 releases).

    The culprit is this line : https://github.com/embroider-build/embroider/blob/34fec6c15b65ed79a31b9ad9066b5b0004cd4876/packages/compat/src/default-pipeline.ts#L20

    Internally, ember-cli-code-coverage uses stableWorkspaceDir from @embroider/compat 0.x for getting the CWD generated by embroider. This method uses a md5 hash to get a semi-random project directory. But the method has changed in @embroider/compat 2.1.0 with a new environment parameter added to the hash. This mismatch in the function implementation will result in a wrong directory guess from ember-cli-code-coverage.

    Maybe making @embroider/compat an optionalPeerDependency will solve the problem. The idea is to always have the same resolution mechanism than the installed embroider version. I will make a PR shortly.

  6. tniezurawski commented on May 22, 2023

    @tniezurawski

    @AmauryD That makes sense! I had a feeling that hashing can play a role here.

    btw I wanted to try your chance to confirm it works for me, but I am getting an error:

    COVERAGE=true ember test
    Environment: test
    cleaning up...
    Cleanup error.
    ⠋ cleaning upCannot read properties of undefined (reading 'cleanup')

    Stack Trace and Error Report: /var/folders/d8/h8767lqn0jb3h53qj9v70_l80000gn/T/error.dump.4b81903fd3192063fd5d54a0eba84752.log
    Cannot find module 'ember-cli-code-coverage'
    Require stack:

    • /Users/PATH_TO_PROJECT/ember-cli-build.js

    Do you know if I pointed to the fork in the wrong way or if that's something else? 🤔 (it's installing without problems)

    "ember-cli-code-coverage": "github:AmauryD/ember-cli-code-coverage#master",

  7. AmauryD commented on May 22, 2023

    @AmauryD
    Contributor

    I'm using "ember-cli-code-coverage": "file:../amaury-ember-cli-code-coverage/packages/ember-cli-code-coverage" for testing.
    I think the github link does not work because the real package is in packages/ember-cli-code-coverage.

  8. mansona commented on May 22, 2023

    @mansona
    Collaborator

    Does #379 fix this? Does anyone know? or is it not just because of a mismatch of embroider versions?

  9. tniezurawski commented on May 22, 2023

    @tniezurawski

    @AmauryD That works for me 👍 The report is generated.

    @mansona #379 doesn't fix it for me. Actually, I'm getting an error that I don't observe on version 2.0.0 of ember-cli-code-coverage:

    Cannot read properties of undefined (reading 'cleanup')

    Stack Trace and Error Report: /var/folders/d8/h8767lqn0jb3h53qj9v70_l80000gn/T/error.dump.a194e2bae6ccc119c6ef41ed659b8792.log
    The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined

    Stack Trace and Error Report: /var/folders/d8/h8767lqn0jb3h53qj9v70_l80000gn/T/error.dump.c50bde80232c21ff2c1df26192fec2f5.log

    I'm not sure what is the direct reason 🤷‍♂️

  10. mansona commented on May 23, 2023

    @mansona
    Collaborator

    @tniezurawski I just noticed that my PR is out of date now so it wouldn't have the effect of making sure to use the right embroider version since 3.0 was released 🙈

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions