diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2019-12-16 19:33:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-16 19:33:49 +0100 |
commit | 341c6d1b5abe4829f59fbc32e93f6a6a1afb900f (patch) | |
tree | 969b366a31121f0ac16893164dd4b9e738e89240 /test/karma.debug.html | |
parent | f37c2e51f36c8f8bab3879064a90e86a685feafc (diff) | |
download | jquery-341c6d1b5abe4829f59fbc32e93f6a6a1afb900f.tar.gz jquery-341c6d1b5abe4829f59fbc32e93f6a6a1afb900f.zip |
Build: Make Karma work in ES modules mode
Also, run such a suite in CI to make sure modules are working as expected
when used directly.
Closes gh-4550
Diffstat (limited to 'test/karma.debug.html')
-rw-r--r-- | test/karma.debug.html | 67 |
1 files changed, 33 insertions, 34 deletions
diff --git a/test/karma.debug.html b/test/karma.debug.html index 9fdb4f641..2e1083c41 100644 --- a/test/karma.debug.html +++ b/test/karma.debug.html @@ -2,46 +2,45 @@ <html lang="en" id="html"> <head> %X_UA_COMPATIBLE% - <title>DEBUG</title> - <meta charset="utf-8"> - <!-- Karma serves this page from /context.html. Other files are served from /base --> - <link rel="stylesheet" href="/base/node_modules/qunit/qunit/qunit.css" /> - <link rel="stylesheet" href="/base/test/data/testsuite.css" /> + <title>DEBUG</title> + <meta charset="utf-8"> + <!-- Karma serves this page from /context.html. Other files are served from /base --> + <link rel="stylesheet" href="/base/node_modules/qunit/qunit/qunit.css" /> + <link rel="stylesheet" href="/base/test/data/testsuite.css" /> </head> <body id="body"> - <div id="qunit"></div> + <div id="qunit"></div> - <!-- Start: jQuery Test HTML --> - <!-- this iframe is outside the #qunit-fixture so it won't waste time by constantly reloading; the tests are "safe" and clean up after themselves --> - <iframe id="loadediframe" name="loadediframe" style="display:none;" src="/base/test/data/iframe.html"></iframe> - <div id="qunit-fixture"></div> - <!-- End: jQuery Test HTML --> + <!-- Start: jQuery Test HTML --> + <!-- this iframe is outside the #qunit-fixture so it won't waste time by constantly reloading; the tests are "safe" and clean up after themselves --> + <iframe id="loadediframe" name="loadediframe" style="display:none;" src="/base/test/data/iframe.html"></iframe> + <div id="qunit-fixture"></div> + <!-- End: jQuery Test HTML --> - <!-- Start: Karma boilerplate --> - <script src="/context.js"></script> - <script src="/debug.js"></script> - <script> - %CLIENT_CONFIG% + <!-- Start: Karma boilerplate --> + <script src="/context.js"></script> + <script src="/debug.js"></script> + <script> + %CLIENT_CONFIG% - %MAPPINGS% - </script> - %SCRIPTS% - <!-- End: Karma boilerplate --> + %MAPPINGS% + </script> + %SCRIPTS% + <!-- End: Karma boilerplate --> - <script src="/base/test/data/qunit-fixture.js"></script> - <script> - // Workaround: Remove call to window.__karma__.loaded() - // in favour of calling window.__karma__.start() at window.onload - // because tests such as unit/ready.js should run after document ready - window.addEventListener('load', function() { - window.__karma__.start(); + <script src="/base/test/data/qunit-fixture.js"></script> + <script> + // QUnit.config is populated from QUnit.urlParams but only at the beginning + // of the test run. We need to read both. + var esmodules = QUnit.config.esmodules || QUnit.urlParams.esmodules, + amd = QUnit.config.amd || QUnit.urlParams.amd; - // Workaround: https://github.com/karma-runner/karma-qunit/issues/92 - QUnit.testStart(function () { - // Restore content - document.getElementById("qunit-fixture").innerHTML = QUnit.config.fixture; - }); - }); - </script> + // Workaround: Remove call to `window.__karma__.loaded()` + // in favour of calling `window.__karma__.start()` from `loadTests()` + // because tests such as unit/ready.js should run after document ready. + if ( !esmodules && !amd ) { + loadTests(); + } + </script> </body> </html> |