twd-cli 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +18 -7
- package/bin/twd-cli.js +0 -0
- package/package.json +5 -5
- package/src/index.js +14 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## <small>1.0.5 (2025-12-03)</small>
|
|
2
|
+
|
|
3
|
+
* chore: update dependencies ([4cf3e77](https://github.com/BRIKEV/twd-cli/commit/4cf3e77))
|
|
4
|
+
|
|
5
|
+
## <small>1.0.4 (2025-11-26)</small>
|
|
6
|
+
|
|
7
|
+
* fix: better log errors ([25319ca](https://github.com/BRIKEV/twd-cli/commit/25319ca))
|
|
8
|
+
|
|
1
9
|
## <small>1.0.3 (2025-11-24)</small>
|
|
2
10
|
|
|
3
11
|
* fix: error selector ([1e081a6](https://github.com/BRIKEV/twd-cli/commit/1e081a6))
|
package/README.md
CHANGED
|
@@ -64,19 +64,30 @@ Create a `twd.config.json` file in your project root to customize settings:
|
|
|
64
64
|
|
|
65
65
|
## CI/CD Integration
|
|
66
66
|
|
|
67
|
-
The CLI exits with code 1 if any tests fail, making it perfect for CI/CD pipelines
|
|
67
|
+
The CLI exits with code 1 if any tests fail, making it perfect for CI/CD pipelines.
|
|
68
|
+
Puppeteer 24+ no longer auto-downloads Chrome, so make sure you install the browser on each runner (or restore it from a cache) before launching the tests.
|
|
68
69
|
|
|
69
70
|
```yaml
|
|
70
71
|
# Example GitHub Actions workflow
|
|
71
|
-
- name:
|
|
72
|
+
- name: Install dependencies
|
|
73
|
+
run: npm ci
|
|
74
|
+
|
|
75
|
+
- name: Cache Puppeteer browsers
|
|
76
|
+
uses: actions/cache@v4
|
|
77
|
+
with:
|
|
78
|
+
path: ~/.cache/puppeteer
|
|
79
|
+
key: ${{ runner.os }}-puppeteer-${{ hashFiles('package-lock.json') }}
|
|
80
|
+
restore-keys: |
|
|
81
|
+
${{ runner.os }}-puppeteer-
|
|
82
|
+
|
|
83
|
+
- name: Install Chrome for Puppeteer
|
|
84
|
+
run: npx puppeteer browsers install chrome
|
|
85
|
+
|
|
86
|
+
- name: Run TWD tests
|
|
72
87
|
run: npx twd-cli run
|
|
73
88
|
```
|
|
74
89
|
|
|
75
90
|
## Requirements
|
|
76
91
|
|
|
77
|
-
- Node.js >=
|
|
92
|
+
- Node.js >= 20.19.x
|
|
78
93
|
- A running development server with TWD tests
|
|
79
|
-
|
|
80
|
-
## License
|
|
81
|
-
|
|
82
|
-
ISC
|
package/bin/twd-cli.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "twd-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "CLI tool for running TWD tests with Puppeteer",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
"author": "",
|
|
24
24
|
"license": "ISC",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"puppeteer": "^24.
|
|
27
|
-
"twd-js": "^1.2.
|
|
26
|
+
"puppeteer": "^24.32.0",
|
|
27
|
+
"twd-js": "^1.2.3"
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|
|
30
30
|
"node": ">=18.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@vitest/coverage-v8": "^4.0.
|
|
33
|
+
"@vitest/coverage-v8": "^4.0.15",
|
|
34
34
|
"conventional-changelog": "^7.1.1",
|
|
35
|
-
"vitest": "^4.0.
|
|
35
|
+
"vitest": "^4.0.15"
|
|
36
36
|
}
|
|
37
37
|
}
|
package/src/index.js
CHANGED
|
@@ -4,22 +4,21 @@ import puppeteer from 'puppeteer';
|
|
|
4
4
|
import { reportResults } from 'twd-js/runner-ci';
|
|
5
5
|
import { loadConfig } from './config.js';
|
|
6
6
|
|
|
7
|
-
export async function runTests() {
|
|
8
|
-
const config = loadConfig();
|
|
9
|
-
const workingDir = process.cwd();
|
|
10
|
-
|
|
11
|
-
console.log('Starting TWD test runner...');
|
|
12
|
-
console.log('Configuration:', JSON.stringify(config, null, 2));
|
|
13
|
-
|
|
14
|
-
const browser = await puppeteer.launch({
|
|
15
|
-
headless: config.headless,
|
|
16
|
-
args: config.puppeteerArgs,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const page = await browser.newPage();
|
|
20
|
-
console.time('Total Test Time');
|
|
21
|
-
|
|
7
|
+
export async function runTests() {
|
|
22
8
|
try {
|
|
9
|
+
const config = loadConfig();
|
|
10
|
+
const workingDir = process.cwd();
|
|
11
|
+
|
|
12
|
+
console.log('Starting TWD test runner...');
|
|
13
|
+
console.log('Configuration:', JSON.stringify(config, null, 2));
|
|
14
|
+
|
|
15
|
+
const browser = await puppeteer.launch({
|
|
16
|
+
headless: config.headless,
|
|
17
|
+
args: config.puppeteerArgs,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const page = await browser.newPage();
|
|
21
|
+
console.time('Total Test Time');
|
|
23
22
|
// Navigate to your development server
|
|
24
23
|
console.log(`Navigating to ${config.url} ...`);
|
|
25
24
|
await page.goto(config.url);
|