Skip to content

Commit

Permalink
Build:Tests: Fix custom build tests, verify on Travis
Browse files Browse the repository at this point in the history
This commit fixes unit tests for the following builds:

1. The no-deprecated build: `custom:-deprecated`
2. The current slim build: `custom:-ajax,-effects`
3. The future (#4553) slim build: `custom:-ajax,-callbacks,-deferred,-effects`

It also adds separate Travis jobs for the no-deprecated & slim builds. 

Closes gh-4577
  • Loading branch information
mgol committed Jan 7, 2020
1 parent 1dad118 commit 0f780ba
Show file tree
Hide file tree
Showing 26 changed files with 174 additions and 84 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ npm-debug.log*
/node_modules

/test/data/core/jquery-iterability-transpiled.js
/test/data/qunit-fixture.js
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ matrix:
addons:
chrome: stable
firefox: latest
# Run tests against the slim build.
- node_js: "12"
env:
- NPM_SCRIPT="test:slim"
- BROWSERS="ChromeHeadless"
addons:
chrome: stable
# Run tests against the no-deprecated build.
- node_js: "12"
env:
- NPM_SCRIPT="test:no-deprecated"
- BROWSERS="ChromeHeadless"
addons:
chrome: stable
# Run ES module tests.
- node_js: "12"
env:
Expand Down
10 changes: 8 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = function( grunt ) {
retainLines: true,
plugins: [ "@babel/transform-for-of" ]
},
nodeSmokeTests: {
tests: {
files: {
"test/data/core/jquery-iterability-transpiled.js":
"test/data/core/jquery-iterability-transpiled-es6.js"
Expand Down Expand Up @@ -314,7 +314,13 @@ module.exports = function( grunt ) {
"karma:jsdom"
] );

grunt.registerTask( "test:prepare", [
"qunit_fixture",
"babel:tests"
] );

grunt.registerTask( "test", [
"test:prepare",
"test:fast",
"test:slow"
] );
Expand All @@ -336,7 +342,7 @@ module.exports = function( grunt ) {
"uglify",
"remove_map_comment",
"dist:*",
"qunit_fixture",
"test:prepare",
"eslint:dist",
"test:fast",
"compare_size"
Expand Down
2 changes: 1 addition & 1 deletion build/tasks/node_smoke_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = ( grunt ) => {
const fs = require( "fs" );
const spawnTest = require( "./lib/spawn_test.js" );
const testsDir = "./test/node_smoke_tests/";
const nodeSmokeTests = [ "babel:nodeSmokeTests" ];
const nodeSmokeTests = [];

// Fire up all tests defined in test/node_smoke_tests/*.js in spawned sub-processes.
// All the files under test/node_smoke_tests/*.js are supposed to exit with 0 code
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@
"test:browser": "grunt && grunt karma:main",
"test:esmodules": "grunt && grunt karma:esmodules",
"test:amd": "grunt && grunt karma:amd",
"test": "grunt && grunt test:slow && grunt karma:main && grunt karma:esmodules && grunt karma:amd",
"test:no-deprecated": "grunt test:prepare && grunt custom:-deprecated && grunt karma:main",
"test:slim": "grunt test:prepare && grunt custom:slim && grunt karma:main",
"test": "npm run test:slim && npm run test:no-deprecated && grunt && grunt test:slow && grunt karma:main && grunt karma:esmodules && grunt karma:amd",
"jenkins": "npm run test:browserless"
},
"commitplease": {
Expand Down
2 changes: 1 addition & 1 deletion src/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import nonce from "./ajax/var/nonce.js";
import rquery from "./ajax/var/rquery.js";

import "./core/init.js";
import "./ajax/parseXML.js";
import "./core/parseXML.js";
import "./event/trigger.js";
import "./deferred.js";
import "./serialize.js"; // jQuery.param
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion src/jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ import "./ajax.js";
import "./ajax/xhr.js";
import "./ajax/script.js";
import "./ajax/jsonp.js";
import "./core/parseHTML.js";
import "./ajax/load.js";
import "./core/parseXML.js";
import "./core/parseHTML.js";
import "./event/ajax.js";
import "./effects.js";
import "./effects/animatedSelector.js";
Expand Down
2 changes: 1 addition & 1 deletion test/data/core/dynamic_ready.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<script src="../../jquery.js"></script>
<script src="../jquery-1.9.1.js"></script>
<script>var $j = jQuery.noConflict();</script>
<script src="../iframeTest.js"></script>
</head>
Expand Down
14 changes: 7 additions & 7 deletions test/data/offset/absolute.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
<script src="../../jquery.js"></script>
<script src="../iframeTest.js"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($) {
$(".absolute").click(function() {
$("#marker").css( $(this).offset() );
var pos = $(this).position();
$(this).css({ top: pos.top, left: pos.left });
jQuery( function( $ ) {
$( ".absolute" ).on( "click", function() {
$( "#marker" ).css( $( this ).offset() );
var pos = $( this ).position();
$( this ).css( { top: pos.top, left: pos.left } );
return false;
});
} );
startIframeTest();
});
} );
</script>
</head>
<body>
Expand Down
10 changes: 5 additions & 5 deletions test/data/offset/body.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
<script src="../../jquery.js"></script>
<script src="../iframeTest.js"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($) {
$("body").click(function() {
$("marker").css( $(this).offset() );
jQuery( function( $ ) {
$( "body" ).on( "click", function() {
$( "#marker" ).css( $( this ).offset() );
return false;
});
} );
startIframeTest();
});
} );
</script>
</head>
<body>
Expand Down
8 changes: 4 additions & 4 deletions test/data/offset/fixed.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<script src="../../jquery.js"></script>
<script src="../iframeTest.js"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($) {
window.scrollTo(1000,1000);
$(".fixed").click(function() {
$("#marker").css( $(this).offset() );
jQuery( function( $ ) {
window.scrollTo( 1000, 1000 );
$( ".fixed" ).on( "click", function() {
$( "#marker" ).css( $( this ).offset() );
return false;
});
startIframeTest();
Expand Down
14 changes: 7 additions & 7 deletions test/data/offset/relative.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
<script src="../../jquery.js"></script>
<script src="../iframeTest.js"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($) {
$(".relative").click(function() {
$("#marker").css( $(this).offset() );
var pos = $(this).position();
$(this).css({ position: 'absolute', top: pos.top, left: pos.left });
jQuery( function( $ ) {
$( ".relative" ).on( "click", function() {
$( "#marker" ).css( $( this ).offset() );
var pos = $( this ).position();
$( this ).css( { position: 'absolute', top: pos.top, left: pos.left } );
return false;
});
} );
startIframeTest();
});
} );
</script>
</head>
<body>
Expand Down
16 changes: 8 additions & 8 deletions test/data/offset/scroll.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
<script src="../../jquery.js"></script>
<script src="../iframeTest.js"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($) {
window.scrollTo(1000,1000);
$("#scroll-1")[0].scrollLeft = 5;
$("#scroll-1")[0].scrollTop = 5;
$(".scroll").click(function() {
$("#marker").css( $(this).offset() );
jQuery( function( $ ) {
window.scrollTo( 1000, 1000 );
$( "#scroll-1" )[ 0 ].scrollLeft = 5;
$( "#scroll-1" )[ 0 ].scrollTop = 5;
$( ".scroll" ).on( "click", function() {
$( "#marker" ).css( $( this ).offset() );
return false;
});
} );
startIframeTest();
});
} );
</script>
</head>
<body>
Expand Down
14 changes: 7 additions & 7 deletions test/data/offset/static.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
<script src="../../jquery.js"></script>
<script src="../iframeTest.js"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($) {
$(".static").click(function() {
$("#marker").css( $(this).offset() );
var pos = $(this).position();
$(this).css({ position: 'absolute', top: pos.top, left: pos.left });
jQuery( function( $ ) {
$( ".static" ).on( "click", function() {
$( "#marker" ).css( $( this ).offset() );
var pos = $( this ).position();
$( this ).css( { position: 'absolute', top: pos.top, left: pos.left } );
return false;
});
} );
startIframeTest();
});
} );
</script>
</head>
<body>
Expand Down
10 changes: 5 additions & 5 deletions test/data/offset/table.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
<script src="../../jquery.js"></script>
<script src="../iframeTest.js"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($) {
$("table, th, td").click(function() {
$("#marker").css( $(this).offset() );
jQuery( function( $ ) {
$( "table, th, td" ).on( "click", function() {
$( "#marker" ).css( $( this ).offset() );
return false;
});
} );
startIframeTest();
});
} );
</script>
</head>
<body>
Expand Down
Loading

0 comments on commit 0f780ba

Please sign in to comment.