From 38590756bd92a831ed528f8d3aa771b666cf6f21 Mon Sep 17 00:00:00 2001 From: vCaisim Date: Thu, 5 Mar 2026 13:45:15 +0200 Subject: [PATCH 1/3] feat(jest): allow setting report dir by passing CURRENTS_REPORT_DIR --- packages/jest/src/reporter.ts | 6 ++++-- turbo.json | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/jest/src/reporter.ts b/packages/jest/src/reporter.ts index 0ff9fe7d..58e80f3d 100644 --- a/packages/jest/src/reporter.ts +++ b/packages/jest/src/reporter.ts @@ -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 reportDirOption = + process.env.CURRENTS_REPORT_DIR ?? this.options?.reportDir; + this.reportDir = reportDirOption + ? await createFolder(reportDirOption) : await createUniqueFolder(this.rootDir, '.currents'); info('[currents]: Run started'); diff --git a/turbo.json b/turbo.json index a575a319..9d2d6bc0 100644 --- a/turbo.json +++ b/turbo.json @@ -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", From 2c3d8a86d51308791977e4537e6912a9a10e424d Mon Sep 17 00:00:00 2001 From: vCaisim Date: Thu, 5 Mar 2026 13:47:33 +0200 Subject: [PATCH 2/3] chore: update docs --- packages/jest/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/jest/README.md b/packages/jest/README.md index 2ebc28c7..638205e9 100644 --- a/packages/jest/README.md +++ b/packages/jest/README.md @@ -41,7 +41,7 @@ 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 @@ -49,6 +49,8 @@ The reporter saves the test results in a folder named using the pattern `.curren | ----------- | -------- | ---------------------- | --------------------- | -------------------------------- | | `reportDir` | `string` | Test results directory | `CURRENTS_REPORT_DIR` | `.currents/[timestamp]-[uuidv4]` | +`CURRENTS_REPORT_DIR` overrides `reportDir` when both are set. + ## Troubleshooting Set `DEBUG=currents-jest` before running the tests to obtain detailed information about the reporter execution process. From efa6545dacd204ce6d230ecca75d7c3e39e08c9e Mon Sep 17 00:00:00 2001 From: vCaisim Date: Thu, 5 Mar 2026 13:55:26 +0200 Subject: [PATCH 3/3] fix: .. --- packages/jest/README.md | 6 +++--- packages/jest/src/reporter.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/jest/README.md b/packages/jest/README.md index 638205e9..86a6a182 100644 --- a/packages/jest/README.md +++ b/packages/jest/README.md @@ -45,9 +45,9 @@ The reporter saves the test results in a folder named using the pattern `.curren ## 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. diff --git a/packages/jest/src/reporter.ts b/packages/jest/src/reporter.ts index 58e80f3d..57fc87d4 100644 --- a/packages/jest/src/reporter.ts +++ b/packages/jest/src/reporter.ts @@ -88,8 +88,8 @@ export default class CustomReporter implements Reporter { this.specsCount = aggregatedResults.numTotalTestSuites; - const reportDirOption = - process.env.CURRENTS_REPORT_DIR ?? 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');