Skip to content

Commit 258a288

Browse files
committed
Modernize the buid/test, fix Migrate issues
Changes: 1. Modernize the build/test infra: avoid the needless build, use jtr to run tests on real browsers, test browsers on CI. 2. Make the plugin not cause jQuery Migrate warnings due to assignment to the legacy API.
1 parent dd36786 commit 258a288

File tree

12 files changed

+1067
-398
lines changed

12 files changed

+1067
-398
lines changed
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Browser Tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
env:
10+
NODE_VERSION: 22.x
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
name: ${{ matrix.BROWSER }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
BROWSER: ["chrome", "firefox"]
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Use Node.js ${{ env.NODE_VERSION }}
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ env.NODE_VERSION }}
28+
29+
- name: Cache
30+
uses: actions/cache@v4
31+
with:
32+
path: ~/.npm
33+
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
34+
restore-keys: |
35+
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
36+
37+
- name: Install dependencies
38+
run: npm ci
39+
40+
- name: Run tests
41+
run: npm run test:browser
42+
43+
ie:
44+
runs-on: windows-latest
45+
name: Edge in IE mode
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
49+
50+
- name: Use Node.js ${{ env.NODE_VERSION }}
51+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
52+
with:
53+
node-version: ${{ env.NODE_VERSION }}
54+
55+
- name: Cache
56+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
57+
with:
58+
path: ~/.npm
59+
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
60+
restore-keys: |
61+
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
62+
63+
- name: Install dependencies
64+
run: npm ci
65+
66+
- name: Run tests
67+
shell: cmd
68+
run: npm run test:ie
69+
70+
safari:
71+
runs-on: macos-latest
72+
name: Safari
73+
steps:
74+
- name: Checkout
75+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
76+
77+
- name: Use Node.js ${{ env.NODE_VERSION }}
78+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
79+
with:
80+
node-version: ${{ env.NODE_VERSION }}
81+
82+
- name: Cache
83+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
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 ci
92+
93+
- name: Run tests
94+
run: npm run test:safari

.github/workflows/node.js.yml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,34 @@ on: [push, pull_request]
55
permissions:
66
contents: read # to fetch code (actions/checkout)
77

8+
env:
9+
NODE_VERSION: 22.x
10+
811
jobs:
9-
build:
12+
node-test:
1013
runs-on: ubuntu-latest
11-
strategy:
12-
fail-fast: false
1314
steps:
1415
- name: Checkout
15-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
17+
18+
- name: Use Node.js ${{ env.NODE_VERSION }}
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: ${{ env.NODE_VERSION }}
1622

17-
- name: Use Node.js ${{ matrix.NODE_VERSION }}
18-
uses: actions/[email protected]
23+
- name: Cache
24+
uses: actions/cache@v4
1925
with:
20-
node-version: 18.x
26+
path: ~/.npm
27+
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
28+
restore-keys: |
29+
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
2130
2231
- name: Install dependencies
23-
run: npm install
32+
run: npm ci
33+
34+
- name: Run lint
35+
run: npm run lint
2436

25-
- name: Run tests
26-
run: npm test
37+
- name: Run Node.js tests
38+
run: npm run test:node

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
/dist
21
/node_modules

.jscsrc

Lines changed: 0 additions & 5 deletions
This file was deleted.

jtr.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 1
2+
3+
runs:
4+
jquery:
5+
- git
6+
- git.min
7+
- 4.0.0-beta.2
8+
- 4.0.0-beta.2.min
9+
- 3.x-git
10+
- 3.x-git.min
11+
- 3.7.1
12+
- 3.7.1.min
13+
- 3.6.4
14+
- 3.6.4.min
15+
16+
retries: 1

0 commit comments

Comments
 (0)