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

fix: @ember/test-helpers setResolver or setApplication #1084

Conversation

MichalBryxi
Copy link
Contributor

@MichalBryxi MichalBryxi commented Sep 25, 2024

  • Without this patch many tests fail for me with:
Promise rejected before "can access files": 
You must set up the ember-test-helpers environment 
with either `setResolver` or `setApplication` 
before running any tests.

@MichalBryxi MichalBryxi changed the title fix: @ember/test-helpers setResolver or setApplication before run… fix: @ember/test-helpers setResolver or setApplication Sep 25, 2024
@MichalBryxi
Copy link
Contributor Author

The weird thing is that setApplication is being called:

import { setApplication } from '@ember/test-helpers';

@mkszepp
Copy link
Contributor

mkszepp commented Oct 1, 2024

I thinks this is not the correct fix...

With this change we don't test anymore test-helper v4, because it was changes in test-app.

The error occures only inside monorepos (it has no side effect in consumer apps)...

Possible fixes without downgrading in test-app:

Btw: we should add in ember-try a test for test-helper v3... i think we have forget
Addon is atm tested only against v2 and v4

MichalBryxi added a commit to MichalBryxi/ember-file-upload that referenced this pull request Oct 2, 2024
MichalBryxi added a commit to MichalBryxi/ember-file-upload that referenced this pull request Oct 2, 2024
MichalBryxi added a commit to MichalBryxi/ember-file-upload that referenced this pull request Oct 2, 2024
@MichalBryxi
Copy link
Contributor Author

Ok, I actually have no idea what is happening here nor why. Just vague sense that all these steps make it tested via ember-try in correct way against correct versions.

I did not do the "we should add in ember-try a test for test-helper v3" as I could not infer what action should be taken there.

@mkszepp I just pushed the changes in a way I understood from your description. It-s highly likely it's completely wrong so would be really glad if you'd help me out here.

@mkszepp
Copy link
Contributor

mkszepp commented Oct 8, 2024

@MichalBryxi sry for my delay... i have tested locally to reproduce the issue... It looks like the pnpm-lock.yaml is not correct and you are running for this reason into this issue...

The only thing which you need to to is:

  1. revert all changes which were done in PR (or start from master branch)
  2. remove all node_modules folders
  3. remove pnpm-lock.yaml
  4. run pnpm install

After that you can run again your tests and everything should pass...

Edit:
I have seen you have also created a PR for that: #1082 this solves everything and this PR is not anymore needed

@gilest
Copy link
Collaborator

gilest commented Oct 8, 2024

Thanks for the PR @MichalBryxi and thanks for your analysis @mkszepp

I will merge the lockfile regen PR. Hopefully this resolves the other local dev issues

Any idea how the lockfile got out of date? Perhaps I merged dependabot PRs too quickly...

…ning any tests

- Without this patch many tests fail for me with:

```
Promise rejected before "can access files": You must set up the ember-test-helpers environment with either `setResolver` or `setApplication` before running any tests.
```

- Fixes adopted-ember-addons#1083
- Might need adopted-ember-addons#1082 to be applied before this fix is useable
@MichalBryxi MichalBryxi force-pushed the mb/1082/ember-test-helpers-downgrade branch from e53ee91 to afe262d Compare October 10, 2024 06:04
@MichalBryxi
Copy link
Contributor Author

Apologies, the PR #1082 only supported this issue, not fixed it. I am used to create PRs for individual fixes.

What I'm seeing on current master is still the same issue:

Compare this to an improved situation on this branch:

@mkszepp
Copy link
Contributor

mkszepp commented Oct 10, 2024

@MichalBryxi not sure whats going wrong... but here a PR with new lock file... #1089 this solve also your issue local... just try it out (i have in last days tested and regenerated and it was working fine, local and also testes in github should pass)

@mkszepp
Copy link
Contributor

mkszepp commented Oct 10, 2024

@gilest maybe you can merge my PR, when @MichalBryxi gives a positive feedback

@MichalBryxi
Copy link
Contributor Author

Yay! 👍🏾 I can confirm that #1089 fixes this issue. Thank you!

@MichalBryxi MichalBryxi deleted the mb/1082/ember-test-helpers-downgrade branch October 10, 2024 07:04
@gilest
Copy link
Collaborator

gilest commented Oct 10, 2024

Have done so. Thank you both for reporting, investigating and testing

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 this pull request may close these issues.

Problem with @ember/test-helpers>4.0.0
3 participants