Skip to content

Commit

Permalink
tests: Make tests work again (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
tchock authored Nov 14, 2024
1 parent a1a9bab commit d4ecb87
Show file tree
Hide file tree
Showing 49 changed files with 1,278 additions and 1,762 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '12.x'
node-version: '18.x'

- name: install
run: 'yarn'
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/size-limit.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '12.x'
node-version: '18.x'

- name: install
run: 'yarn'
Expand Down
25 changes: 25 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const fs = require('fs');
const path = require('path');

const styleFiles = fs
.readdirSync(path.join(__dirname, 'src'))
.filter((file) => {
if (fs.lstatSync(path.join(__dirname, 'src', file)).isDirectory()) {
try {
return !!fs.statSync(path.join(__dirname, 'src', file, 'styles.ts'));
} catch {
return false;
}
}
return false;
})
.map((file) => path.join(__dirname, 'src', file, 'styles.ts'));

const config = {
// preset: 'ts-jest',
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!**/index.ts', '!**/*.stories.tsx'],
testPathIgnorePatterns: ['/node_modules/', '/build/'],
setupFilesAfterEnv: ['<rootDir>/jestSetup.ts', ...styleFiles],
};

module.exports = config;
1 change: 1 addition & 0 deletions jestSetup.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'regenerator-runtime/runtime';
import 'jest-styled-components';
import '@testing-library/jest-dom';
import 'jest-extended';
42 changes: 16 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"lint": "eslint --ext .js,.jsx,.ts,.tsx src"
},
"peerDependencies": {
"react": "^16.8.0",
"react-dom": "^16.8.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"styled-components": "^5.2.1"
},
"devDependencies": {
Expand All @@ -51,19 +51,21 @@
"@storybook/addon-essentials": "^6.1.11",
"@storybook/addon-links": "^6.1.11",
"@storybook/react": "^6.1.11",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/react": "^11.2.5",
"@testing-library/react": "^16.0.1",
"@testing-library/react-hooks": "^5.0.3",
"@types/jest": "^26.0.19",
"@types/react-transition-group": "^4.4.0",
"@types/react": "^18.3.12",
"@types/react-transition-group": "^4.4.11",
"@types/requestidlecallback": "^0.3.1",
"@types/styled-components": "^5.1.5",
"@types/styled-system": "^5.1.10",
"@typescript-eslint/eslint-plugin": "4.10.0",
"@typescript-eslint/eslint-plugin-tslint": "4.10.0",
"@typescript-eslint/parser": "4.10.0",
"babel-loader": "^8.2.2",
"babel-node": "^0.0.1-security",
"babel-plugin-styled-components": "^2.1.4",
"cross-env": "^7.0.3",
"docz": "^2.3.1",
"eslint": "7.16.0",
Expand All @@ -75,15 +77,15 @@
"eslint-plugin-react-hooks": "4.2.0",
"jest": "^26.6.3",
"jest-extended": "^0.11.5",
"jest-styled-components": "^7.0.3",
"jest-styled-components": "^7.2.0",
"prettier": "2.2.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-feather": "^2.0.9",
"rollup": "^2.39.0",
"rollup-plugin-terser": "^7.0.2",
"size-limit": "^4.9.2",
"styled-components": "^5.2.1",
"styled-components": "^6.1.13",
"styled-system": "^5.1.5",
"ts-jest": "^26.4.4",
"ts-node": "^9.1.1",
Expand All @@ -106,25 +108,13 @@
"deepmerge": "^4.2.2",
"isobject": "^4.0.0",
"react-popper": "^2.2.4",
"react-transition-group": "^4.4.1",
"use-resize-observer": "^7.0.0"
"react-transition-group": "^4.4.5",
"use-resize-observer": "^9.1.0"
},
"resolutions": {
"react": "18.3.1",
"react-dom": "18.3.1",
"@types/react": "18.3.12",
"react-docgen": "4.1.1"
},
"jest": {
"preset": "ts-jest",
"collectCoverageFrom": [
"src/**/*.{ts,tsx}",
"!**/index.ts",
"!**/*.stories.tsx"
],
"testPathIgnorePatterns": [
"/node_modules/",
"/build/"
],
"setupFilesAfterEnv": [
"<rootDir>/jestSetup.ts"
]
}
}
15 changes: 15 additions & 0 deletions src/Avatar/__snapshots__/Avatar.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ exports[`circle variant Render size large 1`] = `
class="c0 c1"
data-testid="pbl-avatar"
height="64"
variant="circle"
width="64"
/>
</div>
Expand All @@ -39,6 +40,7 @@ exports[`circle variant Render size medium 1`] = `
class="c0 c1"
data-testid="pbl-avatar"
height="40"
variant="circle"
width="40"
/>
</div>
Expand All @@ -61,6 +63,7 @@ exports[`circle variant Render size small 1`] = `
class="c0 c1"
data-testid="pbl-avatar"
height="32"
variant="circle"
width="32"
/>
</div>
Expand All @@ -83,6 +86,7 @@ exports[`circle variant Render size tiny 1`] = `
class="c0 c1"
data-testid="pbl-avatar"
height="24"
variant="circle"
width="24"
/>
</div>
Expand All @@ -105,6 +109,7 @@ exports[`circle variant Render size undefined 1`] = `
class="c0 c1"
data-testid="pbl-avatar"
height="40"
variant="circle"
width="40"
/>
</div>
Expand All @@ -127,6 +132,7 @@ exports[`square variant Render size large 1`] = `
class="c0 c1"
data-testid="pbl-avatar"
height="64"
variant="square"
width="64"
/>
</div>
Expand All @@ -149,6 +155,7 @@ exports[`square variant Render size medium 1`] = `
class="c0 c1"
data-testid="pbl-avatar"
height="40"
variant="square"
width="40"
/>
</div>
Expand All @@ -171,6 +178,7 @@ exports[`square variant Render size small 1`] = `
class="c0 c1"
data-testid="pbl-avatar"
height="32"
variant="square"
width="32"
/>
</div>
Expand All @@ -193,6 +201,7 @@ exports[`square variant Render size tiny 1`] = `
class="c0 c1"
data-testid="pbl-avatar"
height="24"
variant="square"
width="24"
/>
</div>
Expand All @@ -215,6 +224,7 @@ exports[`square variant Render size undefined 1`] = `
class="c0 c1"
data-testid="pbl-avatar"
height="40"
variant="square"
width="40"
/>
</div>
Expand All @@ -237,6 +247,7 @@ exports[`undefined variant Render size large 1`] = `
class="c0 c1"
data-testid="pbl-avatar"
height="64"
variant="square"
width="64"
/>
</div>
Expand All @@ -259,6 +270,7 @@ exports[`undefined variant Render size medium 1`] = `
class="c0 c1"
data-testid="pbl-avatar"
height="40"
variant="square"
width="40"
/>
</div>
Expand All @@ -281,6 +293,7 @@ exports[`undefined variant Render size small 1`] = `
class="c0 c1"
data-testid="pbl-avatar"
height="32"
variant="square"
width="32"
/>
</div>
Expand All @@ -303,6 +316,7 @@ exports[`undefined variant Render size tiny 1`] = `
class="c0 c1"
data-testid="pbl-avatar"
height="24"
variant="square"
width="24"
/>
</div>
Expand All @@ -325,6 +339,7 @@ exports[`undefined variant Render size undefined 1`] = `
class="c0 c1"
data-testid="pbl-avatar"
height="40"
variant="square"
width="40"
/>
</div>
Expand Down
Loading

0 comments on commit d4ecb87

Please sign in to comment.