Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a620424

Browse files
chore: upgrade to Jest 27 (#251)
* chore: upgrade to Jest 27 * chore: replace vue-jest with vue2-jest for Jest 27 * chore: fix lint error * chore: upgrade msw for bug fix * chore: update expected test error * chore: check for type errors based on Node version
1 parent b16a06b commit a620424

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

‎jest.config.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = merge(config, {
1111
collectCoverageFrom: ['**/src/**/*.js', '!**/src/__tests__/**'],
1212
transform: {
1313
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
14-
'.*\\.(vue)$': '<rootDir>/node_modules/vue-jest',
14+
'.*\\.(vue)$': '<rootDir>/node_modules/@vue/vue2-jest',
1515
},
1616
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
1717
testPathIgnorePatterns: [

‎package.json‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"@testing-library/jest-dom": "^5.11.6",
5353
"@testing-library/user-event": "^12.1.10",
5454
"@types/estree": "0.0.46",
55+
"@vue/vue2-jest": "^27.0.0-alpha.2",
5556
"apollo-boost": "^0.4.9",
5657
"apollo-cache-inmemory": "^1.6.6",
5758
"axios": "^0.21.1",
@@ -62,16 +63,16 @@
6263
"graphql-tag": "^2.11.0",
6364
"isomorphic-unfetch": "^3.0.0",
6465
"jest-serializer-vue": "^2.0.2",
65-
"kcd-scripts": "^10.1.1",
66+
"kcd-scripts": "^11.1.0",
6667
"lodash.merge": "^4.6.2",
67-
"msw": "^0.26.2",
68+
"msw": "^0.35.0",
6869
"portal-vue": "^2.1.7",
70+
"semver": "^7.3.5",
6971
"typescript": "^4.0.5",
7072
"vee-validate": "^2.2.15",
7173
"vue": "^2.6.12",
7274
"vue-apollo": "^3.0.4",
7375
"vue-i18n": "^8.21.1",
74-
"vue-jest": "^4.0.0-rc.0",
7576
"vue-router": "^3.4.9",
7677
"vue-template-compiler": "^2.6.12",
7778
"vuetify": "^2.3.17",

‎src/__tests__/about-vue-router-mocha.js‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import '@testing-library/jest-dom'
22
import {render} from '@testing-library/vue'
3+
import semver from 'semver'
34

45
import About from './components/Router/About.vue'
56

@@ -11,6 +12,10 @@ test('uses require("vue-router").default when require("vue-router") is undefined
1112
})
1213

1314
expect(() => render(About, {routes})).toThrowError(
14-
new TypeError("Cannot read property 'default' of undefined"),
15+
new TypeError(
16+
semver.gte(process.version, '16.0.0')
17+
? "Cannot read properties of undefined (reading 'default')"
18+
: "Cannot read property 'default' of undefined",
19+
),
1520
)
1621
})

‎src/__tests__/disappearance.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test('waits for the data to be loaded', async () => {
1111

1212
// Following line reads as follows:
1313
// "Wait until element with text 'Loading...' is gone."
14-
await waitForElementToBeRemoved(getByText('Loading...'))
14+
await waitForElementToBeRemoved(queryByText('Loading...'))
1515
// It is equivalent to:
1616
//
1717
// await waitFor(() => {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /