Skip to content

Commit bbe3283

Browse files
authored
Merge pull request #886 from calibreapp/host-blocking
🚫 Single Page Test host blocking
2 parents 61c48b9 + fbc714a commit bbe3283

22 files changed

Lines changed: 116 additions & 62 deletions

.github/workflows/test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
name: Test Node.js
2+
permissions:
3+
contents: read
24

35
on: [push]
46

@@ -9,7 +11,7 @@ jobs:
911
strategy:
1012
fail-fast: false
1113
matrix:
12-
node-version: [20.x, 22.x, 24.x]
14+
node-version: [20.x, 22.x, 24.x, 25.x]
1315
os: [ubuntu-latest, windows-latest, macos-latest]
1416
timeout-minutes: 5
1517
steps:

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# 6.3.0 (2025-12-10)
2+
3+
## 🚩 Commands and flags
4+
5+
- Added support for host blocking to `calibre test create` command via new `--blockedHosts` flag. Supports wildcard patterns (e.g., `*.google-analytics.com`), comma-separated lists, JSON arrays, or file paths.
6+
- Removed adblocking support from Single Page Tests, Test Profiles & Synthetic Test Results. Adblocking support was deprecated March 25' (https://calibreapp.com/changelog/archive/2025/03-host-blocking), and removed December 25'.
7+
- Removed `--adblocker` flag from `calibre test create`, `calibre site create-test-profile`, and `calibre site update-test-profile` commands.
8+
9+
## 🛠 Core
10+
11+
- Updated Node.js example (`examples/nodejs/create-test.js`) to demonstrate `blockedHosts` usage with wildcard patterns.
12+
13+
## 🧹 Housekeeping
14+
15+
- Update dependencies in response to latest dependabot updates and security patches.
16+
117
# 6.2.1 (2025-10-20)
218

319
## 🐛 Bug fixes

CLI_COMMANDS.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ Flags:
202202
* `--device`: Choose the emulated test device. (default: `Desktop`),
203203
* `--connection`: Choose the emulated network connection speed.,
204204
* `--javascript`: Turn JavaScript execution on or off. (default: `true`) (boolean),
205-
* `--adblocker`: Turn adblocking on or off. (boolean),
206205
* `--cookie-jar`: Set cookies by specifying a path to a Netscape formatted cookie jar file.,
207206
* `--json`: Outputs the results of the command in JSON format.
208207

@@ -219,7 +218,6 @@ Flags:
219218
* `--site`: A unique slug identifying each Site. You can find it in Site Settings → General or by using the calibre site list command. (string),
220219
* `--json`: Outputs the results of the command in JSON format.,
221220
* `--javascript`: Turn JavaScript execution on or off (default: `true`) (boolean),
222-
* `--adblocker`: Turn adblocking on or off. (boolean),
223221
* `--cookie-jar`: Set cookies by specifying a path to a Netscape formatted cookie jar file.
224222

225223

@@ -294,11 +292,11 @@ Flags:
294292
* `--connection`: Choose the emulated network connection speed.,
295293
* `--webhookUrl`: Test result JSON will be sent to this URL using HTTP POST.,
296294
* `--webhookSecret`: Secret used to sign the webhook payload. Secret can be validated using `Calibre-HMAC-SHA256-Signature` HTTP header. See https://calibreapp.com/docs/integrations/webhooks#webhook-security-and-verification for more information.,
297-
* `--adblocker`: Turn adblocking on or off. (boolean),
298295
* `--private`: Make the results of a test private (only accessible by members of your Calibre organisation). (boolean),
299-
* `--expiresAt`: Set a future UTC date time string (ISO8601). After this date, the test will be automatically deleted. (Min=24 hrs, Max=2 years) e.g.: 2025-12-31T23:59:59Z (Default: Expires 1 year from creation date.: `2026-09-25T14:11:14.450Z`) (string),
296+
* `--expiresAt`: Set a future UTC date time string (ISO8601). After this date, the test will be automatically deleted. (Min=24 hrs, Max=2 years) e.g.: 2025-12-31T23:59:59Z (Default: Expires 1 year from creation date.: `2026-12-10T09:21:50.354Z`) (string),
300297
* `--cookie-jar`: Set cookies by specifying a path to a Netscape formatted cookie jar file.,
301298
* `--headers`: Set HTTP headers by providing a path to a JSON file or a valid JSON key-value pairs.,
299+
* `--blockedHosts`: Block hosts by providing a comma-separated list, a path to a JSON file, or a valid JSON array. Supports wildcards (e.g., "*.example.com").,
302300
* `--json`: Outputs the results of the command in JSON format.,
303301
* `--markdown`: Outputs the results of the command in Markdown format.,
304302
* `--waitForTest`: Wait for the test to complete before showing the results (default: test result link is shown immediately). (boolean)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2+
3+
exports[`test create with blockedHosts should accept JSON array for blocked hosts 1`] = `""`;
4+
5+
exports[`test create with blockedHosts should accept comma-separated blocked hosts 1`] = `""`;
6+
7+
exports[`test create with blockedHosts should work without blocked hosts 1`] = `""`;

