diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2022-06-28 12:39:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-28 12:39:01 +0200 |
commit | fae5fee8b435cc20352d28b0a384b9784b1ad9ed (patch) | |
tree | 86ae9425c469a476c25ce62399297d35472dbc2c /build | |
parent | 52f452b2e8881e5ec5c9e880e277c8ecf633e8dc (diff) | |
download | jquery-fae5fee8b435cc20352d28b0a384b9784b1ad9ed.tar.gz jquery-fae5fee8b435cc20352d28b0a384b9784b1ad9ed.zip |
Tests: Exclude tests based on compilation flags, not API presence
Introduces a new test API, `includesModule`. The method returns whether
a particular module like "ajax" or "deprecated" is included in the current
jQuery build; it handles the slim build as well. The util was created so that
we don't treat presence of particular APIs to decide whether to run a test as
then if we accidentally remove an API, the tests would still not fail.
Fixes gh-5069
Closes gh-5046
Diffstat (limited to 'build')
-rw-r--r-- | build/tasks/build.js | 4 | ||||
-rw-r--r-- | build/tasks/lib/slim-build-flags.js | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/build/tasks/build.js b/build/tasks/build.js index e376be6cc..e344f991b 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -10,6 +10,7 @@ module.exports = function( grunt ) { const fs = require( "fs" ); const path = require( "path" ); const rollup = require( "rollup" ); + const slimBuildFlags = require( "./lib/slim-build-flags" ); const rollupFileOverrides = require( "./lib/rollup-plugin-file-overrides" ); const Insight = require( "insight" ); const pkg = require( "../../package.json" ); @@ -60,7 +61,6 @@ module.exports = function( grunt ) { const done = this.async(); try { - const slimFlags = [ "-ajax", "-callbacks", "-deferred", "-effects", "-queue" ]; const flags = this.flags; const optIn = flags[ "*" ]; let name = grunt.option( "filename" ); @@ -79,7 +79,7 @@ module.exports = function( grunt ) { if ( flags.slim ) { delete flags.slim; - for ( const flag of slimFlags ) { + for ( const flag of slimBuildFlags ) { flags[ flag ] = true; } } diff --git a/build/tasks/lib/slim-build-flags.js b/build/tasks/lib/slim-build-flags.js new file mode 100644 index 000000000..a3574df21 --- /dev/null +++ b/build/tasks/lib/slim-build-flags.js @@ -0,0 +1,10 @@ +"use strict"; + +// NOTE: keep it in sync with test/data/testinit.js +module.exports = [ + "-ajax", + "-callbacks", + "-deferred", + "-effects", + "-queue" +]; |