Skip to content

Commit e173773

Browse files
committed
Refactor jest configuration
1 parent 49aec55 commit e173773

File tree

173 files changed

+998
-1230
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+998
-1230
lines changed

package-scripts.js

-14
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
* `package.json:scripts`.
1313
*/
1414

15-
const path = require("path");
16-
const PKG_SRC = path.resolve("src");
17-
1815
// For publishing, use the core package's version.
1916
const coreVersion = require("./packages/victory-core/package.json").version;
2017
if (!coreVersion) {
@@ -60,17 +57,6 @@ module.exports = {
6057
"lint:pkg": 'nps "lint:base src"',
6158
"lint:pkg:fix": 'nps "lint:base --fix src"',
6259

63-
// Tests
64-
// - Jest
65-
// TODO(2375): Can we cache / incremental?
66-
// https://github.com/FormidableLabs/victory/issues/2375
67-
"jest:native": `cross-env BABEL_ENV=commonjs jest --config=../../test/jest-native-config.js --passWithNoTests --testPathPattern=${PKG_SRC}`,
68-
"jest:pkg": `cross-env BABEL_ENV=commonjs jest --config=../../test/jest-config.js --passWithNoTests --testPathPattern=${PKG_SRC}`,
69-
// TODO(2348): Hook coverage up to CI
70-
// https://github.com/FormidableLabs/victory/issues/2348
71-
// TODO(2348): Add this to `check:ci`
72-
"jest:cov": "echo TODO",
73-
7460
// - TypeScript
7561
// TODO(2375): Can we cache / incremental?
7662
// https://github.com/FormidableLabs/victory/issues/2375

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"@testing-library/react-hooks": "^8.0.0",
5656
"@testing-library/react-native": "^11.0.0",
5757
"@types/fs-extra": "^11.0.3",
58-
"@types/jest": "^28.1.6",
58+
"@types/jest": "^29.5.12",
5959
"@types/lodash": "^4.14.149",
6060
"@types/node": "^18.6.1",
6161
"@types/prop-types": "^15.7.5",
@@ -64,7 +64,7 @@
6464
"@types/testing-library__jest-dom": "^5.14.5",
6565
"@typescript-eslint/eslint-plugin": "^5.32.0",
6666
"@typescript-eslint/parser": "^5.32.0",
67-
"babel-jest": "^28.1.3",
67+
"babel-jest": "^29.7.0",
6868
"babel-loader": "^8.2.5",
6969
"babel-plugin-lodash": "^3.1.2",
7070
"babel-plugin-module-resolver": "^4.1.0",
@@ -87,8 +87,8 @@
8787
"fs-extra": "^10.0.0",
8888
"glob": "8.0.3",
8989
"immutable": "^3.8.2",
90-
"jest": "^28.1.3",
91-
"jest-environment-jsdom": "^28.1.3",
90+
"jest": "^29.7.0",
91+
"jest-environment-jsdom": "^29.7.0",
9292
"lodash": "^4.17.19",
9393
"lodash-webpack-plugin": "^0.11.6",
9494
"mdast-util-to-string": "^1.0.6",
@@ -107,7 +107,7 @@
107107
"seedrandom": "^3.0.5",
108108
"storybook": "^7.6.7",
109109
"styled-components": "^5.3.5",
110-
"ts-jest": "^28.0.7",
110+
"ts-jest": "^29.1.2",
111111
"ts-loader": "^9.3.0",
112112
"ts-node": "^10.9.1",
113113
"typescript": "^4.7.3",

packages/victory-area/jest.config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import rootConfig from '../../test/jest.config';
2+
3+
export default {
4+
...rootConfig,
5+
};

packages/victory-area/package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
"react": ">=16.6.0"
2929
},
3030
"devDependencies": {
31-
"victory-chart": "*",
32-
"victory-area": "*"
31+
"victory-chart": "*"
3332
},
3433
"publishConfig": {
3534
"provenance": true
@@ -275,7 +274,7 @@
275274
]
276275
},
277276
"jest": {
278-
"command": "nps jest:pkg",
277+
"command": "jest --passWithNoTests",
279278
"files": [
280279
"src/**/*.test.*",
281280
"../../.babelrc.js",
@@ -284,7 +283,6 @@
284283
],
285284
"output": [],
286285
"dependencies": [
287-
"build:lib:cjs",
288286
"../victory-chart:build:lib:cjs",
289287
"../victory-vendor:build:lib:cjs",
290288
"../victory-voronoi:build:lib:cjs"

packages/victory-area/src/area.test.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React from "react";
2-
import { Area } from "victory-area";
32
import { render } from "@testing-library/react";
43
import { VictoryContainer } from "victory-core";
54
import * as d3Scale from "victory-vendor/d3-scale";
65

6+
import { Area } from "./area";
7+
78
describe("victory-primitives/area", () => {
89
const baseProps = {
910
data: [

packages/victory-area/src/helper-methods.test.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { getDataWithBaseline } from "victory-area/lib/helper-methods";
21
import * as d3Scale from "victory-vendor/d3-scale";
32

3+
import { getDataWithBaseline } from "./helper-methods";
4+
45
describe("victory-area/helper-methods", () => {
56
describe("getDataWithBaseline", () => {
67
const data = [

packages/victory-area/src/victory-area.test.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { fireEvent, render, screen } from "@testing-library/react";
22
import React from "react";
3-
import { Area, VictoryArea, VictoryAreaProps } from "victory-area";
43
import { VictoryChart } from "victory-chart";
54
import { Helpers } from "victory-core";
65
import { curveCatmullRom } from "victory-vendor/d3-shape";
6+
77
import { calculateD3Path } from "../../../test/helpers/svg";
8+
import { Area } from './area';
9+
import { VictoryArea, VictoryAreaProps } from "./victory-area";
810

911
describe("components/victory-area", () => {
1012
describe("default component rendering", () => {
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"extends": "../../tsconfig.base.json",
3-
"exclude": ["**/*.test.*", "es", "lib"]
3+
"exclude": ["**/*.test.*", "es", "lib", "jest.config.ts"]
44
}

packages/victory-area/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"extends": "../../tsconfig.base.json",
3-
"exclude": ["es", "lib"]
3+
"exclude": ["es", "lib", "jest.config.ts"]
44
}

packages/victory-axis/jest.config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import rootConfig from '../../test/jest.config';
2+
3+
export default {
4+
...rootConfig,
5+
};

packages/victory-axis/package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"react": ">=16.6.0"
2828
},
2929
"devDependencies": {
30-
"victory-axis": "*",
3130
"victory-chart": "*"
3231
},
3332
"publishConfig": {
@@ -267,7 +266,7 @@
267266
]
268267
},
269268
"jest": {
270-
"command": "nps jest:pkg",
269+
"command": "jest --passWithNoTests",
271270
"files": [
272271
"src/**/*.test.*",
273272
"../../.babelrc.js",
@@ -276,7 +275,6 @@
276275
],
277276
"output": [],
278277
"dependencies": [
279-
"build:lib:cjs",
280278
"../victory-chart:build:lib:cjs",
281279
"../victory-vendor:build:lib:cjs",
282280
"../victory-voronoi:build:lib:cjs"

packages/victory-axis/src/victory-axis.test.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React from "react";
2-
import { VictoryAxis } from "victory-axis";
3-
import { VictoryChart } from "victory-chart";
42
import { render, screen } from "@testing-library/react";
3+
import { VictoryChart } from "victory-chart";
4+
5+
import { VictoryAxis } from "./victory-axis";
56

67
describe("components/victory-axis", () => {
78
it("should render two axes by default", () => {
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"extends": "../../tsconfig.base.json",
3-
"exclude": ["**/*.test.*", "es", "lib"]
3+
"exclude": ["**/*.test.*", "es", "lib", "jest.config.ts"]
44
}

packages/victory-axis/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"extends": "../../tsconfig.base.json",
3-
"exclude": ["es", "lib"]
3+
"exclude": ["es", "lib", "jest.config.ts"]
44
}

packages/victory-bar/jest.config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import rootConfig from '../../test/jest.config';
2+
3+
export default {
4+
...rootConfig,
5+
};

packages/victory-bar/package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
"react": ">=16.6.0"
2929
},
3030
"devDependencies": {
31-
"victory-chart": "*",
32-
"victory-bar": "*"
31+
"victory-chart": "*"
3332
},
3433
"publishConfig": {
3534
"provenance": true
@@ -275,7 +274,7 @@
275274
]
276275
},
277276
"jest": {
278-
"command": "nps jest:pkg",
277+
"command": "jest --passWithNoTests",
279278
"files": [
280279
"src/**/*.test.*",
281280
"../../.babelrc.js",
@@ -284,7 +283,6 @@
284283
],
285284
"output": [],
286285
"dependencies": [
287-
"build:lib:cjs",
288286
"../victory-chart:build:lib:cjs",
289287
"../victory-vendor:build:lib:cjs",
290288
"../victory-voronoi:build:lib:cjs"

packages/victory-bar/src/bar.test.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import React from "react";
22
import { render } from "@testing-library/react";
33
import * as d3Scale from "victory-vendor/d3-scale";
44
import { VictoryContainer } from "victory-core";
5-
import { Bar } from "victory-bar";
5+
66
import { getBarShape } from "../../../test/helpers";
7+
import { Bar } from "./bar";
78

89
describe("victory-primitives/bar", () => {
910
const baseProps = {

packages/victory-bar/src/geometry-helper-methods.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { circle, point } from "victory-bar/lib/geometry-helper-methods";
1+
import { circle, point } from './geometry-helper-methods';
22

33
describe("point", () => {
44
describe("calculates distances", () => {

packages/victory-bar/src/victory-bar.test.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import * as React from "react";
22
import { render, fireEvent, screen } from "@testing-library/react";
33
import { VictoryChart } from "victory-chart";
4-
import { Bar, VictoryBar } from "victory-bar";
54
import { Helpers } from "victory-core";
65

76
import { isBar, getBarHeight } from "../../../test/helpers";
7+
import { Bar } from './bar';
8+
import { VictoryBar } from './victory-bar';
89

910
describe("components/victory-bar", () => {
1011
describe("default component rendering", () => {
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"extends": "../../tsconfig.base.json",
3-
"exclude": ["**/*.test.*", "es", "lib"]
3+
"exclude": ["**/*.test.*", "es", "lib", "jest.config.ts"]
44
}

packages/victory-bar/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"extends": "../../tsconfig.base.json",
3-
"exclude": ["es", "lib"]
3+
"exclude": ["es", "lib", "jest.config.ts"]
44
}
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import rootConfig from '../../test/jest.config';
2+
3+
export default {
4+
...rootConfig,
5+
};

packages/victory-box-plot/package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
"devDependencies": {
3131
"victory-box-plot": "*",
32-
"victory-chart": "^36.9.1"
32+
"victory-chart": "*"
3333
},
3434
"publishConfig": {
3535
"provenance": true
@@ -275,7 +275,7 @@
275275
]
276276
},
277277
"jest": {
278-
"command": "nps jest:pkg",
278+
"command": "jest --passWithNoTests",
279279
"files": [
280280
"src/**/*.test.*",
281281
"../../.babelrc.js",
@@ -284,7 +284,6 @@
284284
],
285285
"output": [],
286286
"dependencies": [
287-
"build:lib:cjs",
288287
"../victory-chart:build:lib:cjs",
289288
"../victory-vendor:build:lib:cjs",
290289
"../victory-voronoi:build:lib:cjs"

packages/victory-box-plot/src/victory-box-plot.test.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { render, screen } from "@testing-library/react";
22
import React from "react";
3-
import { VictoryBoxPlot } from "victory-box-plot";
43
import { VictoryChart } from "victory-chart";
54
import { Border, LineSegment, Whisker } from "victory-core";
65

6+
import { VictoryBoxPlot } from "./victory-box-plot";
7+
78
const TEST_GROUP_ID = "test-group-id";
89
const dataset = [
910
{ x: 1, min: 1, max: 18, median: 8, q1: 5, q3: 15 },
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"extends": "../../tsconfig.base.json",
3-
"exclude": ["**/*.test.*", "es", "lib"]
3+
"exclude": ["**/*.test.*", "es", "lib", "jest.config.ts"]
44
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"extends": "../../tsconfig.base.json",
3-
"exclude": ["es", "lib"]
3+
"exclude": ["es", "lib", "jest.config.ts"]
44
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import rootConfig from '../../test/jest.config';
2+
3+
export default {
4+
...rootConfig,
5+
};

packages/victory-brush-container/package.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
"peerDependencies": {
2828
"react": ">=16.6.0"
2929
},
30-
"devDependencies": {
31-
"victory-brush-container": "*"
32-
},
3330
"publishConfig": {
3431
"provenance": true
3532
},
@@ -264,7 +261,7 @@
264261
]
265262
},
266263
"jest": {
267-
"command": "nps jest:pkg",
264+
"command": "jest --passWithNoTests",
268265
"files": [
269266
"src/**/*.test.*",
270267
"../../.babelrc.js",
@@ -273,7 +270,6 @@
273270
],
274271
"output": [],
275272
"dependencies": [
276-
"build:lib:cjs",
277273
"../victory-vendor:build:lib:cjs",
278274
"../victory-voronoi:build:lib:cjs"
279275
],

packages/victory-brush-container/src/brush-helpers.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BrushHelpers } from "victory-brush-container";
1+
import { BrushHelpers } from "./brush-helpers";
22

33
describe("containers/brush-helpers", () => {
44
// eslint-disable-next-line @typescript-eslint/unbound-method
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"extends": "../../tsconfig.base.json",
3-
"exclude": ["**/*.test.*", "es", "lib"]
3+
"exclude": ["**/*.test.*", "es", "lib", "jest.config.ts"]
44
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"extends": "../../tsconfig.base.json",
3-
"exclude": ["es", "lib"]
3+
"exclude": ["es", "lib", "jest.config.ts"]
44
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import rootConfig from '../../test/jest.config';
2+
3+
export default {
4+
...rootConfig,
5+
};

0 commit comments

Comments
 (0)