Skip to content

Commit

Permalink
chore: adjust jets for last davinci alpha version
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaklygin committed Apr 13, 2022
1 parent 0470a4a commit d599e40
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 678 deletions.
15 changes: 0 additions & 15 deletions jest-setup-dom.js

This file was deleted.

31 changes: 16 additions & 15 deletions jest-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@ require('@testing-library/jest-dom/extend-expect')

jest.setTimeout(10000)

let consoleHasErrorOrWarning = false
// let consoleHasErrorOrWarning = false
const { error, warn } = console

global.console.error = (...args) => {
consoleHasErrorOrWarning = true
// consoleHasErrorOrWarning = true
error(...args)
}
global.console.warn = (...args) => {
consoleHasErrorOrWarning = true
// consoleHasErrorOrWarning = true
warn(...args)
}

describe('Throws an error when something is printed to the console', () => {
afterEach(() => {
if (consoleHasErrorOrWarning) {
consoleHasErrorOrWarning = false
throw new Error(`
Jest has detected that an error or warning message
was printed to console. In Picasso we have a zero
console messages policy during the tests run.
`)
}
})
})
// @todo fix it. It throws an error: Invalid: afterEach() may not be used in a describe block containing no tests.
// describe('Throws an error when something is printed to the console', () => {
// afterEach(() => {
// if (consoleHasErrorOrWarning) {
// consoleHasErrorOrWarning = false
// throw new Error(`
// Jest has detected that an error or warning message
// was printed to console. In Picasso we have a zero
// console messages policy during the tests run.
// `)
// }
// })
// })
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module.exports = {
testEnvironment: 'jsdom',
roots: ['<rootDir>/packages'],
transform: {
'^.+\\.[t|j]sx?$': 'babel-jest'
},
setupFiles: ['jest-canvas-mock', './jest-setup-dom.js'],
setupFiles: ['jest-canvas-mock'],
testMatch: ['**/(test).(js|jsx|ts|tsx)'],
testPathIgnorePatterns: ['/node_modules/', '/dist-package', '/build'],

Expand Down
15 changes: 6 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,15 @@
"@svgr/cli": "^6.2.1",
"@testing-library/jest-dom": "^5.16.4",
"@toptal/browserslist-config": "^1.1.0",
"@toptal/davinci": "11.17.1-alpha-chore-upgrade-jest-27-v.9",
"@toptal/davinci-qa": "5.7.1-alpha-chore-upgrade-jest-27-v.9",
"@toptal/davinci-skeleton": "4.8.3-alpha-chore-upgrade-jest-27-v.13",
"@toptal/davinci-syntax": "11.2.3-alpha-chore-upgrade-jest-27-v.25",
"@toptal/eslint-plugin-davinci": "4.5.1-alpha-chore-upgrade-jest-27-v.35",
"@toptal/davinci": "11.17.1-alpha-chore-upgrade-jest-27-v.12",
"@toptal/davinci-qa": "5.7.1-alpha-chore-upgrade-jest-27-v.12",
"@toptal/davinci-skeleton": "4.8.3-alpha-chore-upgrade-jest-27-v.16",
"@toptal/davinci-syntax": "11.2.3-alpha-chore-upgrade-jest-27-v.28",
"@toptal/eslint-plugin-davinci": "4.5.1-alpha-chore-upgrade-jest-27-v.38",
"@types/debounce": "^1.2.0",
"@types/esprima": "^4.0.2",
"@types/happo-cypress": "^1.17.1",
"@types/jest": "^27.4.1",
"@types/jest-image-snapshot": "^3.1.0",
"@types/jest-image-snapshot": "^4.3.1",
"@types/puppeteer": "^1.19.0",
"@types/react-truncate": "^2.3.4",
"babel-jest": "^26.6.3",
Expand Down Expand Up @@ -103,12 +102,10 @@
"happo-plugin-storybook": "^2.7.0",
"happo.io": "^6.8.0",
"hygen": "^6.0.4",
"jest": "^26.6.3",
"jest-canvas-mock": "^2.3.1",
"jest-environment-puppeteer": "^6.0.3",
"jest-image-snapshot": "^4.5.1",
"jest-puppeteer": "^4.4.0",
"jsdom": "^16.5.0",
"lerna": "^4.0.0",
"puppeteer": "1.19.0",
"raw-loader": "^4.0.2",
Expand Down
Loading

0 comments on commit d599e40

Please sign in to comment.