Skip to content

Commit ce32a41

Browse files
authored
Modernize the build/test, only assign to the old API in 3.x (#6)
Changes: 1. Modernize the build/test infra: avoid the needless build, use jtr to run tests on real browsers, test browsers on CI. 2. Only assign to the legacy API when jQuery 3.x is used. 3. Update the version from `2.0.0` to `3.0.0`.
1 parent dd36786 commit ce32a41

12 files changed

+1067
-402
lines changed

.github/workflows/browser-tests.yml

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

.github/workflows/node.js.yml

+26-11
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,41 @@
11
name: CI
22

3-
on: [push, pull_request]
3+
on:
4+
pull_request:
5+
push:
6+
branches-ignore: "dependabot/**"
47

58
permissions:
69
contents: read # to fetch code (actions/checkout)
710

11+
env:
12+
NODE_VERSION: 22.x
13+
814
jobs:
9-
build:
15+
node-test:
1016
runs-on: ubuntu-latest
11-
strategy:
12-
fail-fast: false
1317
steps:
1418
- name: Checkout
15-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
20+
21+
- name: Use Node.js ${{ env.NODE_VERSION }}
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: ${{ env.NODE_VERSION }}
1625

17-
- name: Use Node.js ${{ matrix.NODE_VERSION }}
18-
uses: actions/setup-node@v3.6.0
26+
- name: Cache
27+
uses: actions/cache@v4
1928
with:
20-
node-version: 18.x
29+
path: ~/.npm
30+
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
31+
restore-keys: |
32+
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
2133
2234
- name: Install dependencies
23-
run: npm install
35+
run: npm ci
36+
37+
- name: Run lint
38+
run: npm run lint
2439

25-
- name: Run tests
26-
run: npm test
40+
- name: Run Node.js tests
41+
run: npm run test:node

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
/dist
21
/node_modules

.jscsrc

-5
This file was deleted.

jtr.yml

+16
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)