Skip to content

Commit

Permalink
chore: disable logs when running unit tests in CI (#727)
Browse files Browse the repository at this point in the history
  • Loading branch information
omridan159 authored Mar 6, 2024
1 parent 94ecdc8 commit f19ef09
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/sdk-communication-layer/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module.exports = {
'**/dist*/',
'e2e/',
'rollup.config.js',
'jest-preload.js',
],

overrides: [
Expand Down
8 changes: 8 additions & 0 deletions packages/sdk-communication-layer/jest-preload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
global.console = {
...console,
log: jest.fn(),
debug: jest.fn(),
info: jest.fn(),
warn: jest.fn(),
error: jest.fn(),
};
2 changes: 1 addition & 1 deletion packages/sdk-communication-layer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"reset": "yarn clean && rimraf ./node_modules/",
"test": "jest",
"test:coverage": "jest --coverage",
"test:ci": "jest --coverage --passWithNoTests",
"test:ci": "jest --coverage --passWithNoTests --setupFilesAfterEnv ./jest-preload.js",
"test:dev": "jest",
"watch": "rollup -c --bundleConfigAsCjs -w"
},
Expand Down
1 change: 1 addition & 0 deletions packages/sdk-install-modal-web/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
'rollup.config.js',
'**/coverage/**',
'postcss.config.js',
'jest-preload.js',
],

parserOptions: {
Expand Down
8 changes: 8 additions & 0 deletions packages/sdk-install-modal-web/jest-preload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
global.console = {
...console,
log: jest.fn(),
debug: jest.fn(),
info: jest.fn(),
warn: jest.fn(),
error: jest.fn(),
};
2 changes: 1 addition & 1 deletion packages/sdk-install-modal-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"reset": "yarn clean && rimraf ./node_modules/",
"start": "webpack-dev-server",
"test": "echo \"Running tests for version $npm_package_version...\"",
"test:ci": "jest --coverage --passWithNoTests",
"test:ci": "jest --coverage --passWithNoTests --setupFilesAfterEnv ./jest-preload.js",
"preversion": "yarn test",
"postversion": "git push --tags && yarn publish . --tag $npm_package_version && git push && echo \"Successfully released version $npm_package_version!\""
},
Expand Down
1 change: 1 addition & 0 deletions packages/sdk-react/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ module.exports = {
'**/dist*/',
'jest.resolver.js',
'rollup.config.js',
'jest-preload.js',
'webpack.config.js',
'**/coverage/**',
],
Expand Down
8 changes: 8 additions & 0 deletions packages/sdk-react/jest-preload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
global.console = {
...console,
log: jest.fn(),
debug: jest.fn(),
info: jest.fn(),
warn: jest.fn(),
error: jest.fn(),
};
2 changes: 1 addition & 1 deletion packages/sdk-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"reset": "yarn clean && rimraf ./node_modules/",
"test": "jest",
"test:coverage": "jest --coverage",
"test:ci": "jest --coverage --passWithNoTests"
"test:ci": "jest --coverage --passWithNoTests --setupFilesAfterEnv ./jest-preload.js"
},
"dependencies": {
"@metamask/sdk": "workspace:^",
Expand Down
1 change: 1 addition & 0 deletions packages/sdk/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = {
'.prettierrc.js',
'**/.eslintrc.js',
'jest.config.ts',
'jest-preload.js',
'bundle-size.js',
'**/dist*/',
'e2e/',
Expand Down
8 changes: 8 additions & 0 deletions packages/sdk/jest-preload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
global.console = {
...console,
log: jest.fn(),
debug: jest.fn(),
info: jest.fn(),
warn: jest.fn(),
error: jest.fn(),
};
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"reset": "yarn clean && rimraf ./node_modules/",
"test": "jest",
"test:coverage": "jest --coverage",
"test:ci": "jest --coverage --passWithNoTests",
"test:ci": "jest --coverage --passWithNoTests --setupFilesAfterEnv ./jest-preload.js",
"test:dev": "jest -c ./jest.config.ts --detectOpenHandles",
"watch": "rollup -c -w"
},
Expand Down

0 comments on commit f19ef09

Please sign in to comment.