Skip to content

Commit

Permalink
chore: package upgrades
Browse files Browse the repository at this point in the history
migrate jest to 27 (for all packages except vue, see vuejs/vue-cli#6602)
  • Loading branch information
FRSgit committed Sep 13, 2021
1 parent dbd6737 commit fc7dea8
Show file tree
Hide file tree
Showing 11 changed files with 3,934 additions and 2,542 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ node_modules
report.html
.nyc_output
.vscode
.yarn
dist
coverage

Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = {
statements: 100
}
},
testEnvironment: 'jsdom',
moduleNameMapper: {
'^.+\\.(css|scss)$': 'identity-obj-proxy'
}
Expand Down
61 changes: 35 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,36 +45,36 @@
"url": "https://github.com/FRSource/tiny-carousel/issues"
},
"devDependencies": {
"@axe-core/puppeteer": "^4.1.0",
"@commitlint/cli": "^12.0.1",
"@commitlint/config-conventional": "^12.0.1",
"@axe-core/puppeteer": "^4.2.2",
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.1.0",
"@textlint-rule/textlint-rule-no-unmatched-pair": "^1.0.7",
"@types/jest": "^27.0.1",
"@typescript-eslint/eslint-plugin": "^4.12.0",
"@typescript-eslint/parser": "^4.12.0",
"concurrently": "^6.0.0",
"coveralls": "^3.1.0",
"@typescript-eslint/eslint-plugin": "^4.31.1",
"@typescript-eslint/parser": "^4.31.1",
"concurrently": "^6.2.1",
"coveralls": "^3.1.1",
"cpy-cli": "^3.1.1",
"dictionary-en": "^3.1.0",
"eslint": "^7.17.0",
"eslint": "^7.32.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-jest": "^24.1.3",
"eslint-plugin-jest": "^24.4.0",
"eslint-plugin-monorepo": "^0.3.2",
"husky": "^6.0.0",
"husky": "^7.0.2",
"identity-obj-proxy": "^3.0.0",
"jest": "^26.6.3",
"jest": "^27.2.0",
"lerna": "^4.0.0",
"microbundle": "^0.13.0",
"microbundle": "^0.13.3",
"postcss-import": "^14.0.0",
"postcss-reporter": "^7.0.2",
"precss": "^4.0.0",
"puppeteer": "^8.0.0",
"puppeteer": "^10.2.0",
"rimraf": "^3.0.2",
"sass": "^1.32.2",
"standard-version": "^9.1.0",
"sass": "^1.39.2",
"standard-version": "^9.3.1",
"stylelint": "^13.8.0",
"stylelint-config-sass-guidelines": "^8.0.0",
"textlint": "^12.0.0",
"textlint": "^12.0.2",
"textlint-filter-rule-comments": "^1.2.2",
"textlint-rule-abbr-within-parentheses": "^1.0.2",
"textlint-rule-alex": "^3.0.0",
Expand All @@ -90,18 +90,27 @@
"textlint-rule-stop-words": "^2.0.9",
"textlint-rule-terminology": "^2.1.4",
"textlint-rule-unexpanded-acronym": "^1.2.4",
"ts-jest": "^26.5.0",
"typescript": "^4.1.5"
"ts-jest": "^27.0.5",
"typescript": "^4.4.3"
},
"workspaces": {
"packages": ["packages/*"],
"nohoist": ["**/@vuepress", "**/@vuepress/**", "**/vuepress", "**/vuepress/**", "**/vuepress-*", "**/vuepress-*/**"]
},
"resolutions": {
"**/jest": "^26.6.3",
"**/babel-jest": "^26.0.0",
"**/ts-jest": "^26.0.0",
"**/vue-jest": "^3.0.7"
"packages": [
"packages/*"
],
"nohoist": [
"**/@vuepress",
"**/@vuepress/**",
"**/vuepress",
"**/vuepress/**",
"**/vuepress-*",
"**/vuepress-*/**",
"**/jest",
"jest",
"@vue/cli-plugin-unit-jest",
"@vue/cli-plugin-unit-jest/**",
"**/@vue/cli-plugin-unit-jest",
"**/@vue/cli-plugin-unit-jest/**"
]
},
"commitlint": {
"extends": [
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@
"@frsource/frs-hide-scrollbar": "^2.0.5"
},
"devDependencies": {
"@frsource/frs-hide-scrollbar": "^2.0.5"
"@frsource/frs-hide-scrollbar": "^2.0.6"
}
}
2 changes: 1 addition & 1 deletion packages/plugin-autoplay/src/index.spec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const installPlugin = (config?: Partial<Config>) => {
};

