Skip to content

Commit 6e7ce19

Browse files
adriaandotcomactions-user
authored andcommitted
Run prettier via GitHub Action
1 parent dc1a3ef commit 6e7ce19

File tree

12 files changed

+73
-73
lines changed

12 files changed

+73
-73
lines changed

playground/callback.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ <h2>Automated events</h2>
254254
});
255255

256256
const callbackMetadataLink = document.querySelector(
257-
"[data-metadata-callback]",
257+
"[data-metadata-callback]"
258258
);
259259
callbackMetadataLink.addEventListener("click", (event) => {
260260
event.preventDefault();

playground/events.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
},
3434
() => {
3535
console.info(
36-
"Simple Analytics auto events: collected before_script_load",
36+
"Simple Analytics auto events: collected before_script_load"
3737
);
38-
},
38+
}
3939
);
4040
</script>
4141

src/auto-events.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
/^https?:\/\//i.test(link.href) &&
156156
new RegExp(
157157
"\\.(" + (optionsLink.downloadsExtensions || []).join("|") + ")$",
158-
"i",
158+
"i"
159159
).test(link.pathname)
160160
) {
161161
collect = "download";

test/helpers/get-browsers.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ module.exports = async () => {
3838
browser_main_version: version(item.browser_version),
3939
}))
4040
.sort((left, right) =>
41-
version(left.browser_version) > version(right.browser_version) ? -1 : 1,
41+
version(left.browser_version) > version(right.browser_version) ? -1 : 1
4242
)
4343
.slice(0, 2),
44-
["os", "browser_main_version"],
44+
["os", "browser_main_version"]
4545
);
4646

4747
const chrome = makeUnique(
@@ -54,18 +54,18 @@ module.exports = async () => {
5454
);
5555
})
5656
.sort((left, right) =>
57-
version(left.browser_version) > version(right.browser_version) ? -1 : 1,
57+
version(left.browser_version) > version(right.browser_version) ? -1 : 1
5858
),
59-
["os", "os_version"],
59+
["os", "os_version"]
6060
);
6161

6262
const ios = makeUnique(
6363
all
6464
.filter(({ browser }) => browser === "iphone")
6565
.sort((left, right) =>
66-
version(left.browser_version) > version(right.browser_version) ? -1 : 1,
66+
version(left.browser_version) > version(right.browser_version) ? -1 : 1
6767
),
68-
["os", "os_version"],
68+
["os", "os_version"]
6969
);
7070

7171
const android = makeUnique(
@@ -76,9 +76,9 @@ module.exports = async () => {
7676
os_main_version: parseInt(item.os_version.split(".")[0], 10),
7777
}))
7878
.sort((left, right) =>
79-
version(left.os_version) > version(right.os_version) ? -1 : 1,
79+
version(left.os_version) > version(right.os_version) ? -1 : 1
8080
),
81-
["os", "os_main_version"],
81+
["os", "os_main_version"]
8282
);
8383

8484
const safari = makeUnique(
@@ -96,10 +96,10 @@ module.exports = async () => {
9696
browser_main_version: version(item.browser_version),
9797
}))
9898
.sort((left, right) =>
99-
left.browser_main_version > right.browser_main_version ? -1 : 1,
99+
left.browser_main_version > right.browser_main_version ? -1 : 1
100100
)
101101
.slice(0, 4),
102-
["os", "browser_main_version"],
102+
["os", "browser_main_version"]
103103
).slice(0, 5);
104104

105105
const firefox = makeUnique(
@@ -112,9 +112,9 @@ module.exports = async () => {
112112
);
113113
})
114114
.sort((left, right) =>
115-
version(left.browser_version) > version(right.browser_version) ? -1 : 1,
115+
version(left.browser_version) > version(right.browser_version) ? -1 : 1
116116
),
117-
["os"],
117+
["os"]
118118
);
119119

120120
const opera = makeUnique(
@@ -128,9 +128,9 @@ module.exports = async () => {
128128
);
129129
})
130130
.sort((left, right) =>
131-
version(left.browser_version) > version(right.browser_version) ? -1 : 1,
131+
version(left.browser_version) > version(right.browser_version) ? -1 : 1
132132
),
133-
["os"],
133+
["os"]
134134
);
135135

136136
const ipads = makeUnique(
@@ -139,9 +139,9 @@ module.exports = async () => {
139139
return browser === "ipad";
140140
})
141141
.sort((left, right) =>
142-
version(left.os_version) > version(right.os_version) ? -1 : 1,
142+
version(left.os_version) > version(right.os_version) ? -1 : 1
143143
),
144-
["os_version"],
144+
["os_version"]
145145
);
146146

