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 5f2e101

Browse files
authored
feat: Bump minimum node.js version and DOM Testing Library (#303)
BREAKING CHANGE: This PR increases the minimum node.js version to v14, and DOM Testing Library to v9.
1 parent 6dd4847 commit 5f2e101

File tree

10 files changed

+59
-216
lines changed

10 files changed

+59
-216
lines changed

‎.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
module.exports = {
2+
parser: 'vue-eslint-parser',
23
parserOptions: {
34
parser: '@typescript-eslint/parser',
5+
sourceType: 'module',
46
},
57
extends: [
68
'./node_modules/kcd-scripts/eslint.js',
79
'plugin:vue/vue3-recommended',
810
'plugin:testing-library/vue',
911
'prettier',
1012
],
11-
plugins: ['vue'],
1213
rules: {
1314
'no-console': 'off',
1415
'import/no-unresolved': 'off',

‎.github/workflows/validate.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
main:
1818
strategy:
1919
matrix:
20-
node: [12, 14, 16]
20+
node: [14, 16, 18]
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: ⬇️ Checkout repo
@@ -56,7 +56,7 @@ jobs:
5656
- name: ⎔ Setup node
5757
uses: actions/setup-node@v2
5858
with:
59-
node-version: 14
59+
node-version: 16
6060

6161
- name: 📥 Download deps
6262
uses: bahmutov/npm-install@v1

‎babel.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
module.exports = {
22
sourceType: 'module',
3+
plugins: [
4+
// Fixes for loose issue from https://github.com/rails/webpacker/issues/3008
5+
['@babel/plugin-proposal-class-properties', {loose: true}],
6+
['@babel/plugin-proposal-private-methods', {loose: true}],
7+
['@babel/plugin-proposal-private-property-in-object', {loose: true}],
8+
],
39
presets: [
410
[
511
'@babel/preset-env',

‎jest.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ const config = require('kcd-scripts/jest')
33

44
module.exports = merge(config, {
55
testEnvironment: 'jsdom',
6+
testEnvironmentOptions: {
7+
customExportConditions: ['node', 'node-addons'],
8+
},
69
moduleFileExtensions: ['js', 'vue'],
710
coverageDirectory: './coverage',
811
collectCoverageFrom: ['**/src/**/*.js', '!**/src/__tests__/**'],
912
transform: {
1013
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
11-
'.*\\.(vue)$': '<rootDir>/node_modules/vue-jest',
14+
'^.+\\.vue$': '@vue/vue3-jest',
1215
},
1316
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
1417
testPathIgnorePatterns: [

‎package.json

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"setup": "npm install && npm run validate -s"
1616
},
1717
"engines": {
18-
"node": ">=12"
18+
"node": ">=14"
1919
},
2020
"files": [
2121
"types",
@@ -43,39 +43,36 @@
4343
"author": "Daniel Cook",
4444
"license": "MIT",
4545
"dependencies": {
46-
"@babel/runtime": "^7.15.4",
47-
"@testing-library/dom": "^8.5.0",
48-
"@vue/test-utils": "^2.0.0"
46+
"@babel/runtime": "^7.21.0",
47+
"@testing-library/dom": "^9.0.1",
48+
"@vue/test-utils": "^2.3.1"
4949
},
5050
"devDependencies": {
51-
"@apollo/client": "^3.4.11",
52-
"@babel/plugin-transform-runtime": "^7.15.0",
53-
"@testing-library/jest-dom": "^5.14.1",
54-
"@testing-library/user-event": "^13.2.1",
55-
"@types/estree": "^0.0.50",
56-
"@vue/apollo-composable": "^4.0.0-alpha.14",
57-
"@vue/compiler-sfc": "^3.2.12",
58-
"apollo-boost": "^0.4.9",
59-
"axios": "^0.20.0",
60-
"element-plus": "^1.3.0-beta.1",
61-
"eslint-plugin-vue": "^8.2.0",
62-
"graphql": "^15.5.3",
63-
"graphql-tag": "^2.12.4",
64-
"isomorphic-unfetch": "^3.1.0",
65-
"jest-serializer-vue": "^2.0.2",
66-
"kcd-scripts": "^10.0.0",
51+
"@babel/plugin-transform-runtime": "^7.21.0",
52+
"@element-plus/icons-vue": "^2.1.0",
53+
"@testing-library/jest-dom": "^5.16.5",
54+
"@testing-library/user-event": "^14.4.3",
55+
"@types/estree": "^1.0.0",
56+
"@vue/compiler-sfc": "^3.2.47",
57+
"@vue/server-renderer": "^3.2.47",
58+
"@vue/vue3-jest": "^29.2.3",
59+
"axios": "^1.3.4",
60+
"element-plus": "^2.2.36",
61+
"eslint-plugin-vue": "^9.9.0",
62+
"isomorphic-unfetch": "^4.0.2",
63+
"jest-environment-jsdom": "^29.5.0",
64+
"jest-serializer-vue": "^3.1.0",
65+
"kcd-scripts": "^13.0.0",
6766
"lodash.merge": "^4.6.2",
68-
"msw": "^0.21.3",
69-
"tsd": "^0.19.1",
70-
"typescript": "^4.4.3",
71-
"vee-validate": "^4.3.5",
72-
"vue": "^3.2.12",
73-
"vue-apollo": "^3.0.5",
74-
"vue-i18n": "^9.2.0-beta.26",
75-
"vue-jest": "^5.0.0-alpha.10",
76-
"vue-router": "^4.0.3",
77-
"vuetify": "^v3.0.0-alpha.12",
78-
"vuex": "^4.0.0"
67+
"msw": "^1.1.0",
68+
"tsd": "^0.27.0",
69+
"typescript": "^4.9.5",
70+
"vee-validate": "^4.7.4",
71+
"vue": "^3.2.47",
72+
"vue-eslint-parser": "^9.1.0",
73+
"vue-i18n": "^9.2.2",
74+
"vue-router": "^4.1.6",
75+
"vuex": "^4.1.0"
7976
},
8077
"peerDependencies": {
8178
"@vue/compiler-sfc": ">= 3",

‎src/__tests__/hello-world-debug.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable testing-library/no-debug */
1+
/* eslint-disable testing-library/no-debugging-utils */
22
import {render} from '..'
33
import HelloWorld from './components/HelloWorld'
44

@@ -67,7 +67,7 @@ test('allows same arguments as prettyDOM', () => {
6767

6868
expect(console.log).toHaveBeenCalledTimes(1)
6969
expect(console.log.mock.calls[0]).toMatchInlineSnapshot(`
70-
Array [
70+
[
7171
<div>
7272
...,
7373
]

‎src/__tests__/user-event.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,55 +18,58 @@ test('User events in a form', async () => {
1818
review: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
1919
rating: '3',
2020
}
21+
const user = userEvent.setup()
2122
const {getByText, getByLabelText, emitted} = render(Form)
2223

2324
const submitButton = getByText('Submit')
2425
expect(submitButton).toBeDisabled()
2526

2627
const titleInput = getByLabelText(/titleofthemovie/i)
27-
userEvent.type(titleInput, fakeReview.title)
28+
awaituser.type(titleInput, fakeReview.title)
2829
expect(titleInput).toHaveValue(fakeReview.title)
2930

3031
const textArea = getByLabelText(/Yourreview/i)
31-
userEvent.type(textArea, 'The t-rex went insane!')
32+
awaituser.type(textArea, 'The t-rex went insane!')
3233
expect(textArea).toHaveValue('The t-rex went insane!')
3334

34-
userEvent.clear(textArea)
35+
awaituser.clear(textArea)
3536
expect(textArea).toHaveValue('')
36-
userEvent.type(textArea, fakeReview.review)
37+
awaituser.type(textArea, fakeReview.review)
3738
expect(textArea).toHaveValue(fakeReview.review)
3839

3940
const initialSelectedRating = getByLabelText(/Awful/i)
4041
const wonderfulRadioInput = getByLabelText(/Wonderful/i)
4142
expect(initialSelectedRating).toBeChecked()
4243
expect(wonderfulRadioInput).not.toBeChecked()
4344

44-
userEvent.click(wonderfulRadioInput)
45+
awaituser.click(wonderfulRadioInput)
4546
expect(wonderfulRadioInput).toBeChecked()
4647
await waitFor(() => expect(initialSelectedRating).not.toBeChecked())
4748

4849
const recommendInput = getByLabelText(/Wouldyourecommendthismovie?/i)
49-
userEvent.click(recommendInput)
50+
awaituser.click(recommendInput)
5051
expect(recommendInput).toBeChecked()
5152

52-
userEvent.tab()
53+
awaituser.tab()
5354
expect(submitButton).toHaveFocus()
5455
expect(submitButton).toBeEnabled()
55-
userEvent.type(submitButton, '{enter}')
56+
awaituser.type(submitButton, '{enter}')
5657
expect(emitted('submit')[0][0]).toMatchObject(fakeReview)
5758

5859
expect(console.warn).not.toHaveBeenCalled()
5960
})
6061

61-
test('selecting option with user events', () => {
62+
test('selecting option with user events', async () => {
63+
const user = userEvent.setup()
6264
const {getByDisplayValue} = render(Select)
65+
6366
const select = getByDisplayValue('Tyrannosaurus')
6467
expect(select).toHaveValue('dino1')
6568

66-
userEvent.selectOptions(select, 'dino2')
69+
awaituser.selectOptions(select, 'dino2')
6770
expect(select).toHaveValue('dino2')
6871

69-
userEvent.selectOptions(select, 'dino3')
72+
awaituser.selectOptions(select, 'dino3')
7073
expect(select).not.toHaveValue('dino2')
7174
expect(select).toHaveValue('dino3')
7275
})

‎src/__tests__/vue-apollo.js

Lines changed: 0 additions & 94 deletions
This file was deleted.

‎src/__tests__/vuetify.js

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
(0)

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