Skip to content

Commit fc7dea8

Browse files
committed
chore: package upgrades
migrate jest to 27 (for all packages except vue, see vuejs/vue-cli#6602)
1 parent dbd6737 commit fc7dea8

File tree

11 files changed

+3934
-2542
lines changed

11 files changed

+3934
-2542
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ node_modules
44
report.html
55
.nyc_output
66
.vscode
7+
.yarn
78
dist
89
coverage
910

jest.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module.exports = {
1616
statements: 100
1717
}
1818
},
19+
testEnvironment: 'jsdom',
1920
moduleNameMapper: {
2021
'^.+\\.(css|scss)$': 'identity-obj-proxy'
2122
}

package.json

+35-26
Original file line numberDiff line numberDiff line change
@@ -45,36 +45,36 @@
4545
"url": "https://github.com/FRSource/tiny-carousel/issues"
4646
},
4747
"devDependencies": {
48-
"@axe-core/puppeteer": "^4.1.0",
49-
"@commitlint/cli": "^12.0.1",
50-
"@commitlint/config-conventional": "^12.0.1",
48+
"@axe-core/puppeteer": "^4.2.2",
49+
"@commitlint/cli": "^13.1.0",
50+
"@commitlint/config-conventional": "^13.1.0",
5151
"@textlint-rule/textlint-rule-no-unmatched-pair": "^1.0.7",
5252
"@types/jest": "^27.0.1",
53-
"@typescript-eslint/eslint-plugin": "^4.12.0",
54-
"@typescript-eslint/parser": "^4.12.0",
55-
"concurrently": "^6.0.0",
56-
"coveralls": "^3.1.0",
53+
"@typescript-eslint/eslint-plugin": "^4.31.1",
54+
"@typescript-eslint/parser": "^4.31.1",
55+
"concurrently": "^6.2.1",
56+
"coveralls": "^3.1.1",
5757
"cpy-cli": "^3.1.1",
5858
"dictionary-en": "^3.1.0",
59-
"eslint": "^7.17.0",
59+
"eslint": "^7.32.0",
6060
"eslint-plugin-eslint-comments": "^3.2.0",
61-
"eslint-plugin-jest": "^24.1.3",
61+
"eslint-plugin-jest": "^24.4.0",
6262
"eslint-plugin-monorepo": "^0.3.2",
63-
"husky": "^6.0.0",
63+
"husky": "^7.0.2",
6464
"identity-obj-proxy": "^3.0.0",
65-
"jest": "^26.6.3",
65+
"jest": "^27.2.0",
6666
"lerna": "^4.0.0",
67-
"microbundle": "^0.13.0",
67+
"microbundle": "^0.13.3",
6868
"postcss-import": "^14.0.0",
6969
"postcss-reporter": "^7.0.2",
7070
"precss": "^4.0.0",
71-
"puppeteer": "^8.0.0",
71+
"puppeteer": "^10.2.0",
7272
"rimraf": "^3.0.2",
73-
"sass": "^1.32.2",
74-
"standard-version": "^9.1.0",
73+
"sass": "^1.39.2",
74+
"standard-version": "^9.3.1",
7575
"stylelint": "^13.8.0",
7676
"stylelint-config-sass-guidelines": "^8.0.0",
77-
"textlint": "^12.0.0",
77+
"textlint": "^12.0.2",
7878
"textlint-filter-rule-comments": "^1.2.2",
7979
"textlint-rule-abbr-within-parentheses": "^1.0.2",
8080
"textlint-rule-alex": "^3.0.0",
@@ -90,18 +90,27 @@
9090
"textlint-rule-stop-words": "^2.0.9",
9191
"textlint-rule-terminology": "^2.1.4",
9292
"textlint-rule-unexpanded-acronym": "^1.2.4",
93-
"ts-jest": "^26.5.0",
94-
"typescript": "^4.1.5"
93+
"ts-jest": "^27.0.5",
94+
"typescript": "^4.4.3"
9595
},
9696
"workspaces": {
97-
"packages": ["packages/*"],
98-
"nohoist": ["**/@vuepress", "**/@vuepress/**", "**/vuepress", "**/vuepress/**", "**/vuepress-*", "**/vuepress-*/**"]
99-
},
100-
"resolutions": {
101-
"**/jest": "^26.6.3",
102-
"**/babel-jest": "^26.0.0",
103-
"**/ts-jest": "^26.0.0",
104-
"**/vue-jest": "^3.0.7"
97+
"packages": [
98+
"packages/*"
99+
],
100+
"nohoist": [
101+
"**/@vuepress",
102+
"**/@vuepress/**",
103+
"**/vuepress",
104+
"**/vuepress/**",
105+
"**/vuepress-*",
106+
"**/vuepress-*/**",
107+
"**/jest",
108+
"jest",
109+
"@vue/cli-plugin-unit-jest",
110+
"@vue/cli-plugin-unit-jest/**",
111+
"**/@vue/cli-plugin-unit-jest",
112+
"**/@vue/cli-plugin-unit-jest/**"
113+
]
105114
},
106115
"commitlint": {
107116
"extends": [

packages/core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@
6464
"@frsource/frs-hide-scrollbar": "^2.0.5"
6565
},
6666
"devDependencies": {
67-
"@frsource/frs-hide-scrollbar": "^2.0.5"
67+
"@frsource/frs-hide-scrollbar": "^2.0.6"
6868
}
6969
}

