Commit Graph

24 Commits

Author SHA1 Message Date
Michał Gołębiowski-Owczarek
437f389a24
Build: Make dev mode work in Karma again, serve source files from disk
PR gh-4550 added support for running ES modules & AMD tests via Karma. This
required reading the `esmodules` & `amd` props from both `QUnit.config` &
`QUnit.urlParams`. By picking these two properties manually, the `dev` one
stopped being respected while ones handled directly by QUnit were fine (like
`hidepassed`). Instead of maintaining the full list of options, the code now
iterates over QUnit URL config and handles the fallbacks in a more generic way.

Apart from that, all jQuery source & test files are now read directly from disk
instead of being cached by Karma so that one can run `grunt karma:chrome-debug`
& work on a fix without restarting that Karma run after each change. A similar
effect could have been achieved by setting `autoWatch` to `true` but then the
main Karma page runs tests in an iframe by default when
`grunt karma:chrome-debug` is run instead of relying on the current debug flow.

Closes gh-4574
Ref gh-4550
2020-01-08 00:35:55 +01:00
Michał Gołębiowski-Owczarek
341c6d1b5a
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
2019-12-16 19:33:49 +01:00
Michał Gołębiowski-Owczarek
f37c2e51f3
Build: Auto-convert sources to AMD
jQuery source has been migrated in gh-4541 from AMD to ES modules. To maintain
support for consumers of our AMD modules, this commits adds a task transpiling
the ES modules sources in `src/` to AMD in `amd/`.

A "Load with AMD" checkbox was also restored to the QUnit setup. Note that,
contrary to jQuery 3.x, AMD files need to be generated via `grunt amd` or
`grunt` as sources are not authored in ECMAScript modules. To achieve a similar
no-compile experience during jQuery 4.x testing, use the new "Load as modules"
checkbox which works in all supported browsers except for IE & Edge (the
legacy, EdgeHTML-based one).

Ref gh-4541
Closes gh-4554
2019-12-09 20:00:44 +01:00
Michał Gołębiowski-Owczarek
d0ce00cdfa
Core: Migrate from AMD to ES modules 🎉
Migrate all source AMD modules to ECMAScript modules. The final bundle
is compiled by a custom build process that uses Rollup under the hood.

Test files themselves are still loaded via RequireJS as that has to work in
IE 11.

Tests can now be run in "Load as modules" mode which replaces the previous
"Load with AMD" option. That option of running tests doesn't work in IE
and Edge as it requires support for dynamic imports.

Some of the changes required by the migration:
* check `typeof` of `noGlobal` instead of using the variable directly
  as it's not available when modules are used
* change the nonce module to be an object as ECMASscript module exports
  are immutable
* remove some unused exports
* import `./core/parseHTML.js` directly in `jquery.js` so that it's not
  being cut out when the `ajax` module is excluded in a custom compilation

Closes gh-4541
2019-11-18 21:15:03 +01:00
Michał Gołębiowski-Owczarek
c7c2855ed1
Core: Preserve CSP nonce on scripts in DOM manipulation
Fixes gh-3541
Closes gh-4269
2019-01-14 19:29:54 +01:00
Richard Gibson
dfa92ccead
Tests: Allow Karma to load unminfied source
Closes gh-4128
2018-09-07 10:14:01 -04:00
Jordan Beland
b1b949d35e Tests: Update path calculation
Fixes gh-3756
Closes gh-3757
2017-08-16 01:07:49 -04:00
Richard Gibson
14b393d0d6 Tests: Update the loader so test pages always get jQuery
Pages used for iframe tests will now successfully load jQuery, even when
opened directly in the browser.

Closes gh-3489
2017-01-09 11:23:47 -08:00
Timmy Willison
5943f1d7ff Build: use hard-coded path to sizzle in selector-sizzle
Fixes gh-2898
2016-02-10 13:47:25 -08:00
Oleg Gaidarenko
e35bdc1a22 Build: correct style tests files which could be automatically corrected 2015-09-07 20:03:50 +03:00
Scott González
c5d9d88dce Build: Move all external libraries to external directory
Closes gh-1593
2014-06-24 10:17:50 -04:00
Timmy Willison
f9ad13c9ec Manage bower dependencies with grunt-bowercopy
Tracked bower dependencies are located at "src/sizzle" and "test/libs".
The source-destination mapping is in the Gruntfile.

When updating a bower dependency, update the version in bower.json, run
`grunt bower`, and then commit the result. When adding a dependency,
update the bowercopy task accordingly.

Fixes #14615.
Closes gh-1452.
2013-12-06 16:04:35 -05:00
Timmy Willison
ac7ff97f8b Use grunt and bower packages as local dependencies. Close gh-1433. 2013-11-14 10:17:18 -05:00
Richard Gibson
b7f62abb87 Ref 71b2ac52: Disallow 2.x bypass of environmental helper methods 2013-11-12 13:31:35 -05:00
Richard Gibson
71b2ac524e Fix #14492: More correct jQuery.parseJSON. Close gh-1419.
(cherry picked from commit 60a6178131)

Conflicts:

	src/ajax/parseJSON.js
2013-11-12 00:13:08 -05:00
Timmy Willison
641492b7e1 Woops, lint grunt file 2013-09-10 18:50:03 -05:00
Timmy Willison
aab9d63279 Map Sizzle to a path with config to allow users to put Sizzle wherever they want 2013-09-10 18:47:36 -05:00
Timmy Willison
5093b89f08 Convert testrunner to an AMD module and ensure jQuery is on the page when executing the testrunner (another race condition amplified by swarm) 2013-09-06 17:11:32 -04:00
Timmy Willison
004c1fc5bb Pass all tests (and load Sizzle fixture correctly) when loading with AMD 2013-08-29 16:18:17 -04:00
Timmy Willison
ca1c90e55c Use window.QUnit to detect the top window when loading with AMD 2013-08-29 13:52:46 -04:00
Timmy Willison
493548c099 Fix tests for testswarm 2013-08-19 15:29:23 -04:00
Oleg
42cd19fb8f Correct QUnit check, this might fix swarm failures 2013-08-19 22:33:52 +04:00
Timmy Willison
6318ae6ab9 AMD-ify jQuery sourcegit s! Woo! Fixes #14113, #14163. 2013-08-15 14:15:49 -04:00
Richard Gibson
363299ac24 Ref #13316: Sync all documents on full vs. minified source. Close gh-1147. 2013-02-07 15:16:28 -05:00