Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/jest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ or set the `--reporters` option when running the `jest`
npx jest --reporters=@currents/jest
```

The reporter saves the test results in a folder named using the pattern `.currents/[timestamp]-[uuidv4()]` in the root directory. We recomment to add `.currents*` to your `.gitignore` file.
The reporter saves the test results in a folder named using the pattern `.currents/[timestamp]-[uuidv4()]` in the root directory. You can override this with the `reportDir` option or the `CURRENTS_REPORT_DIR` environment variable (env takes precedence). We recommend adding `.currents*` to your `.gitignore` file.

## Configuration

| Property | Type | Description | Environment variable | Default |
| ----------- | -------- | ---------------------- | --------------------- | -------------------------------- |
| `reportDir` | `string` | Test results directory | `CURRENTS_REPORT_DIR` | `.currents/[timestamp]-[uuidv4]` |
| Property | Type | Description | Environment variable | Default |
| ----------- | -------- | ---------------------- | --------------------- | ---------------------------------- |
| `reportDir` | `string` | Test results directory | `CURRENTS_REPORT_DIR` | `.currents/[timestamp]-[uuidv4()]` |

`CURRENTS_REPORT_DIR` overrides `reportDir` when both are set.

## Troubleshooting

Expand Down
6 changes: 4 additions & 2 deletions packages/jest/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ export default class CustomReporter implements Reporter {

this.specsCount = aggregatedResults.numTotalTestSuites;

this.reportDir = this.options?.reportDir
? await createFolder(this.options.reportDir)
const envReportDir = process.env.CURRENTS_REPORT_DIR?.trim();
const reportDirOption = envReportDir || this.options?.reportDir;
this.reportDir = reportDirOption
? await createFolder(reportDirOption)
: await createUniqueFolder(this.rootDir, '.currents');

info('[currents]: Run started');
Expand Down
1 change: 1 addition & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"CURRENTS_REST_API_URL",
"CURRENTS_REMOTE_LOGGING",
"CURRENTS_PREVIOUS_CI_BUILD_ID",
"CURRENTS_REPORT_DIR",
"TF_BUILD",
"TF_BUILD_BUILDNUMBER",
"AZURE_HTTP_USER_AGENT",
Expand Down