Skip to content

Commit 09121ab

Browse files
author
Raice Hannay
committed
update deps + fix id query function
1 parent 3440a70 commit 09121ab

File tree

7 files changed

+2152
-2082
lines changed

7 files changed

+2152
-2082
lines changed

Diff for: .npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
registry=https://registry.npmjs.org/

Diff for: jest.config.js

+12-9
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,24 @@ module.exports = {
99
statements: 100,
1010
},
1111
},
12-
globals: {
13-
"ts-jest": {
14-
tsconfig: {
15-
target: "es6",
16-
},
17-
},
18-
},
1912
moduleDirectories: ["node_modules"],
20-
preset: "ts-jest",
2113
roots: ["<rootDir>/src"],
2214
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
2315
snapshotSerializers: ["enzyme-to-json/serializer"],
2416
testEnvironment: "jsdom",
17+
testEnvironmentOptions: { url: "http://localhost" },
2518
testMatch: ["**/*.test.{ts,tsx}"],
26-
testURL: "http://localhost",
19+
transform: {
20+
"^.+.tsx?$": [
21+
"ts-jest",
22+
{
23+
tsconfig: {
24+
sourceMap: true,
25+
target: "es6",
26+
},
27+
},
28+
],
29+
},
2730
transformIgnorePatterns: [
2831
"/node_modules/(?!intl-messageformat|intl-messageformat-parser).+\\.js$",
2932
],

Diff for: package.json

+34-26
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"author": "Raice Hannay <[email protected]>",
44
"description": "A set of classes to make setting up React components for unit tests easy.",
55
"license": "ISC",
6-
"version": "3.0.4",
6+
"version": "3.0.5",
77
"keywords": [
88
"component",
99
"enzyme",
@@ -31,10 +31,11 @@
3131
"lint": "eslint \"./src/**/*.ts?(x)\"",
3232
"lint:fix": "eslint \"./src/**/*.ts?(x)\" --fix",
3333
"test": "cross-env NODE_ENV=test jest --no-cache --runInBand --config ./jest.config.js",
34-
"test:all": "npm-run-all format typecheck lint:fix test:coverage",
34+
"test:all": "npm-run-all clean format typecheck lint:fix test:coverage",
3535
"test:coverage": "cross-env NODE_ENV=test jest --no-cache --runInBand --coverage --config ./jest.config.js",
36-
"typecheck": "tsc",
37-
"prepack": "rimraf ./enzyme && rimraf ./react-testing-library && tsc"
36+
"typecheck": "tsc --noEmit",
37+
"clean": "rimraf ./enzyme && rimraf ./react-testing-library",
38+
"prepack": "yarn clean && tsc"
3839
},
3940
"repository": {
4041
"type": "git",
@@ -47,8 +48,9 @@
4748
"types": "dist/index.d.ts",
4849
"peerDependencies": {
4950
"@testing-library/react": ">= 12.0.0",
51+
"@types/react": "^17.0.14",
5052
"enzyme": ">= 3.11.0",
51-
"react": ">= 17.0.2",
53+
"react": "~17.0.2",
5254
"react-intl": ">= 5.17.5",
5355
"react-redux": ">= 7.2.4",
5456
"redux": ">= 4.1.0"
@@ -72,39 +74,45 @@
7274
},
7375
"devDependencies": {
7476
"@testing-library/react": "^12.0.0",
75-
"@types/enzyme": "^3.10.9",
76-
"@types/jest": "^26.0.24",
77+
"@types/enzyme": "^3.10.12",
78+
"@types/jest": "^29.0.2",
7779
"@types/react": "^17.0.14",
78-
"@types/react-redux": "^7.1.17",
79-
"@typescript-eslint/eslint-plugin": "^4.28.2",
80-
"@typescript-eslint/parser": "^4.28.2",
81-
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.2",
80+
"@types/react-redux": "^7.1.24",
81+
"@typescript-eslint/eslint-plugin": "^5.37.0",
82+
"@typescript-eslint/parser": "^5.37.0",
83+
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
8284
"cross-env": "^7.0.3",
8385
"enzyme": "^3.11.0",
8486
"enzyme-to-json": "^3.6.2",
85-
"eslint": "^7.30.0",
86-
"eslint-config-voodoocreation": "^2.0.1",
87-
"eslint-plugin-import": "^2.23.4",
88-
"eslint-plugin-jest": "^24.3.6",
89-
"eslint-plugin-jsx-a11y": "^6.4.1",
87+
"eslint": "^8.23.1",
88+
"eslint-config-voodoocreation": "^3.0.2",
89+
"eslint-plugin-import": "^2.26.0",
90+
"eslint-plugin-jest": "^27.0.4",
91+
"eslint-plugin-jsx-a11y": "^6.6.1",
9092
"eslint-plugin-prefer-arrow": "^1.2.3",
91-
"eslint-plugin-react": "^7.24.0",
92-
"eslint-plugin-react-hooks": "^4.2.0",
93-
"jest": "^27.0.6",
93+
"eslint-plugin-react": "^7.31.8",
94+
"eslint-plugin-react-hooks": "^4.6.0",
95+
"jest": "^29.0.3",
96+
"jest-environment-jsdom": "^29.0.3",
9497
"npm-run-all": "^4.1.5",
95-
"prettier": "^2.3.2",
98+
"prettier": "^2.7.1",
9699
"react": "^17.0.2",
97100
"react-dom": "^17.0.2",
98-
"react-intl": "^5.20.4",
99-
"react-redux": "^7.2.4",
100-
"redux": "^4.1.0",
101+
"react-intl": "^6.1.1",
102+
"react-redux": "^8.0.2",
103+
"redux": "^4.2.0",
101104
"rimraf": "^3.0.2",
102-
"ts-jest": "^27.0.3",
103-
"typescript": "^4.3.5",
105+
"ts-jest": "^29.0.1",
106+
"typescript": "^4.8.3",
104107
"typescript-fsa": "^3.0.0",
105108
"typescript-fsa-reducers": "^1.2.2"
106109
},
107110
"dependencies": {
108-
"ts-deepmerge": "^1.0.8"
111+
"ts-deepmerge": "^4.0.0"
112+
},
113+
"resolutions": {
114+
"@types/react": "^17",
115+
"react": "^17",
116+
"react-dom": "^17"
109117
}
110118
}

