Skip to content

Commit 3891796

Browse files
authored
fix react jest configuration (#173)
* fix react jest configuration * updated test script Co-authored-by: strausr <git config --global user.email>
1 parent 6857be2 commit 3891796

5 files changed

Lines changed: 8 additions & 39 deletions

File tree

packages/react/__tests__/AdvancedImage.test.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ describe('AdvancedImage', () => {
99
it('is truthy', () => {
1010
expect(AdvancedImage).toBeTruthy()
1111
});
12-
13-
it('renders AdvancedImage', async () => {
14-
const component = await mount(<AdvancedImage cldImg={cloudinaryImage} />);
15-
expect(component).toMatchSnapshot();
16-
});
17-
1812
it('should create an img tag', async function() {
1913
const component = await mount(<AdvancedImage cldImg={cloudinaryImage} />);
2014
expect(component.html()).toContain('src="https://res.cloudinary.com/demo/image/upload/sample"');

packages/react/__tests__/__snapshots__/AdvancedImage.test.tsx.snap

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/react/__tests__/tsconfig.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/react/jest.config.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"preset": "ts-jest",
3-
"testEnvironment": "node",
43
"bail": true,
54
"collectCoverageFrom": [
65
"<rootDir>/src/**/*.ts"
76
],
87
"transform": {
9-
"^.+\\.tsx?$": "ts-jest"
8+
"^.+\\.(js|ts|tsx)$": "ts-jest"
109
},
10+
"testEnvironment": "jsdom",
1111
"moduleFileExtensions": [
1212
"ts",
1313
"tsx",
@@ -17,8 +17,12 @@
1717
"node"
1818
],
1919
"modulePaths": [
20+
"node_modules",
2021
"<rootDir>/src"
2122
],
23+
"testPathIgnorePatterns": [
24+
"./__tests__/testUtils"
25+
],
2226
"snapshotSerializers": ["enzyme-to-json/serializer"],
2327
"coverageThreshold": {
2428
"global": {
@@ -34,7 +38,7 @@
3438
}
3539
},
3640
"transformIgnorePatterns": [
37-
"node_modules/(?!(@cloudinary/url-gen)).*\\.js$"
41+
"/node_modules\/(?!@cloudinary/(html|url-gen|transformation-builder-sdk))(.*)"
3842
],
3943
"setupFilesAfterEnv": [
4044
"./src/setupTests.js"

packages/react/package.json

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"scripts": {
1616
"build": "npm run build --prefix ../html && tsc && rollup -c && cp package.json ./dist",
17-
"test": "jest",
17+
"test": "jest --config jest.config.json",
1818
"test-coverage": "jest --coverage"
1919
},
2020
"peerDependencies": {
@@ -66,18 +66,6 @@
6666
"ts-jest": "^26.4.4",
6767
"typescript": "^3.7.5"
6868
},
69-
"jest": {
70-
"transformIgnorePatterns": [
71-
"node_modules/(?!(@cloudinary/url-gen)).*\\.js$"
72-
],
73-
"setupFilesAfterEnv": [
74-
"./src/setupTests.js"
75-
],
76-
"testPathIgnorePatterns": [
77-
"<rootDir>/__tests__/testUtils",
78-
"<rootDir>/dist"
79-
]
80-
},
8169
"dependencies": {
8270
"@cloudinary/html": "^1.4.2"
8371
}

0 commit comments

Comments
 (0)