@currents/cmd 2.0.0 → 2.0.2
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/README.md
CHANGED
|
@@ -4,10 +4,16 @@ CLI tool for [Currents](https://currents.dev) - a cloud platform for debugging,
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
+
Requires Node.js 20 or later.
|
|
8
|
+
|
|
7
9
|
```sh
|
|
8
10
|
npm install @currents/cmd --save-dev
|
|
9
11
|
```
|
|
10
12
|
|
|
13
|
+
Outside a project that installs `@currents/cmd`, run `npx --package @currents/cmd@2 currents`. Without the package, `npx currents` runs an unrelated npm package named `currents`.
|
|
14
|
+
|
|
15
|
+
Upgrading from 1.x: see [Upgrade @currents/cmd to 2.0](https://docs.currents.dev/resources/reporters/currents-cmd/upgrade-to-v2).
|
|
16
|
+
|
|
11
17
|
## Upload test results
|
|
12
18
|
|
|
13
19
|
- Generate test results with one of the [supported](https://docs.currents.dev) reporters
|
|
@@ -36,6 +42,8 @@ Obtain `--project-id` and [--key](https://docs.currents.dev/guides/record-key) f
|
|
|
36
42
|
- use `process.env.CURRENTS_REPORT_DIR` or `--report-dir` to read the results previously generated by one of supported reporters, otherwise
|
|
37
43
|
- use the most recently created folder named as `.currents/[timestamp]-[uuidv4()]` in the current working directory
|
|
38
44
|
|
|
45
|
+
`currents run upload` sends the list of every test of the run, which Currents uses to show the progress of a sharded run. It reads the list from `fullTestSuite.json`, which `@currents/jest` writes to the report, or builds it from the results. A shard has only the results of its own tests, so without `fullTestSuite.json` the command runs the Jest installed in the current folder to list the tests of every shard. Run it from the project folder, with Jest 29.5 or later installed. `@currents/cmd` does not install Jest. In a Detox project, that Jest run loads the test files in the `node` test environment, so Detox does not start a device. A test file that uses Detox while it loads gets its tests from the results of the shard that ran it, and the command prints a warning.
|
|
46
|
+
|
|
39
47
|
For [Detox](https://wix.github.io/Detox/) runs reported by `@currents/jest`, `currents run upload` also attaches the videos, screenshots and logs that Detox recorded to the matching test attempt, adds the element actions of `detox.trace.json` as steps, and uploads `detox.trace.json`. Run it after `detox test` exits: Detox finishes writing the files only then.
|
|
40
48
|
|
|
41
49
|
### Configuration
|
|
@@ -56,13 +64,45 @@ Please note that all options apart from `--project-id` and `--key` are optional.
|
|
|
56
64
|
|
|
57
65
|
An option on the command line wins over its environment variable. The configuration is also available by running the CLI command with the `--help` argument.
|
|
58
66
|
|
|
59
|
-
##
|
|
67
|
+
## Attach files to a run
|
|
68
|
+
|
|
69
|
+
`currents run attach` uploads files, such as logs or screenshots, to a run that CI already recorded. It uses the record key, or an API key with write access when no record key is set:
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
npx currents run attach --key <record-key> --project-id <id> --ci-build-id <build-id> --machine-id shard-1 docker-logs.zip
|
|
73
|
+
npx currents run attach --key <record-key> --project-id <id> --ci-build-id <build-id> --spec tests/cart.spec.ts --test-title "adds an item" --attempt 0 screenshot.png
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Without `--spec`, the files are attached to the whole run. For the options, run `npx currents run attach --help`.
|
|
77
|
+
|
|
78
|
+
## Cancel a run
|
|
79
|
+
|
|
80
|
+
`currents run cancel` cancels a run in progress, for example when its CI job is cancelled. It uses the record key:
|
|
60
81
|
|
|
61
|
-
|
|
82
|
+
```sh
|
|
83
|
+
npx currents run cancel --key <record-key> --project-id <id> --ci-build-id <build-id>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
See [Cancel Runs on Workflow Cancellation](https://docs.currents.dev/getting-started/ci-setup/github-actions/cancel-runs) for GitHub Actions.
|
|
87
|
+
|
|
88
|
+
## Capture a session as evidence
|
|
89
|
+
|
|
90
|
+
`currents session` captures an agent or browser session, such as a bug before and after a fix. Each command needs an API key with write access; set it once as `CURRENTS_API_KEY`:
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
export CURRENTS_API_KEY=<api-key>
|
|
94
|
+
npx currents session start --project-id <id> --title "Checkout fails on empty cart" --status failed
|
|
95
|
+
npx currents session attach before.png .playwright-mcp/traces
|
|
96
|
+
npx currents session share --expires-in-days 7
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`session share` prints a public link to the session page, and a link to the same content as Markdown. For the options, run `npx currents session --help`.
|
|
62
100
|
|
|
63
|
-
|
|
101
|
+
## Use Currents API
|
|
102
|
+
|
|
103
|
+
- Retrieve information about Currents resources in JSON format. See the [REST API](https://docs.currents.dev/api) docs.
|
|
64
104
|
|
|
65
|
-
ℹ️ The command requires the `--project-id` and [`--api-key`](https://docs.currents.dev/
|
|
105
|
+
ℹ️ The command requires the `--project-id` and [`--api-key`](https://docs.currents.dev/dashboard/administration/api-keys) from [Currents](https://app.currents.dev) to authenticate the request and provide the required data. Alternatively, you can set the `CURRENTS_PROJECT_ID` and `CURRENTS_API_KEY` environment variables.
|
|
66
106
|
|
|
67
107
|
**Supported operations:**
|
|
68
108
|
|
|
@@ -125,4 +165,6 @@ The skill is also in this repository, in `skills/currents-cli`: `npx skills add
|
|
|
125
165
|
|
|
126
166
|
## Troubleshooting
|
|
127
167
|
|
|
128
|
-
Run the CLI command with the `--debug` argument or prefix it with `DEBUG="currents,currents:*"` to obtain detailed information about the command execution process.
|
|
168
|
+
Run the CLI command with the `--debug` argument or prefix it with `DEBUG="currents,currents:*"` to obtain detailed information about the command execution process. Keys are hidden in the debug output.
|
|
169
|
+
|
|
170
|
+
The full documentation is at https://docs.currents.dev/resources/reporters/currents-cmd.
|