Skip to content

Commit 5ee72b9

Browse files
Merge branch 'v12' into codex/skip-automated-events-for-data-simple-event-elements
2 parents bfd91a4 + 912f482 commit 5ee72b9

File tree

7 files changed

+52
-29
lines changed

7 files changed

+52
-29
lines changed

.eslintrc.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ module.exports = {
1212
SharedArrayBuffer: "readonly",
1313
},
1414
parserOptions: {
15-
ecmaVersion: 2018,
15+
ecmaVersion: 2020,
1616
},
17+
overrides: [
18+
{
19+
files: ["test/**/*.js"],
20+
env: { mocha: true },
21+
},
22+
],
1723
rules: {},
1824
};

.github/workflows/testing.yml

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
name: Browserstack
22

33
on:
4+
workflow_dispatch:
45
pull_request:
56
types: [opened, synchronize]
67
push:
78
branches:
89
- main
9-
workflow_dispatch:
10+
11+
env:
12+
NODE_VERSION: 22.16
1013

1114
jobs:
1215
linting:
1316
runs-on: ubuntu-latest
1417
if: github.event_name == 'pull_request'
1518

16-
strategy:
17-
matrix:
18-
node-version: [22.16]
19-
2019
steps:
2120
- uses: actions/checkout@v4
2221

23-
- name: Use Node.js ${{ matrix.node-version }}
22+
- name: Use Node.js ${{ env.NODE_VERSION }}
2423
uses: actions/setup-node@v4
2524
with:
26-
node-version: ${{ matrix.node-version }}
25+
node-version: ${{ env.NODE_VERSION }}
2726

2827
- name: Run npm ci
2928
run: npm ci
@@ -39,17 +38,13 @@ jobs:
3938
unit-tests:
4039
runs-on: ubuntu-latest
4140

42-
strategy:
43-
matrix:
44-
node-version: [22.16]
45-
4641
steps:
4742
- uses: actions/checkout@v4
4843

49-
- name: Use Node.js ${{ matrix.node-version }}
44+
- name: Use Node.js ${{ env.NODE_VERSION }}
5045
uses: actions/setup-node@v4
5146
with:
52-
node-version: ${{ matrix.node-version }}
47+
node-version: ${{ env.NODE_VERSION }}
5348

5449
- name: Run npm ci
5550
run: npm ci
@@ -63,14 +58,37 @@ jobs:
6358
CI: true
6459
NODE_ENV: test
6560

66-
browserstack:
61+
build:
6762
runs-on: ubuntu-latest
68-
needs: [unit-tests, linting]
63+
needs: unit-tests
6964
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch'
7065

71-
strategy:
72-
matrix:
73-
node-version: [22.16]
66+
steps:
67+
- uses: actions/checkout@v4
68+
69+
- name: Use Node.js ${{ env.NODE_VERSION }}
70+
uses: actions/setup-node@v4
71+
with:
72+
node-version: ${{ env.NODE_VERSION }}
73+
74+
- name: Run npm ci
75+
run: npm ci
76+
77+
- name: Build project
78+
run: npm run build
79+
80+
- name: Commit build changes
81+
run: |
82+
git config --local user.email "[email protected]"
83+
git config --local user.name "GitHub Action"
84+
git add dist/
85+
git diff --staged --quiet || git commit -m "Update build artifacts [skip ci]"
86+
git push
87+
88+
browserstack:
89+
runs-on: ubuntu-latest
90+
needs: [unit-tests, linting, build]
91+
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch'
7492

7593
steps:
7694
- name: "BrowserStack Env Setup"
@@ -88,10 +106,10 @@ jobs:
88106

89107
- uses: actions/checkout@v4
90108

91-
- name: Use Node.js ${{ matrix.node-version }}
109+
- name: Use Node.js ${{ env.NODE_VERSION }}
92110
uses: actions/setup-node@v4
93111
with:
94-
node-version: ${{ matrix.node-version }}
112+
node-version: ${{ env.NODE_VERSION }}
95113

96114
- name: Run npm ci
97115
run: npm ci

dist/latest/auto-events.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/default.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@
165165
}).length === 0
166166
);
167167
/** else **/
168+
// eslint-disable-next-line no-unreachable
168169
return true;
169170
/** endif **/
170171
};
@@ -253,6 +254,7 @@
253254
if (ignore && !allowParams.length) return falseVar;
254255
/** else **/
255256
if (ignore) return falseVar;
257+
// eslint-disable-next-line no-redeclare
256258
var regex =
257259
"^((utm_)" +
258260
(strictUtm ? "" : "?") +
@@ -498,6 +500,7 @@
498500
isBotAgent ||
499501
Math.random() == Math.random();
500502
/** else **/
503+
// eslint-disable-next-line no-redeclare
501504
var bot = isBotAgent;
502505
/** endif **/
503506

test/helpers/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const crypto = require("crypto");
2-
const { networkInterfaces: getNetworkInterfaces } = require("os");
32
const { DEBUG, SERVER_PORT } = require("../constants");
43
const { promisify } = require("util");
54
const { By, Key } = require("selenium-webdriver");

test/helpers/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const url = require("url");
22
const http = require("http");
33
const { readFileSync } = require("fs");
4-
const { SERVER_PORT, DEBUG, CI } = require("../constants");
4+
const { SERVER_PORT, DEBUG } = require("../constants");
55
const { getJSONBody } = require("./request");
66

77
const log = (...messages) =>

test/index.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,14 @@ const getDeviceName = ({
267267
if (nextDriver) {
268268
log(`Reusing next driver...`);
269269
driver = await nextDriver;
270+
// eslint-disable-next-line require-atomic-updates
270271
nextDriver = null;
271272
} else {
272273
log(`Waiting to get ${browser.name}...`);
273274
driver = await getDriverWithTimeout(browser);
274275
}
275276

277+
// eslint-disable-next-line require-atomic-updates
276278
nextDriver = backgroundDriver;
277279

278280
// Try again with new device when driver is not available
@@ -328,8 +330,6 @@ const getDeviceName = ({
328330
// Empty global REQUESTS
329331
global.REQUESTS = [];
330332

331-
let errorMessage = null;
332-
333333
try {
334334
await navigate({
335335
...browser,
@@ -383,9 +383,6 @@ const getDeviceName = ({
383383
});
384384

385385
await require("./test-events")(browser);
386-
} catch (error) {
387-
errorMessage = error.message;
388-
throw error;
389386
} finally {
390387
// if (!driver) return;
391388
// try {

0 commit comments

Comments
 (0)