ember-test-helpers icon indicating copy to clipboard operation
ember-test-helpers copied to clipboard

@ember/renderer work in 2.8.0/2.8.1 not compatible with prior ember releases

Open runspired opened this issue 3 years ago • 7 comments

Resulting error in both 4.4 LTS and 3.28 LTS

Uncaught Error: Could not find module `@ember/renderer` imported from `(require)`
    at missingModule (loader.js:247:1)
    at findModule (loader.js:258:1)
    at requireModule (loader.js:24:1)
    at Module.callback (render-settled.js:12:1)
    at Module.exports (loader.js:106:1)
    at Module._reify (loader.js:143:1)
    at Module.reify (loader.js:130:1)
    at Module.exports (loader.js:104:1)
    at Module._reify (loader.js:143:1)
    at Module.reify (loader.js:130:1)

~At a minimum this should have been a major version, but given it doesn't support either LTS likely~ we should fix.

runspired avatar Jul 15 '22 17:07 runspired

cc @cafreeman and @rwjblue. Likely the version check is trolling.

runspired avatar Jul 15 '22 18:07 runspired

@ember/[email protected] also breaks in ember-simple-auth for >=3.12 <3.28

@ember/test-helpers@~2.7.0 seems to work correctly.

not ok 1 Chrome 103.0 - [undefined ms] - Global error: Uncaught Error: Could not find module `@glimmer/manager` imported from `(require)` at http://localhost:7357/assets/vendor.js, line 7463
    ---
        browser log: |
            {"type":"error","text":"Uncaught Error: Could not find module `@glimmer/manager` imported from `(require)` at http://localhost:7357/assets/vendor.js, line 7463\n","testContext":{}}
    ...
not ok 2 Chrome 103.0 - [undefined ms] - Global error: Uncaught Error: The tests file was not loaded. Make sure your tests index.html includes "assets/tests.js". at http://localhost:7357/135649072972/tests/index.html?hidepassed, line 42
    ---
        browser log: |
            {"type":"error","text":"Uncaught Error: The tests file was not loaded. Make sure your tests index.html includes \"assets/tests.js\". at http://localhost:7357/135649072972/tests/index.html?hidepassed, line 42\n","testContext":{"state":"complete"}}

BobrImperator avatar Jul 28 '22 00:07 BobrImperator

Same error Could not find module @glimmer/manager with tinymce-ember https://github.com/concordnow/tinymce-ember/pull/274 https://github.com/concordnow/tinymce-ember/runs/7655733728?check_suite_focus=true

This may be related to https://github.com/emberjs/ember-test-helpers/issues/1220 https://github.com/emberjs/ember-test-helpers/pull/1221

ctjhoa avatar Aug 04 '22 08:08 ctjhoa

Looks like this is a common issue for monorepo setups, which is caused by npm/yarn installation specifics. There is a nice explanation of the issue https://github.com/embroider-build/embroider/issues/1169#issuecomment-1156803926

In my case, I've worked it around by switching from npm to pnpm. Also sounds like for yarn the nohoist option might help as described in the explanation from the link above.

ro0gr avatar Aug 04 '22 10:08 ro0gr

@ro0gr I'm not sure that's the case here. In data we don't have any competing versions to worry about yet still end up with this error.

runspired avatar Aug 04 '22 13:08 runspired

@runspired ya, sure. I didn't have any conflicting versions declared explicitly as well. However, in the recent versions of the test-helpers it got a peer dependency on ember-source https://github.com/emberjs/ember-test-helpers/blob/02360aaf1f1210db3af9aa53dda6e4387de3aaeb/package.json#L39-L41 And seems like this causes some of package managers to install the latest possible ember-source version to the root node_modules, which in its turn makes embroider/macros's dependencySatisfies( to ignore the test-app's ember-source version, and use one from the root node_modules(like explained in the embroider thread).

You can ensure if that's the case for you by checking all the installed ember-source copies in the monorepo setup, like

npm list ember-source

or similar.

ro0gr avatar Aug 04 '22 14:08 ro0gr

I also encountered the issue by running 3.28 and 4.4 LTS ember-try scenarios in a yarn workspace (specifically, after separating documentation from testing by having 2 Ember apps).

I didn't want to solve it by migrating to pnpm in the same pull request, as it was already large. Instead, I configured ember-try so that older versions of @ember/test-helpers and a few other TypeScript-related packages are installed (see the relevant commit).

/* config/ember-try.js */

module.exports = async function () {
  return {
    useYarn: true,
    scenarios: [
      {
        name: 'ember-lts-3.28',
        npm: {
          devDependencies: {
            '@ember/test-helpers': '2.7.0',
            '@types/ember__test-helpers': '2.8.3',
            '@types/ember-qunit': '6.1.1',
            'ember-qunit': '6.0.0',
            'ember-source': '~3.28.0',
          },
        },
      },
      {
        name: 'ember-lts-4.4',
        npm: {
          devDependencies: {
            '@ember/test-helpers': '2.7.0',
            '@types/ember__test-helpers': '2.8.3',
            '@types/ember-qunit': '6.1.1',
            'ember-qunit': '6.0.0',
            'ember-source': '~4.4.0',
          },
        },
      },
      /* ... */
  };
};

ijlee2 avatar Mar 08 '23 14:03 ijlee2