@currents/cmd 1.11.0 → 2.0.0
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 +45 -11
- package/dist/bin/index.js +58 -89
- package/dist/index.js +8 -9
- package/dist/services/upload/discovery/jest/reporter.js +1 -1
- package/dist/skills/currents-cli/SKILL.md +126 -0
- package/dist/skills/currents-cli/references/ci-setup.md +147 -0
- package/dist/skills/currents-cli/references/sessions.md +74 -0
- package/package.json +10 -5
package/README.md
CHANGED
|
@@ -14,9 +14,17 @@ npm install @currents/cmd --save-dev
|
|
|
14
14
|
- Upload the results
|
|
15
15
|
|
|
16
16
|
```sh
|
|
17
|
-
npx currents upload --project-id=xxx --key=yyy
|
|
17
|
+
npx currents run upload --project-id=xxx --key=yyy
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
+
For JUnit XML reports, `run upload` converts them to the Currents format first, then uploads them. Put quotes around the `--input-file` pattern, so that the CLI expands it and not the shell:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npx currents run upload --project-id=xxx --key=yyy --input-format junit --input-file "reports/*.xml" --framework postman
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`--framework` takes `postman`, `node`, `vitest` or `wdio`. The converted reports are saved to `--output-dir`, or `--report-dir`, or a new folder in `.currents`. A folder you name must be empty or not exist yet.
|
|
27
|
+
|
|
20
28
|
ℹ️ Get familiar with [CI Build ID 📖](https://docs.currents.dev/guides/ci-build-id) before using `currents` in CI. It is **important** to set the `CI Build ID` explicitly using `--ci-build-id` option, if you are using CI sharding or multiple CI machines to parallelize your tests. If not set explicitly, the `CI Build ID` will be set to a random value.
|
|
21
29
|
|
|
22
30
|
### Notes
|
|
@@ -25,10 +33,10 @@ Obtain `--project-id` and [--key](https://docs.currents.dev/guides/record-key) f
|
|
|
25
33
|
|
|
26
34
|
`currents` will upload the results, as follows:
|
|
27
35
|
|
|
28
|
-
- use `process.env.CURRENTS_REPORT_DIR` or `--
|
|
29
|
-
- use the most recently created
|
|
36
|
+
- use `process.env.CURRENTS_REPORT_DIR` or `--report-dir` to read the results previously generated by one of supported reporters, otherwise
|
|
37
|
+
- use the most recently created folder named as `.currents/[timestamp]-[uuidv4()]` in the current working directory
|
|
30
38
|
|
|
31
|
-
For [Detox](https://wix.github.io/Detox/) runs reported by `@currents/jest`, `currents 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.
|
|
39
|
+
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.
|
|
32
40
|
|
|
33
41
|
### Configuration
|
|
34
42
|
|
|
@@ -39,14 +47,14 @@ Please note that all options apart from `--project-id` and `--key` are optional.
|
|
|
39
47
|
| `-k, --key` | `string` | The record key to record the results to Currents. Read more: https://currents.dev/readme/guides/record-key | `CURRENTS_RECORD_KEY` | - |
|
|
40
48
|
| `-p, --project-id` | `string` | The id of the project for reporting | `CURRENTS_PROJECT_ID` | - |
|
|
41
49
|
| `--machine-id` | `string` | Unique identifier of the machine running the tests. If not provided, it will be generated automatically. See: https://currents.dev/readme/readme?q=machineId | `CURRENTS_MACHINE_ID` | `[random-string]` |
|
|
42
|
-
| `--report-dir` | `string` | The
|
|
50
|
+
| `--report-dir` | `string` | The folder containing the test results created with one of the [supported](https://docs.currents.dev) reporters | `CURRENTS_REPORT_DIR` | `.currents/*` |
|
|
43
51
|
| `--ci-build-id` | `string` | The id of the build to record the test run. Read more: https://currents.dev/readme/guides/ci-build-id | `CURRENTS_CI_BUILD_ID` | `auto:[random-string]` |
|
|
44
|
-
| `--debug` | `boolean` | Enable debug logs | `
|
|
52
|
+
| `--debug` | `boolean` | Enable debug logs | `CURRENTS_DEBUG` | `false` |
|
|
45
53
|
| `-t, --tag` | `string` | Comma-separated tag(s) for recorded runs in Currents | `CURRENTS_TAG` | - |
|
|
46
54
|
| `--disable-title-tags` | `boolean` | Disable extracting tags from test title, e.g. `Test name @smoke` would not be tagged with `smoke` | `CURRENTS_DISABLE_TITLE_TAGS` | `false` |
|
|
47
55
|
| `--remove-title-tags` | `boolean` | Remove tags from test names in Currents, e.g. `Test name @smoke` becomes `Test name` in the dashboard | `CURRENTS_REMOVE_TITLE_TAGS` | `false` |
|
|
48
56
|
|
|
49
|
-
The configuration is also available by running the CLI command with the `--help` argument.
|
|
57
|
+
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.
|
|
50
58
|
|
|
51
59
|
## Use Currents API
|
|
52
60
|
|
|
@@ -61,19 +69,28 @@ The configuration is also available by running the CLI command with the `--help`
|
|
|
61
69
|
- Obtain run data using the [CI Build ID 📖](https://docs.currents.dev/guides/ci-build-id) by running the following command:
|
|
62
70
|
|
|
63
71
|
```sh
|
|
64
|
-
npx currents
|
|
72
|
+
npx currents run get --ci-build-id <ci-build-id> --output path/to/save/run.json
|
|
65
73
|
```
|
|
66
74
|
|
|
67
75
|
- Obtain the last completed run data, filtered by `--branch` and/or `--tag`, by running the following command:
|
|
68
76
|
```sh
|
|
69
|
-
npx currents
|
|
77
|
+
npx currents run get --branch <branch> --tag <tag-1,tag-2,...tag-n>
|
|
70
78
|
```
|
|
71
79
|
|
|
72
|
-
For more examples and usage options, run `npx currents
|
|
80
|
+
For more examples and usage options, run `npx currents run get --help`.
|
|
81
|
+
|
|
82
|
+
To call any other REST API route, use `currents api` with the route path. It reads the API key from `--api-key` or `CURRENTS_API_KEY`:
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
npx currents api /v1/runs/<run-id>
|
|
86
|
+
npx currents api /v1/runs/<run-id>/cancel -X PUT
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
For the options, run `npx currents api --help`.
|
|
73
90
|
|
|
74
91
|
## Cache test artifacts
|
|
75
92
|
|
|
76
|
-
The `currents cache` command allows you to archive files from specified locations and save them under an ID in Currents storage. It also stores a meta file with configuration data. You can provide the ID manually or it
|
|
93
|
+
The `currents cache` command allows you to archive files from specified locations and save them under an ID in Currents storage. It also stores a meta file with configuration data. You can provide the ID manually, or it is made from the variables of the CI job. When no CI job is detected the ID is random, and the command warns: pass `--id` to save and restore the same cache.
|
|
77
94
|
|
|
78
95
|
To cache files, use the following command:
|
|
79
96
|
|
|
@@ -89,6 +106,23 @@ npx currents cache get --key <record-key> --id <id>
|
|
|
89
106
|
|
|
90
107
|
For more examples and usage options, run `npx currents cache --help`.
|
|
91
108
|
|
|
109
|
+
## Agent skill
|
|
110
|
+
|
|
111
|
+
The package includes the `currents-cli` agent skill, which tells coding agents how to use this CLI.
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
# Print the skill
|
|
115
|
+
npx currents skill
|
|
116
|
+
|
|
117
|
+
# Add it to the project for Codex and Cursor, in .agents/skills/currents-cli
|
|
118
|
+
npx currents skill --install
|
|
119
|
+
|
|
120
|
+
# Add it for Claude Code
|
|
121
|
+
npx currents skill --install --dir .claude/skills
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The skill is also in this repository, in `skills/currents-cli`: `npx skills add https://github.com/currents-dev/currents-reporter --skill currents-cli`.
|
|
125
|
+
|
|
92
126
|
## Troubleshooting
|
|
93
127
|
|
|
94
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.
|