Skip to content

Commit

Permalink
hide logs on success
Browse files Browse the repository at this point in the history
  • Loading branch information
AgnesToulet committed Jan 29, 2024
1 parent 3987c2c commit 032210a
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ coverage

scripts/tmp

src/testdata/diff_*
tests/testdata/diff_*

cache
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ This will launch a Grafana instance in Docker and, then, run the test suites.

_Notes:_

If there are some expected changes in the reference image files (located in `/src/testdata`), run `yarn test-update` and push the updated references.
If there are some expected changes in the reference image files (located in `/tests/testdata`), run `yarn test-update` and push the updated references.

If the tests are failing and you want to see the difference between the image you get and the reference image, run `yarn test-diff`. This will generate images (called `diff_<test case>.png`) containing the differences in the `/src/testdata` folder.
If the tests are failing and you want to see the difference between the image you get and the reference image, run `yarn test-diff`. This will generate images (called `diff_<test case>.png`) containing the differences in the `/tests/testdata` folder.

### Fixing Drone issues

Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
reporters: ['<rootDir>/tests/reporter.js'],
};
2 changes: 1 addition & 1 deletion src/service/http-server.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const renderKey = jwt.sign(
{ algorithm: 'HS512' }
);

const goldenFilesFolder = './src/testdata';
const goldenFilesFolder = './tests/testdata';
const serviceConfig: ServiceConfig = {
service: {
host: undefined,
Expand Down
25 changes: 25 additions & 0 deletions tests/reporter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const { DefaultReporter } = require('@jest/reporters')

class Reporter extends DefaultReporter
{
constructor()
{
super(...arguments)
}

printTestFileHeader(_testPath, config, result)
{
const console = result.console

if(result.numFailingTests === 0 && !result.testExecError)
{
result.console = null
}

super.printTestFileHeader(...arguments)

result.console = console
}
}

module.exports = Reporter
File renamed without changes
File renamed without changes
File renamed without changes

0 comments on commit 032210a

Please sign in to comment.