Skip to content

Build:Tests: Fix various issues with running tests on Apple Silicon Macs #2157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/**/*
external/**/*
tests/lib/vendor/**/*
ui/vendor/**/*
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
# Node.js 10 is required by jQuery infra
node-version: [10.x, 16.x, 18.x]

steps:
- uses: actions/checkout@v3
Expand All @@ -24,7 +25,7 @@ jobs:
- name: Get npm cache directory
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
echo "dir=\"$(npm config get cache)\"" >> $GITHUB_OUTPUT

- name: Cache npm dependencies
uses: actions/cache@v3
Expand Down
245 changes: 131 additions & 114 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,92 +2,98 @@

module.exports = function( grunt ) {

var
glob = require( "glob" ),

// files
coreFiles = [
"core.js",
"widget.js",
"widgets/mouse.js",
"widgets/draggable.js",
"widgets/droppable.js",
"widgets/resizable.js",
"widgets/selectable.js",
"widgets/sortable.js",
"effect.js"
],

uiFiles = coreFiles.map( function( file ) {
return "ui/" + file;
} ).concat( expandFiles( "ui/**/*.js" ).filter( function( file ) {
return coreFiles.indexOf( file.substring( 3 ) ) === -1;
} ) ),

allI18nFiles = expandFiles( "ui/i18n/*.js" ),

cssFiles = [
"core",
"accordion",
"autocomplete",
"button",
"checkboxradio",
"controlgroup",
"datepicker",
"dialog",
"draggable",
"menu",
"progressbar",
"resizable",
"selectable",
"selectmenu",
"sortable",
"slider",
"spinner",
"tabs",
"tooltip",
"theme"
].map( function( component ) {
return "themes/base/" + component + ".css";
} ),

// minified files
minify = {
// files
const coreFiles = [
"core.js",
"widget.js",
"widgets/mouse.js",
"widgets/draggable.js",
"widgets/droppable.js",
"widgets/resizable.js",
"widgets/selectable.js",
"widgets/sortable.js",
"effect.js"
];

const uiFiles = coreFiles.map( function( file ) {
return "ui/" + file;
} ).concat( expandFiles( "ui/**/*.js" ).filter( function( file ) {
return coreFiles.indexOf( file.substring( 3 ) ) === -1;
} ) );

const allI18nFiles = expandFiles( "ui/i18n/*.js" );

const cssFiles = [
"core",
"accordion",
"autocomplete",
"button",
"checkboxradio",
"controlgroup",
"datepicker",
"dialog",
"draggable",
"menu",
"progressbar",
"resizable",
"selectable",
"selectmenu",
"sortable",
"slider",
"spinner",
"tabs",
"tooltip",
"theme"
].map( function( component ) {
return "themes/base/" + component + ".css";
} );

// minified files
const minify = {
options: {
preserveComments: false
},
main: {
options: {
preserveComments: false
banner: createBanner( uiFiles )
},
main: {
options: {
banner: createBanner( uiFiles )
},
files: {
"dist/jquery-ui.min.js": "dist/jquery-ui.js"
}
},
i18n: {
options: {
banner: createBanner( allI18nFiles )
},
files: {
"dist/i18n/jquery-ui-i18n.min.js": "dist/i18n/jquery-ui-i18n.js"
}
files: {
"dist/jquery-ui.min.js": "dist/jquery-ui.js"
}
},
i18n: {
options: {
banner: createBanner( allI18nFiles )
},
files: {
"dist/i18n/jquery-ui-i18n.min.js": "dist/i18n/jquery-ui-i18n.js"
}
}
};

compareFiles = {
all: [
"dist/jquery-ui.js",
"dist/jquery-ui.min.js"
]
},
component = grunt.option( "component" ) || "**",

htmllintBad = [
"demos/tabs/ajax/content*.html",
"demos/tooltip/ajax/content*.html",
"tests/unit/core/core.html",
"tests/unit/tabs/data/test.html"
];
const compareFiles = {
all: [
"dist/jquery-ui.js",
"dist/jquery-ui.min.js"
]
};
const component = grunt.option( "component" ) || "**";

const htmllintBad = [
"demos/tabs/ajax/content*.html",
"demos/tooltip/ajax/content*.html",
"tests/unit/core/core.html",
"tests/unit/tabs/data/test.html"
];

const nodeV16OrNewer = !/^v1[0-5]\./.test( process.version );

// Support: Node.js <16
// Skip running tasks that dropped support for Node.js 10-15
// in this Node version.
function runIfNewNode( task ) {
return nodeV16OrNewer ? task : "print_old_node_message:" + task;
}

function mapMinFile( file ) {
return "dist/" + file.replace( /ui\//, "minified/" );
Expand Down Expand Up @@ -115,20 +121,14 @@ uiFiles.forEach( function( file ) {
compareFiles[ file ] = [ file, mapMinFile( file ) ];
} );

// grunt plugins
require( "load-grunt-tasks" )( grunt );

// local testswarm and build tasks
grunt.loadTasks( "build/tasks" );

function stripDirectory( file ) {
return file.replace( /.+\/(.+?)>?$/, "$1" );
}

function createBanner( files ) {

// strip folders
var fileNames = files && files.map( stripDirectory );
const fileNames = files && files.map( stripDirectory );
return "/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - " +
"<%= grunt.template.today('isoDate') %>\n" +
"<%= pkg.homepage ? '* ' + pkg.homepage + '\\n' : '' %>" +
Expand Down Expand Up @@ -182,11 +182,14 @@ grunt.initConfig( {
good: {
options: {
ignore: [
/The text content of element “script” was not in the required format: Expected space, tab, newline, or slash but found “.” instead/
] },
src: glob.sync( "{demos,tests}/**/*.html", {
ignore: htmllintBad
} )
/The text content of element “script” was not in the required format: Expected space, tab, newline, or slash but found “.” instead/,
/This document appears to be written in .*. Consider using “lang=".*"” \(or variant\) instead/
]
},
src: [
"{demos,tests}/**/*.html",
...htmllintBad.map( pattern => `!${ pattern }` )
]
},
bad: {
options: {
Expand All @@ -196,7 +199,7 @@ grunt.initConfig( {
/Element “object” is missing one or more of the following/,
/The “codebase” attribute on the “object” element is obsolete/,
/Consider adding a “lang” attribute to the “html” start tag/,
/This document appears to be written in .*. Consider adding “lang=".*"” \(or variant\) to the “html” start tag/
/This document appears to be written in .*. Consider (?:adding|using) “lang=".*"” \(or variant\)/
]
},
src: htmllintBad
Expand All @@ -208,15 +211,18 @@ grunt.initConfig( {
} ),
options: {
puppeteer: {
ignoreDefaultArgs: true,
args: [
"--headless",
"--disable-web-security",
"--allow-file-access-from-files"
]
},
inject: [
require.resolve( "grunt-contrib-qunit/chrome/bridge" )
require.resolve(
"./tests/lib/grunt-contrib-qunit-bridges/bridge-wrapper.js.intro"
),
require.resolve( "grunt-contrib-qunit/chrome/bridge" ),
require.resolve(
"./tests/lib/grunt-contrib-qunit-bridges/bridge-wrapper.js.outro"
)
],
page: {
viewportSize: { width: 700, height: 500 }
Expand Down Expand Up @@ -266,18 +272,6 @@ grunt.initConfig( {
"qunit/qunit.css": "qunit/qunit/qunit.css",
"qunit/LICENSE.txt": "qunit/LICENSE.txt",

"qunit-assert-classes/qunit-assert-classes.js":
"qunit-assert-classes/qunit-assert-classes.js",
"qunit-assert-classes/LICENSE.txt": "qunit-assert-classes/LICENSE",

"qunit-assert-close/qunit-assert-close.js":
"qunit-assert-close/qunit-assert-close.js",
"qunit-assert-close/MIT-LICENSE.txt": "qunit-assert-close/MIT-LICENSE.txt",

"qunit-composite/qunit-composite.js": "qunit-composite/qunit-composite.js",
"qunit-composite/qunit-composite.css": "qunit-composite/qunit-composite.css",
"qunit-composite/LICENSE.txt": "qunit-composite/LICENSE.txt",

"requirejs/require.js": "requirejs/require.js",

"jquery-mousewheel/jquery.mousewheel.js": "jquery-mousewheel/jquery.mousewheel.js",
Expand Down Expand Up @@ -469,9 +463,22 @@ grunt.initConfig( {
}
} );

// grunt plugins
require( "load-grunt-tasks" )( grunt, {
pattern: nodeV16OrNewer ? [ "grunt-*" ] : [
"grunt-*",
"!grunt-contrib-qunit",
"!grunt-eslint",
"!grunt-html"
]
} );

// local testswarm and build tasks
grunt.loadTasks( "build/tasks" );

grunt.registerTask( "update-authors", function() {
var getAuthors = require( "grunt-git-authors" ).getAuthors,
done = this.async();
const getAuthors = require( "grunt-git-authors" ).getAuthors;
const done = this.async();

getAuthors( {
priorAuthors: grunt.config( "authors.prior" )
Expand Down Expand Up @@ -499,11 +506,21 @@ grunt.registerTask( "update-authors", function() {
} );
} );

grunt.registerTask( "print_old_node_message", ( ...args ) => {
const task = args.join( ":" );
grunt.log.writeln( "Old Node.js detected, running the task \"" + task + "\" skipped..." );
} );

// Keep this task list in sync with the testing steps in our GitHub action test workflow file!
grunt.registerTask( "default", [ "lint", "requirejs", "test" ] );
grunt.registerTask( "jenkins", [ "default", "concat" ] );
grunt.registerTask( "lint", [ "asciilint", "eslint", "csslint", "htmllint" ] );
grunt.registerTask( "test", [ "qunit" ] );
grunt.registerTask( "lint", [
"asciilint",
runIfNewNode( "eslint" ),
"csslint",
runIfNewNode( "htmllint" )
] );
grunt.registerTask( "test", [ runIfNewNode( "qunit" ) ] );
grunt.registerTask( "sizer", [ "requirejs:js", "uglify:main", "compare_size:all" ] );
grunt.registerTask( "sizer_all", [ "requirejs:js", "uglify", "compare_size" ] );

Expand Down
5 changes: 1 addition & 4 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
"jquery-color": "2.2.0",
"jquery-mousewheel": "3.1.12",
"jquery-simulate": "1.1.1",
"qunit": "1.18.0",
"qunit-assert-classes": "1.0.2",
"qunit-assert-close": "JamesMGreene/qunit-assert-close#v1.1.1",
"qunit-composite": "JamesMGreene/qunit-composite#v1.1.0",
"qunit": "2.19.4",
"requirejs": "2.1.14",

"jquery-1.8.0": "jquery#1.8.0",
Expand Down
4 changes: 2 additions & 2 deletions demos/autocomplete/xml.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@

<div class="ui-widget">
<label for="birds">London matches: </label>
<input id="birds" />
<input id="birds">
</div>

<div class="ui-widget" style="margin-top:2em; font-family:Arial">
<div class="ui-widget" style="margin-top:2em; font-family: Arial, sans-serif">
Result:
<div id="log" style="height: 200px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion demos/controlgroup/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ <h1>Controlgroup</h1>
<button>Book Now!</button>
</div>
</fieldset>
<br/>
<br>
<fieldset>
<legend>Rental Car</legend>
<div class="controlgroup-vertical">
Expand Down
2 changes: 1 addition & 1 deletion demos/controlgroup/splitbutton.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h1>Split button</h1>
<option>Delete</option>
</select>
</div>
<br/>
<br>
<h3>Output:</h3>
<ul class="output"></ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion demos/datepicker/alt-field.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</head>
<body>

<p>Date: <input type="text" id="datepicker">&nbsp;<input type="text" id="alternate" size="30"/></p>
<p>Date: <input type="text" id="datepicker">&nbsp;<input type="text" id="alternate" size="30"></p>

<div class="demo-description">
<p>Populate an alternate field with its own date format whenever a date is selected using the <code>altField</code> and <code>altFormat</code> options. This feature could be used to present a human-friendly date for user selection, while passing a more computer-friendly date through for further processing.</p>
Expand Down
Loading