Skip to content

Commit da70f97

Browse files
authored
Merge pull request #21 from elastic/add_eui_and_styles
chore: configure Babel and Jest, add @elastic/eui and styled-componen…
2 parents 4b13f82 + c257710 commit da70f97

11 files changed

+2387
-124
lines changed

.babelrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"presets": [
3+
"@babel/preset-env",
4+
["@babel/preset-react", { "runtime": "automatic" }],
5+
"@babel/preset-typescript"
6+
]
7+
}

jest.config.js

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,38 @@
1-
/** @type {import('ts-jest').JestConfigWithTsJest} **/
1+
/** @type {import('jest').Config} **/
22

33
export default {
4-
preset: "ts-jest",
54
testEnvironment: "jsdom",
65
moduleNameMapper: {
76
"^.+\\.svg$": "jest-svg-transformer",
8-
"\\.(css|less|scss)$": "identity-obj-proxy",
7+
"^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy",
8+
"\\.(css|less|sass|scss)$": "identity-obj-proxy",
9+
"@elastic/eui/es/(.*)?": "<rootDir>/node_modules/@elastic/eui/test-env/$1",
10+
"@elastic/eui$": "<rootDir>/node_modules/@elastic/eui/test-env",
911
},
12+
transform: {
13+
"^.+\\.(js|ts|tsx|mjs)$": [
14+
"babel-jest",
15+
{
16+
presets: [
17+
[
18+
"@babel/preset-typescript",
19+
{ "preset-env": { modules: "commonjs" } },
20+
],
21+
],
22+
plugins: [
23+
"babel-plugin-transform-import-meta",
24+
"babel-plugin-explicit-exports-references",
25+
],
26+
},
27+
],
28+
".+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$":
29+
"jest-transform-stub",
30+
},
31+
transformIgnorePatterns: [
32+
"/node_modules/(?!(@elastic/eui|uuid|react-dnd|dnd-core|@react-dnd|lodash-es)/)",
33+
"/node_modules/(?!(uuid|unist-util-visit|unist-util-visit-parents|unist-util-is)/)",
34+
"^.+\\.module\\.(css|sass|scss)$",
35+
],
1036
setupFilesAfterEnv: ["<rootDir>/src/setupTests.ts"],
11-
testTimeout: 100000,
37+
testTimeout: 500000,
1238
};

package.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,20 @@
1414
"test:hidden:individual": "jest src/App.individualHidden.test.tsx"
1515
},
1616
"dependencies": {
17+
"@elastic/datemath": "^5.0.3",
18+
"@elastic/eui": "^98.1.0",
19+
"@emotion/css": "^11.13.5",
20+
"@emotion/react": "^11.13.5",
21+
"moment": "^2.30.1",
1722
"react": "^18.3.1",
18-
"react-dom": "^18.3.1"
23+
"react-dom": "^18.3.1",
24+
"styled-components": "^6.1.13"
1925
},
2026
"devDependencies": {
27+
"@babel/core": "^7.26.0",
28+
"@babel/preset-env": "^7.26.0",
29+
"@babel/preset-react": "^7.26.3",
30+
"@babel/preset-typescript": "^7.26.0",
2131
"@eslint/js": "9.15.0",
2232
"@testing-library/dom": "10.4.0",
2333
"@testing-library/jest-dom": "6.6.3",
@@ -27,12 +37,17 @@
2737
"@types/react": "18.3.12",
2838
"@types/react-dom": "18.3.1",
2939
"@vitejs/plugin-react": "4.3.3",
40+
"babel-jest": "^29.7.0",
41+
"babel-plugin-explicit-exports-references": "^1.0.2",
42+
"babel-plugin-transform-import-meta": "^2.2.1",
3043
"eslint": "9.15.0",
3144
"eslint-plugin-react-hooks": "5.0.0",
3245
"eslint-plugin-react-refresh": "0.4.14",
3346
"globals": "15.12.0",
47+
"identity-obj-proxy": "^3.0.0",
3448
"jest": "29.7.0",
3549
"jest-environment-jsdom": "29.7.0",
50+
"jest-transform-stub": "^2.0.0",
3651
"ts-jest": "29.2.5",
3752
"typescript": "5.7.2",
3853
"typescript-eslint": "8.15.0",

src/App.defaultHidden.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const components = [
2727
},
2828
];
2929

30-
describe("App defaultHidden test", () => {
30+
describe("App.defaultHidden", () => {
3131
// The hidden attribute is only only affecting `ByRole` queries
3232
describe.each(components)(
3333
"Perf testing $name component with iterations complexity if '$iterations' and depth complexity of '$depth'",

src/App.individualHidden.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { waitFor, render, screen } from "@testing-library/react";
22
import userEvent from "@testing-library/user-event";
3+
34
import App from "./App";
45

56
const components = [
@@ -23,7 +24,7 @@ const components = [
2324
},
2425
];
2526

26-
describe("App individual hidden test", () => {
27+
describe("App.defaultHidden", () => {
2728
// The hidden attribute is only only affecting `ByRole` queries
2829
describe.each(components)(
2930
"Perf testing $name component with iterations complexity if '$iterations' and depth complexity of '$depth'",

0 commit comments

Comments
 (0)