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 Qunit integration #49

Open
steveszc opened this issue Sep 27, 2021 · 1 comment
Open

Fix Qunit integration #49

steveszc opened this issue Sep 27, 2021 · 1 comment

Comments

@steveszc
Copy link
Owner

steveszc commented Sep 27, 2021

Qunit no longer supports adding a test after the test run has finished. This was apparently never intentionally supported behavior in Qunit but we happened to be relying on it to inject the memory-leak-detection test. A recent Qunit PR removed support for this behavior and memory leak detection no longer runs reliably in Qunit 2.17+, reported in #46 and #47. In newer versions of Qunit this logs a warning, but in Qunit v3 it will hard error.

I've raised this with Qunit team here and they have created an issue to track a new path forward for plugins to run a "final" test. Fortunately they seem to agree that there should be a clear way for plugins to do this.

Once Qunit has introduced a new way forward, we need to update the way we run the final memory leak detection test.

@Krinkle
Copy link

Krinkle commented Apr 25, 2022

@steveszc Just checking in to see if you've had a chance to consider my suggestion at qunitjs/qunit#1663 (comment).

My understanding is that you currently use Testem.afterTests at

if (typeof QUnit !== "undefined") {
Testem.afterTests(detectMemoryLeaksWithQUnit);

Which in turn is fired by Testem.on('all-test-results') at https://github.com/testem/testem/blob/bba1a9c64a045767754f1de77144bbbe388f43d6/public/testem/testem_client.js#L349, and ultimately from QUnit.done() at https://github.com/testem/testem/blob/49853346b4b8945e983671be155c7ae062376f4a/public/testem/qunit_adapter.js#L114-L116.

Using QUnit.begin() here instead of Testem.afterTests() might do the trick? There's already a conditional for QUnit. If you prefer a Testem abstraction, a one-off listener for tests-start might work. It looks like the Jasmine adapter emits this already once without data, to signal the start of the run, just like QUnit.on('runStart') and QUnit.begin(). Perhaps Testem would be interested in providing a hook like Testem.beforeTests that would work based on a once Testem.on('tests-start') listener or some such. But - for now, I'm hoping QUnit.begin() will work for you?

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

No branches or pull requests

2 participants