Skip to content

Commit 91df20b

Browse files
authored
Tests: replace grunt-contrib-qunit with jQuery test runner
- add filestash workflow Close gh-2221
1 parent 802642c commit 91df20b

34 files changed

+12196
-113
lines changed

.editorconfig

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ charset = utf-8
1010
trim_trailing_whitespace = true
1111
insert_final_newline = true
1212

13+
[*.yml]
14+
indent_style = space
15+
indent_size = 2
16+
1317
[external/**]
1418
trim_trailing_whitespace = false
1519
insert_final_newline = varies

.github/workflows/filestash.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Filestash
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read # to fetch code (actions/checkout)
10+
11+
jobs:
12+
update:
13+
runs-on: ubuntu-latest
14+
environment: filestash
15+
env:
16+
NODE_VERSION: 20.x
17+
name: Update Filestash
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
21+
22+
- name: Use Node.js ${{ env.NODE_VERSION }}
23+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
24+
with:
25+
node-version: ${{ env.NODE_VERSION }}
26+
27+
- name: Cache
28+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
29+
with:
30+
path: ~/.npm
31+
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
32+
restore-keys: |
33+
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
34+
35+
- name: Install dependencies
36+
run: npm install
37+
38+
- name: Build
39+
run: npm run build
40+
41+
- name: Set up SSH
42+
run: |
43+
install --directory ~/.ssh --mode 700
44+
base64 --decode <<< "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
45+
chmod 600 ~/.ssh/id_ed25519
46+
ssh-keyscan -t ed25519 -H "${{ secrets.FILESTASH_SERVER }}" >> ~/.ssh/known_hosts
47+
48+
- name: Upload to Filestash
49+
run: |
50+
rsync dist/jquery-ui.js filestash@"${{ secrets.FILESTASH_SERVER }}":ui/jquery-ui-git.js
51+
rsync dist/jquery-ui.css filestash@"${{ secrets.FILESTASH_SERVER }}":ui/jquery-ui-git.css

.github/workflows/node.js.yml

+163
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
name: Node
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches-ignore: "dependabot/**"
7+
# Once a week every Monday
8+
schedule:
9+
- cron: "42 1 * * 1"
10+
11+
permissions:
12+
contents: read
13+
14+
env:
15+
NODE_VERSION: 20.x
16+
17+
jobs:
18+
build-and-test:
19+
runs-on: ubuntu-latest
20+
name: ${{ matrix.BROWSER }} - jQuery ${{ matrix.JQUERY }}
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
BROWSER: [chrome, firefox]
25+
JQUERY:
26+
- "git"
27+
- "3.x-git"
28+
- "3.7.1"
29+
- "2.2.4"
30+
- "1.12.4"
31+
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
35+
36+
- name: Use Node.js ${{ env.NODE_VERSION }}
37+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
38+
with:
39+
node-version: ${{ env.NODE_VERSION }}
40+
41+
- name: Cache
42+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
43+
with:
44+
path: ~/.npm
45+
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
46+
restore-keys: |
47+
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
48+
49+
- name: Install npm dependencies
50+
run: npm install
51+
52+
- name: Lint
53+
run: npm run lint
54+
55+
- name: Build
56+
run: npm run build
57+
58+
- name: Test
59+
run: npm run test:unit -- -h -b ${{ matrix.BROWSER }} --jquery ${{ matrix.JQUERY }} --retries 3
60+
61+
edge:
62+
runs-on: windows-latest
63+
name: edge - jQuery ${{ matrix.JQUERY }}
64+
strategy:
65+
fail-fast: false
66+
matrix:
67+
JQUERY:
68+
- "git"
69+
- "3.x-git"
70+
- "3.7.1"
71+
- "2.2.4"
72+
- "1.12.4"
73+
steps:
74+
- name: Checkout
75+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
76+
77+
- name: Use Node.js ${{ env.NODE_VERSION }}
78+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
79+
with:
80+
node-version: ${{ env.NODE_VERSION }}
81+
82+
- name: Cache
83+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
84+
with:
85+
path: ~/.npm
86+
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
87+
restore-keys: |
88+
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
89+
90+
- name: Install dependencies
91+
run: npm install
92+
93+
- name: Build
94+
run: npm run build
95+
96+
- name: Test
97+
run: npm run test:unit -- -h -b edge --jquery ${{ matrix.JQUERY }} --retries 3
98+
99+
safari:
100+
runs-on: macos-latest
101+
name: safari - jQuery ${{ matrix.JQUERY }}
102+
strategy:
103+
fail-fast: false
104+
matrix:
105+
JQUERY:
106+
- "git"
107+
- "3.x-git"
108+
- "3.7.1"
109+
- "2.2.4"
110+
- "1.12.4"
111+
steps:
112+
- name: Checkout
113+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
114+
115+
- name: Use Node.js ${{ env.NODE_VERSION }}
116+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
117+
with:
118+
node-version: ${{ env.NODE_VERSION }}
119+
120+
- name: Cache
121+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
122+
with:
123+
path: ~/.npm
124+
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
125+
restore-keys: |
126+
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
127+
128+
- name: Install dependencies
129+
run: npm install
130+
131+
- name: Build
132+
run: npm run build
133+
134+
- name: Test
135+
run: npm run test:unit -- -b safari --jquery ${{ matrix.JQUERY }} --retries 3
136+
137+
legacy-build:
138+
runs-on: ubuntu-latest
139+
name: Build on Node 10.x
140+
env:
141+
NODE_VERSION: 10.x
142+
steps:
143+
- name: Checkout
144+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
145+
146+
- name: Use Node.js ${{ env.NODE_VERSION }}
147+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
148+
with:
149+
node-version: ${{ env.NODE_VERSION }}
150+
151+
- name: Cache
152+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
153+
with:
154+
path: ~/.npm
155+
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
156+
restore-keys: |
157+
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
158+
159+
- name: Install npm dependencies
160+
run: npm install
161+
162+
- name: Build
163+
run: npm run build

.github/workflows/test.yml

-63
This file was deleted.

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
save-exact=true

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ The tests require a local web server and the samples contain some PHP, so a PHP
7777

7878
### Running the Tests
7979

80-
To lint the JavaScript, HTML, and CSS, as well as run a smoke test in PhantomJS, run the full test suite through npm:
80+
To lint the JavaScript, HTML, and CSS, as well as run the full test suite in Headless Chrome:
8181

8282
```bash
8383
npm test

Gruntfile.js

+7-30
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ const compareFiles = {
7777
"dist/jquery-ui.min.js"
7878
]
7979
};
80-
const component = grunt.option( "component" ) || "**";
8180

8281
const htmllintBad = [
8382
"demos/tabs/ajax/content*.html",
@@ -205,30 +204,6 @@ grunt.initConfig( {
205204
src: htmllintBad
206205
}
207206
},
208-
qunit: {
209-
files: expandFiles( "tests/unit/" + component + "/*.html" ).filter( function( file ) {
210-
return !( /(all|index|test)\.html$/ ).test( file );
211-
} ),
212-
options: {
213-
puppeteer: {
214-
args: [
215-
"--allow-file-access-from-files"
216-
]
217-
},
218-
inject: [
219-
require.resolve(
220-
"./tests/lib/grunt-contrib-qunit-bridges/bridge-wrapper.js.intro"
221-
),
222-
require.resolve( "grunt-contrib-qunit/chrome/bridge" ),
223-
require.resolve(
224-
"./tests/lib/grunt-contrib-qunit-bridges/bridge-wrapper.js.outro"
225-
)
226-
],
227-
page: {
228-
viewportSize: { width: 700, height: 500 }
229-
}
230-
}
231-
},
232207
eslint: {
233208
all: [
234209
"ui/**/*.js",
@@ -430,6 +405,9 @@ grunt.initConfig( {
430405
"jquery-3.7.0/jquery.js": "jquery-3.7.0/dist/jquery.js",
431406
"jquery-3.7.0/LICENSE.txt": "jquery-3.7.0/LICENSE.txt",
432407

408+
"jquery-3.7.1/jquery.js": "jquery-3.7.1/dist/jquery.js",
409+
"jquery-3.7.1/LICENSE.txt": "jquery-3.7.1/LICENSE.txt",
410+
433411
"jquery-migrate-1.4.1/jquery-migrate.js":
434412
"jquery-migrate-1.4.1/dist/jquery-migrate.js",
435413
"jquery-migrate-1.4.1/LICENSE.txt": "jquery-migrate-1.4.1/LICENSE.txt",
@@ -473,13 +451,12 @@ grunt.initConfig( {
473451
require( "load-grunt-tasks" )( grunt, {
474452
pattern: nodeV16OrNewer ? [ "grunt-*" ] : [
475453
"grunt-*",
476-
"!grunt-contrib-qunit",
477454
"!grunt-eslint",
478455
"!grunt-html"
479456
]
480457
} );
481458

482-
// local testswarm and build tasks
459+
// local tasks
483460
grunt.loadTasks( "build/tasks" );
484461

485462
grunt.registerTask( "update-authors", function() {
@@ -518,15 +495,15 @@ grunt.registerTask( "print_old_node_message", ( ...args ) => {
518495
} );
519496

520497
// Keep this task list in sync with the testing steps in our GitHub action test workflow file!
521-
grunt.registerTask( "default", [ "lint", "requirejs", "test" ] );
522-
grunt.registerTask( "jenkins", [ "default", "concat" ] );
523498
grunt.registerTask( "lint", [
524499
"asciilint",
525500
runIfNewNode( "eslint" ),
526501
"csslint",
527502
runIfNewNode( "htmllint" )
528503
] );
529-
grunt.registerTask( "test", [ runIfNewNode( "qunit" ) ] );
504+
grunt.registerTask( "build", [ "requirejs", "concat" ] );
505+
grunt.registerTask( "default", [ "lint", "build" ] );
506+
grunt.registerTask( "jenkins", [ "build" ] );
530507
grunt.registerTask( "sizer", [ "requirejs:js", "uglify:main", "compare_size:all" ] );
531508
grunt.registerTask( "sizer_all", [ "requirejs:js", "uglify", "compare_size" ] );
532509

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ For more information, see the [contributing page](CONTRIBUTING.md).
2929

3030
Run the unit tests manually with appropriate browsers and any local web server. See our [environment setup](CONTRIBUTING.md#environment-minimum-required) and [information on running tests](CONTRIBUTING.md#running-the-tests).
3131

32-
You can also run the unit tests inside phantomjs by [setting up your environment](CONTRIBUTING.md#user-content-environment-recommended-setup).
32+
You can also run the unit tests `npm run test:unit -- --help`.

0 commit comments

Comments
 (0)