Skip to content

Commit d87298a

Browse files
authored
[tests] add silent reporter (facebook#35547)
Adds silent reporter so you can run tests and only see the failed tests This helps reduce context agents use, if you're inclined to use agents: <img width="630" height="292" alt="Screenshot 2026-01-17 at 12 39 58 PM" src="https://github.com/user-attachments/assets/373b9803-59a6-4b9a-99f9-d74a7b41462e" />
1 parent be3fb29 commit d87298a

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
"jest-cli": "^29.4.2",
8989
"jest-diff": "^29.4.2",
9090
"jest-environment-jsdom": "^29.4.2",
91+
"jest-silent-reporter": "^0.6.0",
9192
"jest-snapshot-serializer-raw": "^1.2.0",
9293
"minimatch": "^3.0.4",
9394
"minimist": "^1.2.3",

scripts/jest/jest-cli.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ const argv = yargs
112112
type: 'boolean',
113113
default: false,
114114
},
115+
silent: {
116+
alias: 's',
117+
describe: 'Use silent reporter with dot progress (minimal output).',
118+
requiresArg: false,
119+
type: 'boolean',
120+
default: false,
121+
},
115122
}).argv;
116123

117124
function logError(message) {
@@ -312,6 +319,12 @@ function getCommandArgs() {
312319
args.push('--maxConcurrency=10');
313320
}
314321

322+
// Use silent reporter if requested.
323+
if (argv.silent) {
324+
args.push('--reporters=jest-silent-reporter');
325+
args.push('--testLocationInResults');
326+
}
327+
315328
// Push the remaining args onto the command.
316329
// This will send args like `--watch` to Jest.
317330
args.push(...argv._);
@@ -353,6 +366,12 @@ function getEnvars() {
353366
envars.JEST_ENABLE_SOURCE_MAPS = 'inline';
354367
}
355368

369+
if (argv.silent) {
370+
// Enable dot output for jest-silent-reporter so that long test runs
371+
// show progress and don't appear to be hung.
372+
envars.JEST_SILENT_REPORTER_DOTS = true;
373+
}
374+
356375
return envars;
357376
}
358377

yarn.lock

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3144,6 +3144,17 @@
31443144
slash "^3.0.0"
31453145
write-file-atomic "^4.0.2"
31463146

3147+
"@jest/types@^26.6.2":
3148+
version "26.6.2"
3149+
resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.6.2.tgz#bef5a532030e1d88a2f5a6d933f84e97226ed48e"
3150+
integrity sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==
3151+
dependencies:
3152+
"@types/istanbul-lib-coverage" "^2.0.0"
3153+
"@types/istanbul-reports" "^3.0.0"
3154+
"@types/node" "*"
3155+
"@types/yargs" "^15.0.0"
3156+
chalk "^4.0.0"
3157+
31473158
"@jest/types@^29.6.3":
31483159
version "29.6.3"
31493160
resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.3.tgz#1131f8cf634e7e84c5e77bab12f052af585fba59"
@@ -4166,6 +4177,13 @@
41664177
resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15"
41674178
integrity sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==
41684179

4180+
"@types/yargs@^15.0.0":
4181+
version "15.0.20"
4182+
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.20.tgz#6d00a124c9f757427d4ca3cbc87daea778053c68"
4183+
integrity sha512-KIkX+/GgfFitlASYCGoSF+T4XRXhOubJLhkLVtSfsRTe9jWMmuM2g28zQ41BtPTG7TRBb2xHW+LCNVE9QR/vsg==
4184+
dependencies:
4185+
"@types/yargs-parser" "*"
4186+
41694187
"@types/yargs@^17.0.8":
41704188
version "17.0.32"
41714189
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.32.tgz#030774723a2f7faafebf645f4e5a48371dca6229"
@@ -11611,6 +11629,14 @@ jest-runtime@^29.7.0:
1161111629
slash "^3.0.0"
1161211630
strip-bom "^4.0.0"
1161311631

11632+
jest-silent-reporter@^0.6.0:
11633+
version "0.6.0"
11634+
resolved "https://registry.yarnpkg.com/jest-silent-reporter/-/jest-silent-reporter-0.6.0.tgz#e9c63a3b1e3c80571d690d998faf842f576b6a60"
11635+
integrity sha512-4nmS+5o7ycVlvbQOTx7CnGdbBtP2646hnDgQpQLaVhjHcQNHD+gqBAetyjRDlgpZ8+8N82MWI59K+EX2LsVk7g==
11636+
dependencies:
11637+
chalk "^4.0.0"
11638+
jest-util "^26.0.0"
11639+
1161411640
jest-snapshot-serializer-raw@^1.2.0:
1161511641
version "1.2.0"
1161611642
resolved "https://registry.yarnpkg.com/jest-snapshot-serializer-raw/-/jest-snapshot-serializer-raw-1.2.0.tgz#cd67afb5e5cc39d88d518b45e7320dd01ce55148"
@@ -11642,6 +11668,18 @@ jest-snapshot@^29.7.0:
1164211668
pretty-format "^29.7.0"
1164311669
semver "^7.5.3"
1164411670

11671+
jest-util@^26.0.0:
11672+
version "26.6.2"
11673+
resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz#907535dbe4d5a6cb4c47ac9b926f6af29576cbc1"
11674+
integrity sha512-MDW0fKfsn0OI7MS7Euz6h8HNDXVQ0gaM9uW6RjfDmd1DAFcaxX9OqIakHIqhbnmF08Cf2DLDG+ulq8YQQ0Lp0Q==
11675+
dependencies:
11676+
"@jest/types" "^26.6.2"
11677+
"@types/node" "*"
11678+
chalk "^4.0.0"
11679+
graceful-fs "^4.2.4"
11680+
is-ci "^2.0.0"
11681+
micromatch "^4.0.2"
11682+
1164511683
jest-util@^29.7.0:
1164611684
version "29.7.0"
1164711685
resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.7.0.tgz#23c2b62bfb22be82b44de98055802ff3710fc0bc"

0 commit comments

Comments
 (0)