mirror of
https://github.com/jquery/jquery.git
synced 2026-01-09 14:18:03 -05:00
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
This commit is contained in:
committed by
GitHub
parent
52f452b2e8
commit
fae5fee8b4
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
10
build/tasks/lib/slim-build-flags.js
Normal file
10
build/tasks/lib/slim-build-flags.js
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
// NOTE: keep it in sync with test/data/testinit.js
|
||||
module.exports = [
|
||||
"-ajax",
|
||||
"-callbacks",
|
||||
"-deferred",
|
||||
"-effects",
|
||||
"-queue"
|
||||
];
|
||||
Reference in New Issue
Block a user