Skip to content

Commit 1e26a38

Browse files
committed
Fix jest and dependencies clean up
Signed-off-by: handreyrc <handrey.cunha@gmail.com>
1 parent 17e73b3 commit 1e26a38

10 files changed

Lines changed: 1851 additions & 463 deletions

File tree

babel.config.base.json

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

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121
},
2222
"devDependencies": {
2323
"@serverless-workflow-settings/eslint-config": "workspace:*",
24-
"@types/node": "^25.3.3",
24+
"@types/jest": "^30.0.0",
2525
"eslint": "^9.39.4",
26+
"eslint-config-prettier": "^10.1.8",
2627
"eslint-plugin-prettier": "^5.5.5",
2728
"eslint-plugin-react": "^7.37.5",
29+
"eslint-plugin-react-hooks": "^7.0.1",
2830
"prettier": "^3.8.1",
2931
"typescript": "^5.9.3",
3032
"typescript-eslint": "^8.56.1"

packages/eslint-config/package.json

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,5 @@
1919
"lint": "eslint ./ ",
2020
"lint:fix": "eslint ./ --fix",
2121
"build:prod": "pnpm lint"
22-
},
23-
"peerDependencies": {
24-
"eslint": "^9.39.4",
25-
"prettier": "^3.8.1"
26-
},
27-
"devDependencies": {
28-
"eslint": "^9.39.4",
29-
"eslint-config-prettier": "^10.1.8",
30-
"eslint-plugin-prettier": "^5.5.5",
31-
"eslint-plugin-react": "^7.37.5",
32-
"eslint-plugin-react-hooks": "^7.0.1",
33-
"prettier": "^3.8.1",
34-
"typescript-eslint": "^8.56.1"
3522
}
3623
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "../../babel.config.base.json"
3+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright 2021-Present The Serverless Workflow Specification Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import type { Config } from "jest";
18+
19+
const config: Config = {
20+
preset: "ts-jest",
21+
testEnvironment: "jsdom",
22+
setupFilesAfterEnv: ["<rootDir>/tests/setupTests.ts"],
23+
transform: {
24+
"^.+\\.jsx?$": ["babel-jest", { presets: [["@babel/env", { targets: { node: "current" } }]] }],
25+
},
26+
moduleNameMapper: {
27+
"\\.(css|less|scss|sass)$": "identity-obj-proxy",
28+
},
29+
resolver: undefined,
30+
};
31+
32+
export default config;

packages/serverless-workflow-diagram-editor/package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"clean": "rimraf ./dist",
2929
"clean:storybook": "rimraf ./dist-storybook",
3030
"build:dev": "pnpm clean && tsc -p tsconfig.json",
31-
"build:prod": "pnpm lint && pnpm test && pnpm clean && tsc -p tsconfig.json",
31+
"build:prod": "pnpm lint && pnpm clean && tsc -p tsconfig.json && pnpm test",
3232
"test": "jest --silent --verbose --passWithNoTests",
3333
"start": "storybook dev -p 6006",
3434
"build:storybook": "pnpm clean:storybook && storybook build --output-dir ./dist-storybook"
@@ -43,26 +43,31 @@
4343
"react-dom": "^19.2.4"
4444
},
4545
"devDependencies": {
46-
"@serverless-workflow-settings/eslint-config": "workspace:*",
46+
"@babel/cli": "^7.28.6",
47+
"@babel/core": "^7.29.0",
48+
"@babel/preset-env": "^7.29.0",
49+
"@babel/preset-flow": "^7.27.1",
50+
"@babel/preset-react": "^7.28.5",
51+
"@babel/preset-typescript": "^7.28.5",
4752
"@storybook/addon-a11y": "^10.2.16",
4853
"@storybook/addon-docs": "^10.2.16",
4954
"@storybook/addon-webpack5-compiler-swc": "^4.0.2",
5055
"@storybook/react-webpack5": "^10.2.16",
56+
"@testing-library/dom": "^10.4.1",
5157
"@testing-library/jest-dom": "^6.9.1",
5258
"@testing-library/react": "^16.3.2",
53-
"@types/jest": "^30.0.0",
59+
"@testing-library/user-event": "^14.6.1",
5460
"@types/node": "^25.3.3",
5561
"@types/react": "^19.2.14",
5662
"@types/react-dom": "^19.2.3",
5763
"eslint-plugin-storybook": "^10.2.16",
5864
"globals": "^17.4.0",
65+
"identity-obj-proxy": "^3.0.0",
5966
"jest": "^30.2.0",
6067
"jest-environment-jsdom": "^30.2.0",
6168
"jiti": "^2.6.1",
6269
"rimraf": "^6.1.3",
6370
"storybook": "^10.2.16",
64-
"ts-jest": "^29.4.6",
65-
"typescript": "^5.9.3",
66-
"typescript-eslint": "^8.56.1"
71+
"ts-jest": "^29.4.6"
6772
}
6873
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2021-Present The Serverless Workflow Specification Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import React from "react";
18+
import { render, screen } from "@testing-library/react";
19+
import { DiagramEditor } from "../../dist/diagram-editor";
20+
import userEvent from "@testing-library/user-event";
21+
22+
describe("DiagramEditor Component", () => {
23+
test("Render DiagramEditor Component", async () => {
24+
const content = "Sample Content";
25+
const isReadOnly = true;
26+
27+
render(<DiagramEditor content={content} isReadOnly={isReadOnly} />);
28+
29+
const user = userEvent.setup();
30+
const button = screen.getByRole("button", { name: /Click me!/i });
31+
32+
await user.click(button);
33+
34+
const label = screen.findByLabelText("Patternfly is alive.");
35+
36+
expect(label).not.toBeNull();
37+
});
38+
});

packages/serverless-workflow-diagram-editor/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
4-
"rootDir": "./src",
4+
"rootDirs": ["./src","./tests"],
55
"outDir": "./dist",
66
},
77
"include": ["src/**/*"],

0 commit comments

Comments
 (0)