packages/plugin-autoplay/src/index.spec.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const installPlugin = (config?: Partial<Config>) => {
1515
};
1616

1717
beforeAll(() => {
18-
jest.spyOn(global, 'setTimeout').mockReturnValue(timeoutId);
18+
jest.spyOn(global, 'setTimeout').mockReturnValue(timeoutId as unknown as NodeJS.Timeout);
1919
});
2020
beforeEach(() =>
2121
carousel = {

packages/plugin-mouse-drag/src/index.spec.test.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,10 @@ describe('install', () => {
182182
});
183183

184184
describe('mouseup listener', () => {
185-
beforeAll(() => jest.useFakeTimers());
185+
beforeAll(() => {
186+
jest.useFakeTimers();
187+
requestAnimationFrame = jest.spyOn(global, 'requestAnimationFrame').mockReturnValue(0);
188+
});
186189
beforeEach(() => {
187190
installPlugin({
188191
mouseDragDraggingClassName,
@@ -225,7 +228,7 @@ describe('install', () => {
225228
const round = (n: number, approx: number) => Math.round(n * 10 ** approx) / 10 ** approx
226229
const startAnimation = () => {
227230
callMouseUpHandler();
228-
jest.advanceTimersByTime(mouseDragThrottle);
231+
jest.advanceTimersByTime(mouseDragThrottle + 200);
229232
};
230233

231234
it('should call horizontalSnapToIndex predict final index', () => {

packages/plugin-mouse-drag/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export const pluginMouseDrag = {
8888
pos.diffX * MOMENTUM_DISTANCE_FACTOR,
8989
);
9090

91-
// let goTo method handle overflow
91+
// let goTo method handle overflow
9292
if (index === -1) index = instance.config.items.length - 1;
9393
else if (index === instance.config.items.length) index = 0;
9494

packages/react/package.json

+8-7
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,18 @@
6060
"@frsource/tiny-carousel-plugin-autoplay": "^0.4.3",
6161
"@frsource/tiny-carousel-plugin-custom-events": "^0.4.3",
6262
"@frsource/tiny-carousel-plugin-mouse-drag": "^0.4.0",
63-
"@testing-library/jest-dom": "^5.11.4",
64-
"@testing-library/react": "^11.1.0",
65-
"@testing-library/user-event": "^13.1.9",
66-
"@types/node": "^15.3.0",
67-
"@types/react": "^17.0.0",
68-
"@types/react-dom": "^17.0.0",
63+
"@testing-library/jest-dom": "^5.14.1",
64+
"@testing-library/react": "^12.1.0",
65+
"@testing-library/user-event": "^13.2.1",
66+
"@types/node": "^16.9.1",
67+
"@types/react": "^17.0.20",
68+
"@types/react-dom": "^17.0.9",
6969
"eslint-config-react-app": "^6.0.0",
70+
"eslint-plugin-testing-library": "^4.12.2",
7071
"react": "^17.0.2",
7172
"react-dom": "^17.0.2",
7273
"react-scripts": "4.0.3",
73-
"web-vitals": "^2.0.1"
74+
"web-vitals": "^2.1.0"
7475
},
7576
"peerDependencies": {
7677
"@frsource/tiny-carousel-core": "^0.8.0",

packages/vue/jest.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
module.exports = {
2-
preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel'
2+
preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel',
3+
testEnvironment: 'jsdom'
34
}

packages/vue/package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,19 @@
6666
"@frsource/tiny-carousel-plugin-autoplay": "^0.4.3",
6767
"@frsource/tiny-carousel-plugin-custom-events": "^0.4.3",
6868
"@frsource/tiny-carousel-plugin-mouse-drag": "^0.4.0",
69-
"@typescript-eslint/eslint-plugin": "^4.18.0",
70-
"@typescript-eslint/parser": "^4.18.0",
69+
"@typescript-eslint/eslint-plugin": "^4.31.1",
70+
"@typescript-eslint/parser": "^4.31.1",
7171
"@vue/cli-plugin-babel": "~4.5.0",
7272
"@vue/cli-plugin-eslint": "~4.5.0",
7373
"@vue/cli-plugin-typescript": "~4.5.0",
7474
"@vue/cli-plugin-unit-jest": "~4.5.0",
7575
"@vue/cli-service": "~4.5.12",
7676
"@vue/eslint-config-typescript": "^7.0.0",
77-
"@vue/test-utils": "^1.0.3",
78-
"core-js": "^3.6.5",
79-
"eslint-plugin-vue": "^7.8.0",
77+
"@vue/test-utils": "^1.2.2",
78+
"core-js": "^3.17.3",
79+
"eslint-plugin-vue": "^7.17.0",
8080
"vue": "2.6.14",
81-
"vue-demi": "^0.9.0",
81+
"vue-demi": "^0.11.4",
8282
"vue-template-compiler": "^2.6.12",
8383
"vue3": "npm:vue@^3.0.0"
8484
},

0 commit comments

Comments
 (0)