From 12f50ed9f9c20ade53f3e8376288d6aa2b2e3f45 Mon Sep 17 00:00:00 2001 From: Dave Clark Date: Mon, 7 Jun 2021 20:37:45 +0100 Subject: [PATCH] Tidy up jest configuration (#862) * chore: include cli and jest-config packages in automatic upgrades * chore: rename jest-config package to avoid conflict * chore: mock two-arg getComputedStyle which jsdom does not implement * chore: set jsdom as test env * chore: remove jest from the automatic update reject list * chore: fix BreadcrumbWithOverflow test for visibility issue * chore: ensure jest transform can work with new version of babel-jest * chore: sync up jest-config package versions --- jest.config.js | 2 +- package.json | 5 +++-- packages/cli/package.json | 7 ++++++- .../BreadcrumbWithOverflow.test.js | 5 ++++- .../CHANGELOG.md | 0 .../index.js | 1 + .../package.json | 11 +++++++++-- .../setup/matchers/toBeAccessible.js | 0 .../setup/matchers/toHaveNoAxeViolations.js | 0 .../setup/setupFiles.js | 6 ++++++ .../setup/setupFilesAfterEnv.js | 2 +- .../transform/css.js | 0 .../transform/file.js | 0 .../transform/javascript.js | 13 +++++++++++++ packages/jest-config/transform/javascript.js | 11 ----------- packages/security/jest.config.js | 2 +- packages/security/package.json | 6 +++--- 17 files changed, 48 insertions(+), 23 deletions(-) rename packages/{jest-config => jest-config-ibm-cloud-cognitive}/CHANGELOG.md (100%) rename packages/{jest-config => jest-config-ibm-cloud-cognitive}/index.js (98%) rename packages/{jest-config => jest-config-ibm-cloud-cognitive}/package.json (69%) rename packages/{jest-config => jest-config-ibm-cloud-cognitive}/setup/matchers/toBeAccessible.js (100%) rename packages/{jest-config => jest-config-ibm-cloud-cognitive}/setup/matchers/toHaveNoAxeViolations.js (100%) rename packages/{jest-config => jest-config-ibm-cloud-cognitive}/setup/setupFiles.js (79%) rename packages/{jest-config => jest-config-ibm-cloud-cognitive}/setup/setupFilesAfterEnv.js (99%) rename packages/{jest-config => jest-config-ibm-cloud-cognitive}/transform/css.js (100%) rename packages/{jest-config => jest-config-ibm-cloud-cognitive}/transform/file.js (100%) create mode 100644 packages/jest-config-ibm-cloud-cognitive/transform/javascript.js delete mode 100644 packages/jest-config/transform/javascript.js diff --git a/jest.config.js b/jest.config.js index 0bfc08e63d..4cbfb86779 100644 --- a/jest.config.js +++ b/jest.config.js @@ -7,4 +7,4 @@ 'use strict'; -module.exports = require('jest-config'); +module.exports = require('jest-config-ibm-cloud-cognitive'); diff --git a/package.json b/package.json index 987962b811..50c817a929 100644 --- a/package.json +++ b/package.json @@ -40,8 +40,8 @@ "storybook:start": "cd packages/core && yarn start", "sync": "carbon-cli sync", "upgrade-carbon": "npm-check-updates -su --deep --filter '/carbon/' && yarn", - "//upgrade-dependencies": "# don't upgrade carbon (done globally), husky (major change in action), jest (untested)", - "upgrade-dependencies": "yarn run-all --concurrency 1 upgrade-dependencies && npm-check-updates -u --reject '/(carbon|^husky$|^jest)/' && yarn", + "//upgrade-dependencies": "# don't upgrade carbon (done globally), husky (major change in action)", + "upgrade-dependencies": "yarn run-all --concurrency 1 upgrade-dependencies && npm-check-updates -u --reject '/(carbon|^husky$)/' && yarn", "upgrade-manual": "sh ./scripts/monorepo-npm-upgrade.sh" }, "devDependencies": { @@ -53,6 +53,7 @@ "eslint-config-carbon": "2.2.0", "husky": "^4.3.6", "jest": "^25.5.4", + "jest-config-ibm-cloud-cognitive": "^0.3.12", "lerna": "^4.0.0", "lint-staged": "^11.0.0", "npm-check-updates": "^11.6.0", diff --git a/packages/cli/package.json b/packages/cli/package.json index c4c0133881..db2d9f3248 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -19,13 +19,18 @@ "carbon community", "carbon for cloud & cognitive" ], - "dependencies": { + "scripts": { + "//upgrade-dependencies": "# don't upgrade carbon (done globally)", + "upgrade-dependencies": "npm-check-updates -u --color --reject '/(carbon)/'" + }, + "devDependencies": { "@commitlint/parse": "^12.1.1", "chalk": "^4.1.0", "execa": "^5.0.0", "fast-glob": "^3.2.5", "fs-extra": "^9.1.0", "inquirer": "^8.0.0", + "npm-check-updates": "^11.6.0", "prettier": "^2.2.1", "prettier-config-carbon": "^0.4.0", "remark": "^13.0.0", diff --git a/packages/cloud-cognitive/src/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.test.js b/packages/cloud-cognitive/src/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.test.js index 35275e276f..56798ca483 100644 --- a/packages/cloud-cognitive/src/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.test.js +++ b/packages/cloud-cognitive/src/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.test.js @@ -148,7 +148,10 @@ describe(BreadcrumbWithOverflow.displayName, () => { //