diff options
author | Timmy Willison <timmywil@users.noreply.github.com> | 2023-09-18 12:39:00 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-18 12:39:00 -0400 |
commit | 2bdecf8b7bd10864e5337a4e24e39476c78cf23a (patch) | |
tree | 4685fc5ca912e368c294a3949c7ef5b663fec980 /test/data | |
parent | f75daab09102a4dd5107deadb55d4a169f86254a (diff) | |
download | jquery-2bdecf8b7bd10864e5337a4e24e39476c78cf23a.tar.gz jquery-2bdecf8b7bd10864e5337a4e24e39476c78cf23a.zip |
Build: migrate most grunt tasks off of grunt
Updated tasks include:
- lint
- npmcopy
- build, minify, and process for distribution.
- new custom build command using yargs
- compare size of minified/gzip built files
- pretest scripts, including qunit-fixture, babel transpilation, and npmcopy
- node smoke tests
- promises aplus tests
- new watch task using `rollup.watch` directly
Also:
- upgraded husky and added the new lint command
- updated lint config to use new "flat" config format. See https://eslint.org/docs/latest/use/configure/configuration-files-new
- Temporarily disabled one lint rule until flat config is supported by eslint-plugin-import. See https://github.com/import-js/eslint-plugin-import/issues/2556
- committed package-lock.json
- updated all test scripts to use the new build
- added an express test server that uses middleware-mockserver (this can be used to run tests without karma)
- build-all-variants is now build:all
Close gh-5318
Diffstat (limited to 'test/data')
-rw-r--r-- | test/data/core/.babelrc.json | 5 | ||||
-rw-r--r-- | test/data/support/bootstrap.html | 22 | ||||
-rw-r--r-- | test/data/testinit-jsdom.js | 4 | ||||
-rw-r--r-- | test/data/testinit.js | 31 | ||||
-rw-r--r-- | test/data/testrunner.js | 1 |
5 files changed, 33 insertions, 30 deletions
diff --git a/test/data/core/.babelrc.json b/test/data/core/.babelrc.json new file mode 100644 index 000000000..4328ab218 --- /dev/null +++ b/test/data/core/.babelrc.json @@ -0,0 +1,5 @@ +{ + "plugins": ["@babel/transform-for-of"], + "retainLines": true, + "sourceMaps": "inline" +} diff --git a/test/data/support/bootstrap.html b/test/data/support/bootstrap.html index d8e643ac2..731a47431 100644 --- a/test/data/support/bootstrap.html +++ b/test/data/support/bootstrap.html @@ -5,16 +5,16 @@ <link rel="stylesheet" href="../../../external/bootstrap/bootstrap.min.css" class="stylesheet"> </head> <body> -<div> - <script src="../../jquery.js"></script> - <script src="../iframeTest.js"></script> - <script src="getComputedSupport.js"></script> -</div> -<script> - startIframeTest( - getComputedStyle( document.body ), - getComputedSupport( jQuery.support ) - ); -</script> + <div> + <script src="../../jquery.js"></script> + <script src="../iframeTest.js"></script> + <script src="getComputedSupport.js"></script> + </div> + <script> + startIframeTest( + getComputedStyle( document.body ), + getComputedSupport( jQuery.support ) + ); + </script> </body> </html> diff --git a/test/data/testinit-jsdom.js b/test/data/testinit-jsdom.js index 0a784df03..95012a392 100644 --- a/test/data/testinit-jsdom.js +++ b/test/data/testinit-jsdom.js @@ -37,10 +37,10 @@ window.original$ = this.$ = "replaced"; * @example url("mock.php?foo=bar") * @result "data/mock.php?foo=bar&10538358345554" */ -function url( value ) { +this.url = function( value ) { return baseURL + value + ( /\?/.test( value ) ? "&" : "?" ) + new Date().getTime() + "" + parseInt( Math.random() * 100000, 10 ); -} +}; // We only run basic tests in jsdom so we don't need to repeat the logic // from the regular testinit.js diff --git a/test/data/testinit.js b/test/data/testinit.js index 8d85a0edc..baf758205 100644 --- a/test/data/testinit.js +++ b/test/data/testinit.js @@ -1,5 +1,4 @@ /* eslint no-multi-str: "off" */ - "use strict"; var FILEPATH = "/test/data/testinit.js", @@ -16,18 +15,17 @@ var FILEPATH = "/test/data/testinit.js", baseURL = parentUrl + "test/data/", supportjQuery = this.jQuery, - // see RFC 2606 - externalHost = "example.com", - // NOTE: keep it in sync with build/tasks/lib/slim-build-flags.js - slimBuildFlags = [ - "-ajax", - "-callbacks", - "-deferred", - "-effects", - "-queue" + excludedFromSlim = [ + "ajax", + "callbacks", + "deferred", + "effects", + "queue" ]; +// see RFC 2606 +this.externalHost = "example.com"; this.hasPHP = true; this.isLocal = window.location.protocol === "file:"; @@ -241,7 +239,7 @@ this.ajaxTest = function( title, expect, options, wrapper ) { completed = true; delete ajaxTest.abort; assert.ok( false, "aborted " + reason ); - jQuery.each( requests, function( i, request ) { + jQuery.each( requests, function( _i, request ) { request.abort(); } ); } @@ -319,16 +317,16 @@ this.includesModule = function( moduleName ) { var excludedModulesPart, excludedModules; - // A short-cut for the slim build, e.g. "4.0.0-pre slim" - if ( jQuery.fn.jquery.indexOf( " slim" ) > -1 ) { + // A short-cut for the slim build, e.g. "4.0.0-pre+slim" + if ( jQuery.fn.jquery.indexOf( "+slim" ) > -1 ) { // The module is included if it does NOT exist on the list // of modules excluded in the slim build - return slimBuildFlags.indexOf( "-" + moduleName ) === -1; + return excludedFromSlim.indexOf( moduleName ) === -1; } - // example version for `grunt custom:-deprecated`: - // "4.0.0-pre -deprecated,-deprecated/ajax-event-alias,-deprecated/event" + // example version for `npm run build -- -e deprecated`: + // "v4.0.0-pre+14dc9347 -deprecated,-deprecated/ajax-event-alias,-deprecated/event" excludedModulesPart = jQuery.fn.jquery // Take the flags out of the version string. @@ -393,6 +391,7 @@ this.loadTests = function() { var i = 0, tests = [ + // A special module with basic tests, meant for not fully // supported environments like jsdom. We run it everywhere, // though, to make sure tests are not broken. diff --git a/test/data/testrunner.js b/test/data/testrunner.js index 283c37d8c..8da5cc3b3 100644 --- a/test/data/testrunner.js +++ b/test/data/testrunner.js @@ -1,5 +1,4 @@ ( function() { - "use strict"; // Store the old count so that we only assert on tests that have actually leaked, |