emberjs / ember-qunit

QUnit test helpers for Ember
Other
259 stars 154 forks source link

Qunit has already been defined (ember-qunit v8 in addon) #1149

Closed Techn1x closed 1 year ago

Techn1x commented 1 year ago

I think this issue has popped up again https://github.com/emberjs/ember-qunit/pull/752

I've attempted to update ember-qunit from v7 to v8.0.1 in my addon, but all tests fail with Uncaught Error: QUnit has already been defined

$ pnpm ember test
Environment: test
cleaning up...
Built project successfully. Stored in "/var/folders/7h/vh7gy6f922v9xyl7ztlwwpy40000gn/T/tests-dist-2023916-96555-1w4wfu0.xj8l".
not ok 1 Chrome 117.0 - [undefined ms] - Global error: Uncaught Error: QUnit has already been defined. at webpack://__ember_auto_import__/../../node_modules/.pnpm/qunit@2.20.0/node_modules/qunit/qunit/qunit.js?, line 597
    ---
        browser log: |
            {"type":"error","text":"Uncaught Error: QUnit has already been defined. at webpack://__ember_auto_import__/../../node_modules/.pnpm/qunit@2.20.0/node_modules/qunit/qunit/qunit.js?, line 597\n","testContext":{}}
    ...
not ok 2 Chrome 117.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/925127230999375/tests/index.html?hidepassed, line 47
    ---
        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/925127230999375/tests/index.html?hidepassed, line 47\n","testContext":{"state":"complete"}}

Is there some configuration I need to do as part of this update to avoid this error? ember-auto-import 2.6.3 is listed as a dependency, and these are the relevant devdeps for the addon..

    "ember-cli": "^5.3.0",
    "ember-qunit": "^8.0.1",
    "ember-sinon-qunit": "7.2.0",
    "qunit": "^2.20.0",
    "qunit-dom": "^3.0.0",
NullVoxPopuli commented 1 year ago

Does it still exist after running pnpm dedupe?

Techn1x commented 1 year ago

Unfortunately won't be at my computer for another ~12 hours, I'll give it a go in the morning!

Techn1x commented 1 year ago

No luck with the dedupe, same error

Techn1x commented 1 year ago

I tried removing ember-sinon-qunit, and then it got past that error.

So I went and sleuthed that project and sure enough it's already been reported https://github.com/elwayman02/ember-sinon-qunit/issues/885

Techn1x commented 1 year ago

Closing, as it looks like it's an issue over at ember-sinon-qunit rather than here