beforeAll(() => {
jest.spyOn(global, 'setTimeout').mockReturnValue(timeoutId);
jest.spyOn(global, 'setTimeout').mockReturnValue(timeoutId as unknown as NodeJS.Timeout);
});
beforeEach(() =>
carousel = {
Expand Down
7 changes: 5 additions & 2 deletions packages/plugin-mouse-drag/src/index.spec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ describe('install', () => {
});

describe('mouseup listener', () => {
beforeAll(() => jest.useFakeTimers());
beforeAll(() => {
jest.useFakeTimers();
requestAnimationFrame = jest.spyOn(global, 'requestAnimationFrame').mockReturnValue(0);
});
beforeEach(() => {
installPlugin({
mouseDragDraggingClassName,
Expand Down Expand Up @@ -225,7 +228,7 @@ describe('install', () => {
const round = (n: number, approx: number) => Math.round(n * 10 ** approx) / 10 ** approx
const startAnimation = () => {
callMouseUpHandler();
jest.advanceTimersByTime(mouseDragThrottle);
jest.advanceTimersByTime(mouseDragThrottle + 200);
};

it('should call horizontalSnapToIndex predict final index', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-mouse-drag/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const pluginMouseDrag = {
pos.diffX * MOMENTUM_DISTANCE_FACTOR,
);

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

Expand Down
15 changes: 8 additions & 7 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,18 @@
"@frsource/tiny-carousel-plugin-autoplay": "^0.4.3",
"@frsource/tiny-carousel-plugin-custom-events": "^0.4.3",
"@frsource/tiny-carousel-plugin-mouse-drag": "^0.4.0",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^13.1.9",
"@types/node": "^15.3.0",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.1.0",
"@testing-library/user-event": "^13.2.1",
"@types/node": "^16.9.1",
"@types/react": "^17.0.20",
"@types/react-dom": "^17.0.9",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-testing-library": "^4.12.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"web-vitals": "^2.0.1"
"web-vitals": "^2.1.0"
},
"peerDependencies": {
"@frsource/tiny-carousel-core": "^0.8.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/vue/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel'
preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel',
testEnvironment: 'jsdom'
}
12 changes: 6 additions & 6 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,19 @@
"@frsource/tiny-carousel-plugin-autoplay": "^0.4.3",
"@frsource/tiny-carousel-plugin-custom-events": "^0.4.3",
"@frsource/tiny-carousel-plugin-mouse-drag": "^0.4.0",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"@typescript-eslint/eslint-plugin": "^4.31.1",
"@typescript-eslint/parser": "^4.31.1",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-typescript": "~4.5.0",
"@vue/cli-plugin-unit-jest": "~4.5.0",
"@vue/cli-service": "~4.5.12",
"@vue/eslint-config-typescript": "^7.0.0",
"@vue/test-utils": "^1.0.3",
"core-js": "^3.6.5",
"eslint-plugin-vue": "^7.8.0",
"@vue/test-utils": "^1.2.2",
"core-js": "^3.17.3",
"eslint-plugin-vue": "^7.17.0",
"vue": "2.6.14",
"vue-demi": "^0.9.0",
"vue-demi": "^0.11.4",
"vue-template-compiler": "^2.6.12",
"vue3": "npm:vue@^3.0.0"
},
Expand Down

0 comments on commit fc7dea8

Please sign in to comment.