Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to jest 25 and fix Storyshots #163

Merged
merged 11 commits into from
Feb 27, 2020
Merged
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"test:apps": "concurrently \"yarn dev:listings\" \"yarn test:app:public\""
},
"devDependencies": {
"react": "16.12.0",
"react-test-renderer": "16.12.0",
"@storybook/react": "^5.3.14",
"@types/jest": "^25.1.3",
"@typescript-eslint/eslint-plugin": "^2.16.0",
"@typescript-eslint/parser": "^2.16.0",
"concurrently": "^5.0.2",
Expand All @@ -31,9 +31,13 @@
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.18.0",
"husky": "^4.2.0",
"jest": "^25.1.0",
"lint-staged": "^9.5.0",
"prettier": "^1.19.1",
"react": "16.12.0",
"react-test-renderer": "16.12.0",
"rimraf": "^3.0.0",
"ts-jest": "^25.2.1",
"typescript": "^3.7.4",
"wait-on": "^3.3.0"
},
Expand Down
6 changes: 4 additions & 2 deletions services/listings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
"devDependencies": {
"@babel/core": "^7.8.3",
"@babel/preset-typescript": "^7.8.3",
"@types/jest": "^24.9.0",
"@types/jest": "^25.1.3",
"@types/jsonpath": "^0.2.0",
"@types/supertest": "^2.0.8",
"babel-jest": "^24.9.0",
"babel-jest": "^25.1.0",
"concurrently": "^5.0.2",
"jest": "^25.1.0",
"supertest": "^4.0.2",
"ts-node-dev": "^1.0.0-pre.44"
},
Expand Down
6 changes: 3 additions & 3 deletions shared/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
},
"devDependencies": {
"@babel/core": "^7.8.3",
"@types/jest": "^24.9.0",
"babel-jest": "^24.9.0",
"@types/jest": "^25.1.3",
"babel-jest": "^25.1.0",
"babel-loader": "^8.0.6",
"jest": "^24.9.0",
"jest": "^25.1.0",
"typescript": "^3.7.4",
"webpack": "^4.41.5"
},
Expand Down
1 change: 0 additions & 1 deletion shared/ui-components/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { configure } from "@storybook/react"
import "@bloom-housing/ui-components/styles/index.scss"

// Set up translation file
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import initStoryshots, { multiSnapshotWithOptions } from "@storybook/addon-storyshots"
import { mount } from "enzyme"
import { createSerializer } from "enzyme-to-json"
import MockDate from "mockdate"

// Force all tests to use dates far in the future, so the storyshot files
// remain consistent between runs.
MockDate.set("2030-04-01T16:00:00.000Z")

initStoryshots({
renderer: mount,
Expand Down
7 changes: 6 additions & 1 deletion shared/ui-components/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/*eslint no-undef: "error"*/
/*eslint-env node*/

process.env.TZ = "UTC"

module.exports = {
preset: "ts-jest",
globals: {
Expand All @@ -10,7 +12,10 @@ module.exports = {
},
rootDir: "../..",
roots: ["<rootDir>/shared/ui-components"],
transform: { "^.+\\.[t|j]sx?$": "ts-jest" },
transform: {
"^.+\\.stories\\.[t|j]sx$": "@storybook/addon-storyshots/injectFileName",
"^.+\\.[t|j]sx?$": "ts-jest"
},
setupFilesAfterEnv: ["<rootDir>/shared/ui-components/.jest/setup-tests.js"],
moduleNameMapper: {
"\\.(scss|css|less)$": "identity-obj-proxy"
Expand Down
30 changes: 16 additions & 14 deletions shared/ui-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,48 @@
"scripts": {
"build-storybook": "build-storybook -c .storybook",
"start": "export $(cat .env | xargs) && start-storybook -s ./public",
"test": "export $(cat .env | xargs) && jest"
"test": "export $(cat .env | xargs) && jest shared/ui-components"
},
"devDependencies": {
"@babel/core": "^7.8.3",
"@emotion/core": "^10.0.27",
"@emotion/styled": "10.0.27",
"@storybook/addon-a11y": "^5.3.8",
"@storybook/addon-docs": "^5.3.8",
"@storybook/addon-storyshots": "^5.3.8",
"@storybook/addon-viewport": "^5.3.8",
"@storybook/addon-a11y": "^5.3.13",
"@storybook/addon-docs": "^5.3.13",
"@storybook/addon-storyshots": "^5.3.13",
"@storybook/addon-viewport": "^5.3.13",
"@storybook/preset-typescript": "^1.2.0",
"@storybook/react": "^5.3.8",
"@types/enzyme": "^3.10.4",
"@types/enzyme-adapter-react-16": "^1.0.5",
"@types/jest": "^24.9.0",
"@storybook/react": "^5.3.14",
"@storybook/theming": "^5.3.13",
"@types/enzyme": "^3.10.5",
"@types/enzyme-adapter-react-16": "^1.0.6",
"@types/jest": "^25.1.3",
"@types/react-map-gl": "^5.0.4",
"@types/react-test-renderer": "^16.9.2",
"@types/webpack": "^4.41.3",
"babel-loader": "^8.0.6",
"babel-plugin-require-context-hook": "^1.0.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"enzyme-to-json": "^3.4.0",
"fork-ts-checker-webpack-plugin": "^4.0.2",
"enzyme-to-json": "^3.4.4",
"fork-ts-checker-webpack-plugin": "^4.0.4",
"identity-obj-proxy": "^3.0.0",
"jest": "^24.9.0",
"jest": "^25.1.0",
"mockdate": "^2.0.5",
"next": "9.2.0 ",
"node-sass": "^4.13.1",
"postcss-loader": "^3.0.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-accessible-accordion": "^3.0.0",
"react-docgen-typescript-loader": "^3.6.0",
"react-dom": "^16.12.0",
"react-is": "^16.12.0",
"react-media": "^1.10.0",
"react-test-renderer": "^16.12.0",
"regenerator-runtime": "^0.13.3",
"sass-loader": "^8.0.2",
"style-loader": "^1.1.3",
"ts-jest": "^24.3.0",
"ts-jest": "^25.2.1",
"ts-loader": "^6.2.1",
"typescript": "^3.7.4",
"webpack": "^4.41.5"
Expand Down
2 changes: 1 addition & 1 deletion shared/ui-components/src/atoms/Button.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from "react"
import { withA11y } from "@storybook/addon-a11y"
import Button, { ButtonProps } from "./Button"
import Button from "./Button"

export default {
component: Button,
Expand Down
Loading