Skip to content

Commit

Permalink
chore: Jest reporters for CI (#11125)
Browse files Browse the repository at this point in the history
Switches to jest summary reporter with a zero threshold so we can see
what test failed on CI.

### Before

![image](https://github.com/user-attachments/assets/1ce397ee-34df-46a7-9450-2db8dd0e843f)

### After
![Screenshot from 2025-01-09
11-55-46](https://github.com/user-attachments/assets/a40c754c-403a-4be8-9848-c02f086aa2f6)
  • Loading branch information
spalladino authored Jan 9, 2025
1 parent 1b88a34 commit 90cd9d2
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 5 deletions.
3 changes: 2 additions & 1 deletion yarn-project/foundation/src/log/log_history.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { LogHistory } from './log_history.js';

jest.useFakeTimers({ doNotFake: ['performance'] });

describe('log history', () => {
// We skip log history tests since this class is not used and it pollutes the logs in CI.
describe.skip('log history', () => {
let debug: (msg: string) => void;
let logHistory: LogHistory;
const timestamp = new Date().toISOString();
Expand Down
21 changes: 21 additions & 0 deletions yarn-project/jest.root.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const { cwd } = require('process');
const { join } = require('path');
const { readFileSync } = require('fs');

// Loads the jest config from the package.json in the working directory and overrides the reporters.
// Note we cannot just use the `--reporters` CLI option because it does not allow setting options,
// and we need the `summaryThreshold` option to show actual errors when tests fail.
// This file is only used from the yarn project root `test` script.
/** @type {import('jest').Config} */
const config = {
...JSON.parse(readFileSync(join(cwd(), 'package.json'), 'utf-8')).jest,
// CI-friendly reporters config
reporters: [
['github-actions', { silent: false }],
['summary', { summaryThreshold: 0 }],
],
// Override rootDir to the src of the current package
rootDir: join(cwd(), 'src'),
};

module.exports = config;
2 changes: 1 addition & 1 deletion yarn-project/kv-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
"test:node": "NODE_NO_WARNINGS=1 mocha --config ./.mocharc.json --reporter dot",
"test:browser": "wtr --config ./web-test-runner.config.mjs",
"test": "yarn test:node && yarn test:browser"
"test": "yarn test:node && yarn test:browser && true"
},
"inherits": [
"../package.common.json",
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/kv-store/package.local.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"scripts": {
"test": "yarn test:node && yarn test:browser"
"test": "yarn test:node && yarn test:browser && true"
}
}
2 changes: 1 addition & 1 deletion yarn-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"formatting:fix": "FORCE_COLOR=true yarn workspaces foreach -A -p -v run formatting:fix",
"lint": "yarn eslint --cache --ignore-pattern l1-artifacts .",
"format": "yarn prettier --cache -w .",
"test": "RAYON_NUM_THREADS=4 FORCE_COLOR=true yarn workspaces foreach -A --exclude @aztec/aztec3-packages --exclude @aztec/bb-prover --exclude @aztec/prover-client -p -v run test --reporters=summary",
"test": "RAYON_NUM_THREADS=4 FORCE_COLOR=true yarn workspaces foreach -A --exclude @aztec/aztec3-packages --exclude @aztec/bb-prover --exclude @aztec/prover-client -p -v run test --config=../jest.root.config.js",
"build": "FORCE_COLOR=true yarn workspaces foreach -A --parallel --topological-dev --verbose --exclude @aztec/aztec3-packages --exclude @aztec/docs run build",
"build:fast": "cd foundation && yarn build && cd ../l1-artifacts && yarn build && cd ../circuits.js && yarn build && cd .. && yarn generate && tsc -b",
"build:dev": "./watch.sh",
Expand Down
1 change: 0 additions & 1 deletion yarn-project/sequencer-client/src/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ describe('sequencer config', () => {
const stringifiedAllowList = configStrings.join(',');

const allowList = parseSequencerAllowList(stringifiedAllowList);

expect(allowList).toEqual(config);
});
});

0 comments on commit 90cd9d2

Please sign in to comment.