stealjs / steal-qunit

A npm qunit project that starts tests after 'main' has loaded.

Home Page:https://stealjs.com/docs/steal-qunit.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

QUnit.load is supported anymore

pYr0x opened this issue · comments

i think this line https://github.com/stealjs/steal-qunit/blob/master/steal-qunit.js#L83
should be

QUnit.start();

in my example, the tests will never start until i call QUnit.start() manually.
correct me if i am wrong @matthewp

It's supported by the version of QUnit that steal-qunit supports, otherwise it would be throwing for everyone using it.

but steal has a qunit version1.12.0 and steal-qunit ^1.17.1.
but if you looked into my PR for the trace extension, qunit will never start until you set steal's qunit to ^1.17.1 (like steal-qunit) and replace QUnit.load with QUnit.start

Are you saying that QUnit.load doesn't exist in 1.17.1?

no.
but in your steal test.html
you are loading <script src="../node_modules/qunitjs/qunit/qunit.js"></script> but that is not that version steal-qunit wants. you got the version 1.12.0 and not 1.23.x from steal-qunit
steal-qunits qunit's version is under node_modules/steal-qunit/node_moduls...

maybe there is a difference between the load() on 1.12 and 1.23

you also used that start() within https://github.com/stealjs/steal/blob/master/src/json/test.html#L20

do you think it is a bad idea to replace load() to start()

There are possibly 2 separate issues here, so let's tackle them one at a time.

Let's ignore steal's test for a minute. steal-qunit depends on qunit ^1.17.1. If you install steal-qunit in a regular project (not steal) and try to use it does it:

  1. work?
  2. which version of qunit is inside of node_modules?

If the answer to (1) is no, then that's a serious bug we need to fix first.

i found the root cause of that problem.
let me explain:
in steal-env test we do all that mapping stuff because we have to remove steal-qunit from steal.npmDepencencies!
https://github.com/stealjs/steal/blob/master/package.json#L123

<script>
	var steal = {
		paths: {
			"steal-qunit": "node_modules/steal-qunit/steal-qunit.js"
		},
		map: {
			"qunitjs": "node_modules/qunitjs"
		},
		ext : {
			css: "node_modules/steal-css/css.js"
		}
	}
</script>

now steal loads qunit, but it will load it not as a NPM package, it will load it as a AMD module
https://github.com/qunitjs/qunit/blob/1.23.1/qunit/qunit.js#L2250-L2255
this cause, that qunit sets autostart to false.

if qunit is loaded as a NPM module, autostart is always true

steal-qunit should be really look like this

	QUnit.config.autostart = false;
	steal.done().then(function() {
		if (window.Testee && window.Testee.init) {
			Testee.init();
		}
		QUnit.load();
		QUnit.start();
	});