Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ArnaudWeyts opened this issue Feb 17, 2023 · 10 comments · Fixed by #382
Closed

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

ArnaudWeyts opened this issue Feb 17, 2023 · 10 comments · Fixed by #382

Comments

@ArnaudWeyts
Copy link

  • 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.

@AmauryD
Copy link
Contributor

AmauryD commented Feb 18, 2023

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"

@elidupuis
Copy link

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:

@AmauryD
Copy link
Contributor

AmauryD commented Mar 28, 2023

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.

@tniezurawski
Copy link

tniezurawski commented May 19, 2023

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

image

Does anything ring a bell to anyone?

@AmauryD
Copy link
Contributor

AmauryD commented May 19, 2023

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.

@tniezurawski
Copy link

@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",

@AmauryD
Copy link
Contributor

AmauryD commented May 22, 2023

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.

@mansona
Copy link
Collaborator

mansona commented May 22, 2023

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

@tniezurawski
Copy link

@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 🤷‍♂️

@mansona
Copy link
Collaborator

mansona commented May 23, 2023

@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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants