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

feature: Make it possible to load QUnit after domReady #1059

Closed
TobiasOetzel opened this issue Oct 7, 2016 · 4 comments
Closed

feature: Make it possible to load QUnit after domReady #1059

TobiasOetzel opened this issue Oct 7, 2016 · 4 comments

Comments

@TobiasOetzel
Copy link
Contributor

I am using QUnit together with OpenUI5

UI5 comes with its own amd syntax similar to require.js.

It would be nice to be able to load QUnit asynchronously to provide a test environment from the framework side.

How i would imagine it is that you could define a global QUnit config before QUnit itself is loaded

window.QUnit = { config: { autostart: false } };

When QUnit is loaded, it takes this config and extends it with the needed defaults. Here is a full jsbin outlining the problem

If you like the idea i would create a pull request for it. I just wanted to discuss it upfront.

@platinumazure
Copy link
Contributor

@TobiasOetzel I use QUnit with RequireJS at my workplace, and we're able to stop the test runner from executing prematurely with this code:

QUnit.config.autostart = false;

require(['path/to/tests'], function () {
    QUnit.start();
});

In your JSBin, I do see the test being executed. Can you please explain the exact issue? Is the test starting too soon?

@trentmwillis
Copy link
Member

Didn't dig into the example at this moment, but want to mention that this sounds similar to a suggestion brought up in jonkemp/qunit-phantomjs-runner#11 (comment).

@TobiasOetzel
Copy link
Contributor Author

@platinumazure
Yes there is extra code for amd syntax in QUnit setting autostart to another default. That would be a trick to define the ducktype before loading QUnit.

@trentmwillis Yes this looks exactly like the issue you pointed to. How is the state of the discussion? I saw some extra phantomJS code.

@trentmwillis
Copy link
Member

No movement really, left off with needing to define an API for it.

TobiasOetzel added a commit to TobiasOetzel/qunit that referenced this issue Oct 10, 2016
If a global QUnit.config object is present before QUnit is loaded,
the default config values will be extended.
The use case is to configure QUnit before it is loaded.

Closes qunitjs#1059
TobiasOetzel added a commit to TobiasOetzel/qunit that referenced this issue Oct 10, 2016
If a global QUnit.config object is present before QUnit is loaded,
the default config values will be extended.
The use case is to configure QUnit before it is loaded.

Closes qunitjs#1059
TobiasOetzel added a commit to TobiasOetzel/qunit that referenced this issue Oct 12, 2016
If a global QUnit.config object is present before QUnit is loaded,
the default config values will be extended.
The use case is to configure QUnit before it is loaded.

Closes qunitjs#1059
TobiasOetzel added a commit to TobiasOetzel/qunit that referenced this issue Nov 13, 2016
If a global QUnit.config object is present before QUnit is loaded,
the default config values will be extended.
The use case is to configure QUnit before it is loaded.

Closes qunitjs#1059
TobiasOetzel added a commit to TobiasOetzel/qunit that referenced this issue Dec 4, 2016
If a global QUnit.config object is present before QUnit is loaded,
the default config values will be extended.
The use case is to configure QUnit before it is loaded.

Closes qunitjs#1059
TobiasOetzel added a commit to TobiasOetzel/qunit that referenced this issue Dec 4, 2016
If a global QUnit.config object is present before QUnit is loaded,
the default config values will be extended.
The use case is to configure QUnit before it is loaded.

Closes qunitjs#1059
TobiasOetzel added a commit to TobiasOetzel/qunit that referenced this issue Dec 4, 2016
If a global QUnit.config object is present before QUnit is loaded,
the default config values will be extended.
The use case is to configure QUnit before it is loaded.

Closes qunitjs#1059
TobiasOetzel added a commit to TobiasOetzel/qunit that referenced this issue Dec 4, 2016
If a global QUnit.config object is present before QUnit is loaded,
the default config values will be extended.
The use case is to configure QUnit before it is loaded.

Closes qunitjs#1059
trentmwillis pushed a commit that referenced this issue Dec 4, 2016
If a global QUnit.config object is present before QUnit is loaded,
the default config values will be extended.
The use case is to configure QUnit before it is loaded.

Closes #1059
openui5bot pushed a commit to SAP/openui5 that referenced this issue Jul 19, 2018
Without this fix, QUnit 1.x starts its queue immediately when it is
loaded after DOMContentloaded. Test providers have no chance to
configure autostart:false in that case.

The fix is a downport of QUnit's own fix for
qunitjs/qunit#1059 .

Change-Id: If806792ddb21a79eeb71b59ab33dc443aa29934c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants