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

App won't build with ember-exam 6.1.0 and ember-mocha #666

Open
robertpbaxter opened this issue Apr 15, 2021 · 4 comments
Open

App won't build with ember-exam 6.1.0 and ember-mocha #666

robertpbaxter opened this issue Apr 15, 2021 · 4 comments

Comments

@robertpbaxter
Copy link

robertpbaxter commented Apr 15, 2021

Build Error (Bundler)

ember-exam tried to import "ember-qunit" but the package was not resolvable from {directories}/node_modules/ember-exam


Stack Trace and Error Report: /var/folders/qf/lrfvnjyn57bf8fs0g908c0p40000gn/T/error.dump.5fcdb4584b886598cb025504493336b4.log

Steps to reproduce:

  • Create new ember app from scratch
  • Install ember-exam and ember-mocha
  • Uninstall ember-qunit
  • Start app

The log as well just in case it's desired:

ERROR Summary:

  - broccoliBuilderErrorStack: Error: ember-exam tried to import "ember-qunit" but the package was not resolvable from /Users/rbaxter/gg/client/src/greenlight/node_modules/ember-exam
    at Package.resolve (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/package.js:163:19)
    at Splitter.<anonymous> (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/splitter.js:76:38)
    at Generator.next (<anonymous>)
    at /Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/splitter.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/splitter.js:4:12)
    at Splitter.handleLiteralImport (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/splitter.js:75:16)
    at Splitter.<anonymous> (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/splitter.js:65:32)
    at Generator.next (<anonymous>)
    at /Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/splitter.js:8:71
  - code: [undefined]
  - codeFrame: ember-exam tried to import "ember-qunit" but the package was not resolvable from /Users/rbaxter/gg/client/src/greenlight/node_modules/ember-exam
  - errorMessage: ember-exam tried to import "ember-qunit" but the package was not resolvable from /Users/rbaxter/gg/client/src/greenlight/node_modules/ember-exam
        at Bundler
-~- created here: -~-
    at new Plugin (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/node_modules/broccoli-plugin/dist/index.js:47:36)
    at new Bundler (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/bundler.js:34:9)
    at AutoImport.makeBundler (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/auto-import.js:57:16)
    at AutoImport.addTo (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/auto-import.js:67:38)
    at EmberApp.host.addonPostprocessTree (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/auto-import.js:101:29)
    at EmberApp.toTree (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-cli/lib/broccoli/ember-app.js:1665:17)
    at EmberApp.appInstance.toTree (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-classic-decorator/node_modules/@embroider/macros/src/ember-addon-main.js:48:35)
    at EmberApp.appInstance.toTree (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-cli-mirage/node_modules/@embroider/macros/src/ember-addon-main.js:48:35)
    at EmberApp.appInstance.toTree (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-exam/node_modules/@embroider/macros/src/ember-addon-main.js:48:35)
    at EmberApp.appInstance.toTree (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-basic-dropdown/node_modules/@embroider/macros/src/ember-addon-main.js:48:35)
-~- (end) -~-
  - errorType: Build Error
  - location:
    - column: [undefined]
    - file: [undefined]
    - line: [undefined]
    - treeDir: [undefined]
  - message: ember-exam tried to import "ember-qunit" but the package was not resolvable from /Users/rbaxter/gg/client/src/greenlight/node_modules/ember-exam
        at Bundler
-~- created here: -~-
    at new Plugin (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/node_modules/broccoli-plugin/dist/index.js:47:36)
    at new Bundler (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/bundler.js:34:9)
    at AutoImport.makeBundler (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/auto-import.js:57:16)
    at AutoImport.addTo (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/auto-import.js:67:38)
    at EmberApp.host.addonPostprocessTree (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/auto-import.js:101:29)
    at EmberApp.toTree (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-cli/lib/broccoli/ember-app.js:1665:17)
    at EmberApp.appInstance.toTree (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-classic-decorator/node_modules/@embroider/macros/src/ember-addon-main.js:48:35)
    at EmberApp.appInstance.toTree (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-cli-mirage/node_modules/@embroider/macros/src/ember-addon-main.js:48:35)
    at EmberApp.appInstance.toTree (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-exam/node_modules/@embroider/macros/src/ember-addon-main.js:48:35)
    at EmberApp.appInstance.toTree (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-basic-dropdown/node_modules/@embroider/macros/src/ember-addon-main.js:48:35)
-~- (end) -~-
  - name: Error
  - nodeAnnotation: [undefined]
  - nodeName: Bundler
  - originalErrorMessage: ember-exam tried to import "ember-qunit" but the package was not resolvable from /Users/rbaxter/gg/client/src/greenlight/node_modules/ember-exam
  - stack: Error: ember-exam tried to import "ember-qunit" but the package was not resolvable from /Users/rbaxter/gg/client/src/greenlight/node_modules/ember-exam
    at Package.resolve (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/package.js:163:19)
    at Splitter.<anonymous> (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/splitter.js:76:38)
    at Generator.next (<anonymous>)
    at /Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/splitter.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/splitter.js:4:12)
    at Splitter.handleLiteralImport (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/splitter.js:75:16)
    at Splitter.<anonymous> (/Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/splitter.js:65:32)
    at Generator.next (<anonymous>)
    at /Users/rbaxter/gg/client/src/greenlight/node_modules/ember-auto-import/js/splitter.js:8:71

=================================================================================

@robertpbaxter
Copy link
Author

Works fine on 6.0.1. This broke our app on upgrading to 6.1.0 and a colleague (@jeffhertzler) and I reproduced it in minimal format.

@ndekeister-us
Copy link

ndekeister-us commented Jul 8, 2021

It looks like that a change is needed on this line -> https://github.com/ember-cli/ember-exam/blob/master/index.js#L23

Tested on your project which is using mocha

let options = {
  exclude: ['ember-mocha', 'mocha', 'ember-qunit', 'qunit']
};

Works fine (your app build, test run correctly), tested same code on a project using ember-qunit > 5 and it is working fine

I guess that an additional check need to be done here

  • if project is using ember-mocha then options.exclude should be set to ['ember-mocha', 'mocha', 'ember-qunit', 'qunit']
  • if project is using ember-qunit < 5.0.0-beta.1, then options.exclude should be set to ['ember-mocha', 'mocha', 'ember-qunit']
  • if project is using ember-qunit > 5.0.0-beta.1, then options.exclude should be set to ['ember-mocha', 'mocha', 'ember-qunit', 'qunit']

Not sure about the why, will try to take some times to better understand it and, in that case, suggest a PR

@ndekeister-us
Copy link

ping @robertpbaxter if you wanna try #699

@jeffhertzler
Copy link

this PR fixes the issue on the codebase @robertpbaxter was referring to

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.

3 participants