Skip to content

Commit 5dad1ea

Browse files
committed
Add unit test to job
1 parent 46992f6 commit 5dad1ea

File tree

1 file changed

+39
-11
lines changed

1 file changed

+39
-11
lines changed

.github/workflows/browserstack.yml

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,40 @@ on:
99
- main
1010

1111
jobs:
12-
build:
12+
unit-tests:
1313
runs-on: ubuntu-latest
1414

1515
strategy:
1616
matrix:
17-
node-version: [16.16]
17+
node-version: [22]
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
27+
- name: Run npm ci
28+
run: npm ci
29+
30+
- name: Build project
31+
run: npm run build
32+
33+
- name: Run unit tests
34+
run: npm run test:unit
35+
env:
36+
CI: true
37+
NODE_ENV: test
38+
39+
browserstack:
40+
runs-on: ubuntu-latest
41+
needs: unit-tests
42+
43+
strategy:
44+
matrix:
45+
node-version: [22]
1846

1947
steps:
2048
- name: "BrowserStack Env Setup"
@@ -30,13 +58,10 @@ jobs:
3058
local-logging-level: "all-logs"
3159
local-identifier: "random"
3260

33-
- uses: actions/checkout@v3
34-
with:
35-
ref: ${{ github.head_ref }}
36-
set-safe-directory: "/github/workspace"
61+
- uses: actions/checkout@v4
3762

3863
- name: Prettier Action on PR
39-
uses: creyD/prettier_action@v4.3
64+
uses: creyD/prettier_action@v4.5
4065
with:
4166
prettier_options: "--write {**/*,*}.{js,hbs,html,json,md,yml,css,scss} !.github/workflows/**/* !dist/**/*"
4267
commit_message: "Run prettier via GitHub Action"
@@ -45,15 +70,18 @@ jobs:
4570
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4671

4772
- name: Use Node.js ${{ matrix.node-version }}
48-
uses: actions/setup-node@v1
73+
uses: actions/setup-node@v4
4974
with:
5075
node-version: ${{ matrix.node-version }}
5176

5277
- name: Run npm ci
53-
run: sudo npm ci
78+
run: npm ci
79+
80+
- name: Build project
81+
run: npm run build
5482

55-
- name: Run npm test with BrowserStack Local
56-
run: npm run build && node ./test/index.js
83+
- name: Run BrowserStack tests
84+
run: node ./test/index.js
5785
env:
5886
CI: true
5987
NODE_ENV: test

0 commit comments

Comments
 (0)