Diff for: src/react-testing-library/queries.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const getMissingError = (attr: string) => (_: any, value: string) =>
1111
`Unable to find an element where ${attr} matches ${value}`;
1212

1313
const queryAllById: TFn = (container, id) =>
14-
Array.from(container.querySelectorAll(`.${id}`));
14+
Array.from(container.querySelectorAll(`#${id}`));
1515

1616
const queryAllByClassName: TFn = (container, id) =>
1717
Array.from(container.querySelectorAll(`.${id}`));
@@ -30,7 +30,7 @@ const [
3030
getAllByClassName,
3131
getByClassName,
3232
findAllByClassName,
33-
findByClassName
33+
findByClassName,
3434
] = buildQueries(
3535
queryAllByClassName,
3636
getMultipleError("className"),
@@ -42,14 +42,13 @@ const [
4242
getAllBySelector,
4343
getBySelector,
4444
findAllBySelector,
45-
findBySelector
45+
findBySelector,
4646
] = buildQueries(
4747
queryAllBySelector,
4848
getMultipleError("tag name"),
4949
getMissingError("tag name")
5050
);
5151

52-
5352
export {
5453
queryById,
5554
queryAllById,
@@ -68,5 +67,5 @@ export {
6867
getAllBySelector,
6968
getBySelector,
7069
findAllBySelector,
71-
findBySelector
70+
findBySelector,
7271
};

Diff for: test/IntlDummy.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from "react";
22
import { FormattedMessage } from "react-intl";
33

44
interface IProps {
5-
children: React.ReactNode | React.ReactNode[];
5+
children: React.ReactNode;
66
onClick?: (value: string) => void;
77
value: string;
88
}

Diff for: tsconfig.json

+8-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"baseUrl": ".",
44
"declaration": true,
55
"outDir": "./",
6-
"sourceMap": true,
6+
"sourceMap": false,
77
"module": "commonjs",
88
"target": "es5",
99
"lib": ["dom", "esnext"],
@@ -18,5 +18,11 @@
1818
"noUnusedParameters": true
1919
},
2020
"include": ["src/enzyme/index.ts", "src/react-testing-library/index.ts"],
21-
"exclude": ["**/coverage/*", "**/dist/*", "./react-testing-library", "./enzyme", "**/node_modules/*"]
21+
"exclude": [
22+
"**/coverage/*",
23+
"**/dist/*",
24+
"./react-testing-library",
25+
"./enzyme",
26+
"**/node_modules/*"
27+
]
2228
}

0 commit comments

Comments
 (0)