147147
const browsers = [

test/helpers/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports.makeUnique = (array = [], keys = []) => {
2727

2828
return array.reduce((list, item) => {
2929
const has = list.find((listItem) =>
30-
keys.every((key) => listItem[key] === item[key]),
30+
keys.every((key) => listItem[key] === item[key])
3131
);
3232
if (!has) list.push(item);
3333
return list;
@@ -92,7 +92,7 @@ module.exports.navigate = async ({ browser, os, name, driver, commands }) => {
9292
`${amount || 1}x`,
9393
typeof exceeded === "number"
9494
? `(found request in ${exceeded}ms)`
95-
: `(exceeded timeout)`,
95+
: `(exceeded timeout)`
9696
);
9797
} else if (script) {
9898
log(`script (${name})`, `${localhost}/?${searchParams}`);

test/helpers/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const route = async (req, res) => {
6666
<html>
6767
<head><title>Simple Analytics Test</title></head>
6868
<body><h1>Path: ${pathname}</h1></body>
69-
<html>`,
69+
<html>`
7070
);
7171
return res.end();
7272
}

test/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ const log = (...messages) => DEBUG && console.log(" => Test:", ...messages);
144144

145145
if (!BROWSERSTACK_USERNAME || !BROWSERSTACK_ACCESS_KEY) {
146146
console.error(
147-
"BROWSERSTACK_USERNAME nor BROWSERSTACK_ACCESS_KEY are not defined.",
147+
"BROWSERSTACK_USERNAME nor BROWSERSTACK_ACCESS_KEY are not defined."
148148
);
149149
process.exit(1);
150150
}
@@ -213,7 +213,7 @@ const getDeviceName = ({
213213

214214
const suiteInstance = Mocha.Suite.create(
215215
mochaInstance.suite,
216-
"Public Script Test Suite",
216+
"Public Script Test Suite"
217217
);
218218

219219
if (CI)
@@ -223,16 +223,16 @@ const getDeviceName = ({
223223
async function () {
224224
expect(
225225
browsers,
226-
"Should have more than 20 browsers",
226+
"Should have more than 20 browsers"
227227
).to.have.lengthOf.at.least(20);
228-
},
229-
),
228+
}
229+
)
230230
);
231231

232232
suiteInstance.addTest(
233233
new Mocha.Test(`Test Node.js environment`, async function () {
234234
expect(process.version, "Should use Node.js 16.16").to.match(/^v16\.16/);
235-
}),
235+
})
236236
);
237237

238238
const appendBrowserData = (browser) => {
@@ -409,7 +409,7 @@ const getDeviceName = ({
409409
const testName = `Testing ${browser.name} (${index + 1}/${total})`;
410410
const nextBrowser = browsers[index + 1];
411411
suiteInstance.addTest(
412-
new Mocha.Test(testName, () => test(browser, nextBrowser)),
412+
new Mocha.Test(testName, () => test(browser, nextBrowser))
413413
);
414414
}
415415

test/test-beacon.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,48 +9,48 @@ module.exports = async () => {
99

1010
expect(
1111
beaconRequests,
12-
"There are not enough beacon requests found",
12+
"There are not enough beacon requests found"
1313
).to.have.lengthOf(2);
1414

1515
expect(
1616
beaconRequests[0].pathname,
17-
"First beacon request should be send via GIF",
17+
"First beacon request should be send via GIF"
1818
).to.equal("/simple.gif");
1919

2020
expect(
2121
beaconRequests[1].pathname,
22-
"Second beacon request should be send via /append",
22+
"Second beacon request should be send via /append"
2323
).to.equal("/append");
2424

2525
beaconRequests.map((request) => {
2626
expect(
2727
request,
28-
"There are no page view requests with body found",
28+
"There are no page view requests with body found"
2929
).to.have.property("body");
3030

3131
expect(
3232
request.body,
33-
"All required keys should be present",
33+
"All required keys should be present"
3434
).to.include.all.keys(["duration", "scrolled", "original_id", "type"]);
3535

3636
expect(
3737
UUIDvalidate(request.body.original_id, 4),
38-
"original_id should be a valid UUIDv4",
38+
"original_id should be a valid UUIDv4"
3939
).to.be.true;
4040

4141
expect(
4242
parseInt(request.body.scrolled, 10),
43-
"Scrolled should be close to 35 percent",
43+
"Scrolled should be close to 35 percent"
4444
).to.be.closeTo(35, 5);
4545

4646
expect(
4747
parseInt(request.body.duration, 10),
48-
"Duration should be a valid number",
48+
"Duration should be a valid number"
4949
).to.be.a("number");
5050

5151
expect(
5252
parseInt(request.body.duration, 10),
53-
"Duration should be close to 0 or 1 second",
53+
"Duration should be close to 0 or 1 second"
5454
).to.be.closeTo(2, 2);
5555
});
5656
};

test/test-events.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,31 @@ module.exports = async ({ os, browser }) => {
1010
expect(requests, "There should be two event requests").to.have.lengthOf(3);
1111

1212
expect(requests[0].body.event, "Event should be 'event_123'").to.equal(
13-
"event_123",
13+
"event_123"
1414
);
1515

1616
expect(requests[1].body.event, "Event should be 'functionoutput'").to.equal(
17-
"functionoutput",
17+
"functionoutput"
1818
);
1919

2020
expect(requests[2].body.metadata, "Event should have metadata").to.contain(
21-
'","bool":false,"int":20301,"string":"hi\'/301%20uas@#*0"}',
21+
'","bool":false,"int":20301,"string":"hi\'/301%20uas@#*0"}'
2222
);
2323

2424
expect(
2525
new Date(JSON.parse(requests[2].body.metadata).date),
26-
"Event should have a date in the last 5 minutes",
26+
"Event should have a date in the last 5 minutes"
2727
).to.greaterThan(new Date(Date.now() - 300000));
2828

2929
requests.map((request) => {
3030
expect(
3131
request,
32-
"There are no event requests with body found",
32+
"There are no event requests with body found"
3333
).to.have.property("body");
3434

3535
expect(
3636
request.body,
37-
"All required keys should be present",
37+
"All required keys should be present"
3838
).to.include.all.keys([
3939
"version",
4040
"hostname",
@@ -47,34 +47,34 @@ module.exports = async ({ os, browser }) => {
4747

4848
expect(
4949
UUIDvalidate(request.body.id, 4),
50-
"event id should be a valid UUIDv4",
50+
"event id should be a valid UUIDv4"
5151
).to.be.true;
5252

5353
expect(
5454
UUIDvalidate(request.body.session_id, 4),
55-
"session_id should be a valid UUIDv4",
55+
"session_id should be a valid UUIDv4"
5656
).to.be.true;
5757

5858
expect(
5959
UUIDvalidate(request.body.page_id, 4),
60-
"page_id should be a valid UUIDv4",
60+
"page_id should be a valid UUIDv4"
6161
).to.be.true;
6262

6363
if (os === "ios" || browser === "safari") {
6464
expect(
6565
request.body.hostname,
66-
"Hostname should be bs-local.com on OS X Safari",
66+
"Hostname should be bs-local.com on OS X Safari"
6767
).to.equal("bs-local.com:3000");
6868
} else {
6969
expect(
7070
request.body.hostname,
71-
"Hostname should be localhost on non iOS",
71+
"Hostname should be localhost on non iOS"
7272
).to.equal("localhost:3000");
7373
}
7474

7575
expect(
7676
parseInt(request.body.version, 10),
77-
"Version should be a valid number",
77+
"Version should be a valid number"
7878
).to.be.a("number");
7979
});
8080
};

test/test-no-pushstate.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,28 @@ module.exports = async () => {
1111

1212
expect(
1313
pageViewRequests,
14-
"There are not enough page views requests found",
14+
"There are not enough page views requests found"
1515
).to.have.lengthOf(2);
1616

1717
expect(
1818
pageViewRequests[0].body.unique,
19-
"The first visit should be unique",
19+
"The first visit should be unique"
2020
).to.equal("true");
2121

2222
expect(
2323
pageViewRequests[1].body.unique,
24-
"The second visit should not be unique",
24+
"The second visit should not be unique"
2525
).to.equal("false");
2626

2727
pageViewRequests.map((request) => {
2828
expect(
2929
request,
30-
"There are no page view requests with body found",
30+
"There are no page view requests with body found"
3131
).to.have.property("body");
3232

3333
expect(
3434
request.body,
35-
"All required keys should be present",
35+
"All required keys should be present"
3636
).to.include.all.keys([
3737
"hostname",
3838
"https",
@@ -53,7 +53,7 @@ module.exports = async () => {
5353

5454
expect(
5555
parseInt(request.body.version, 10),
56-
"Version should be a valid number",
56+
"Version should be a valid number"
5757
).to.be.a("number");
5858

5959
// We replace "https:" with "http:" string on CI

0 commit comments

Comments
 (0)