The test written in IoC testing framework runs fine on its own but throws error in all-tests.html
Description
Environment
Activity
Cindy LiFebruary 4, 2016 at 8:15 PM
The pull request https://github.com/fluid-project/infusion/pull/661 has been merged into the project repo @ 09fac7f7ca172073cd2628e8af578e47852b4977
Antranig BasmanDecember 18, 2015 at 7:58 PM
Thanks for this report, , which is very interesting. It was very helpful that you were able to find the clue that the missing "name" property in the test fixtures was the issue. My feeling is that this is an issue that has eventually been handed up to us from the underlying QUnit implementation, since there are many places in its code base where it makes a simple "truthy" check for config.currentModule - e.g.
https://github.com/fluid-project/infusion/blob/master/tests/lib/qunit/js/qunit.js#L1254
In the IoC testing framework we simply hand the "name" property on the test to jqUnit.module as so:
https://github.com/fluid-project/infusion/blob/master/tests/test-core/utils/js/IoCTestUtils.js#L588
which will probably screw up its bookkeeping about what tests are in progress. I think there is another error of this kind in the prefs framework tests which frequently causes mis-sequencing when I run all-tests and it will be great if we find both these issues have the same cause.
My best thinking for a fix at present is for the IoC testing framework to validate that the "name" property of a test cases is not falsy before it hands it on to QUnit.
The test to re-produce this issue is,
https://github.com/cindyli/universal/blob/GPII-1245-odd/gpii/node_modules/gpii-oauth2/gpii-oauth2-authz-server/webTests/components/privacySettings/html/PrivacySettingsWithPrefs-test.html
When running this test on its own, all tests pass. However, when including it as a part of all-tests.html (https://github.com/cindyli/universal/blob/GPII-1245-odd/gpii/node_modules/gpii-oauth2/gpii-oauth2-authz-server/webTests/all-tests.html), a javascript error is thrown:
Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.
Source:
QUnit.asyncTest@http://localhost/gpii/node_modules/universal/node_modules/infusion/tests/lib/qunit/js/qunit.js:401:3
After investigation, the issue is caused by the missing "name" field in the "tests" block. Rewriting this block (https://github.com/cindyli/universal/blob/GPII-1245-odd/gpii/node_modules/gpii-oauth2/gpii-oauth2-authz-server/webTests/components/privacySettings/js/PrivacySettingsWithPrefsTests.js#L46-L51) by adding a "name" field resolves the issue.
The block that works:
tests: [{
name: "a test",
sequence: [{
....
}]
}]