__tests__/cli/test/create.test.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import {
2+
runCLI,
3+
setupIntegrationServer,
4+
teardownIntegrationServer
5+
} from '../../utils'
6+
7+
const mockResponse = {
8+
data: {
9+
createTest: {
10+
uuid: 'test-uuid-123',
11+
formattedTestUrl: 'https://calibreapp.com/test/test-uuid-123'
12+
}
13+
}
14+
}
15+
16+
describe('test create with blockedHosts', () => {
17+
beforeAll(async () => await setupIntegrationServer(mockResponse))
18+
afterAll(async () => await teardownIntegrationServer())
19+
20+
test('should accept comma-separated blocked hosts', async () => {
21+
const out = await runCLI({
22+
args:
23+
'test create https://example.com --location=Sydney --blockedHosts="*.google-analytics.com,*.facebook.com"'
24+
})
25+
expect(out).toMatchSnapshot()
26+
})
27+
28+
test('should accept JSON array for blocked hosts', async () => {
29+
const out = await runCLI({
30+
args:
31+
'test create https://example.com --location=Sydney --blockedHosts=\'["*.google-analytics.com","*.facebook.com"]\''
32+
})
33+
expect(out).toMatchSnapshot()
34+
})
35+
36+
test('should work without blocked hosts', async () => {
37+
const out = await runCLI({
38+
args: 'test create https://example.com --location=Sydney'
39+
})
40+
expect(out).toMatchSnapshot()
41+
})
42+
})

__tests__/fixtures/completedTest.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"formattedTestUrl": "https://calibreapp.com/tests/b3baaa1/1fe9862",
55
"status": "completed",
66
"updatedAt": "2019-04-26T05:09:26Z",
7-
"adBlockerIsEnabled": false,
87
"runtimeError": {
98
"code": "NO_ERROR",
109
"message": ""

__tests__/fixtures/erroredTest.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"formattedTestUrl": "https://calibreapp.com/tests/b3baaa1/1fe9862",
55
"status": "errored",
66
"updatedAt": "2019-04-26T05:09:26Z",
7-
"adBlockerIsEnabled": false,
87
"runtimeError": {
98
"code": "INTERSTITIAL_ERROR",
109
"message": "Calibre was unable to load the page. Please make sure the page URL and site authentication settings are correct."

__tests__/fixtures/incompleteTest.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"formattedTestUrl": "https://calibreapp.com/tests/b3baaa1/1fe9862",
55
"status": "completed",
66
"updatedAt": "2019-04-26T05:09:26Z",
7-
"adBlockerIsEnabled": false,
87
"runtimeError": {
98
"code": "NO_ERROR",
109
"message": ""

__tests__/fixtures/timeoutTest.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"formattedTestUrl": "https://calibreapp.com/tests/b3baaa1/1fe9862",
55
"status": "timeout",
66
"updatedAt": "2019-04-26T05:09:26Z",
7-
"adBlockerIsEnabled": false,
87
"runtimeError": {
98
"code": "INTERSTITIAL_ERROR",
109
"message": "Calibre was unable to load the page. Please make sure the page URL and site authentication settings are correct."

examples/nodejs/create-test.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,21 @@ const createTest = async () => {
2727
value: 'My Custom User Agent'
2828
}
2929
]
30+
const blockedHosts = [
31+
'*.google-analytics.com',
32+
'*.facebook.com',
33+
'ads.example.com'
34+
]
3035

3136
// Create the test
32-
const { formattedTestUrl } = await Test.create({
37+
const { formattedTestUrl, uuid } = await Test.create({
3338
url,
3439
location,
3540
device,
3641
connection,
3742
cookies,
3843
headers,
44+
blockedHosts,
3945
isPrivate
4046
})
4147

0 commit comments

Comments
 (0)