Skip to content

Commit

Permalink
chore: point to babelrc from jest config
Browse files Browse the repository at this point in the history
  • Loading branch information
annawen1 committed Dec 9, 2024
1 parent d03dd45 commit 8690547
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 70 deletions.
2 changes: 1 addition & 1 deletion packages/react/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(js|jsx)$': 'babel-jest',
'^.+\\.(js|jsx)$': ['babel-jest', { configFile: './.babelrc' }],
},
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],

Expand Down
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "@carbon/labs-react-components",
"version": "0.0.0",
"private": true,
"type": "module",
"description": "Carbon Labs React components",
"license": "Apache-2.0",
"repository": "https://github.com/carbon-design-system/carbon-labs",
Expand All @@ -12,7 +11,8 @@
"scripts": {
"storybook": "storybook dev -p 3000",
"build-storybook": "storybook build",
"test": "jest"
"test": "jest",
"test:updateSnapshot": "jest -u"
},
"browserslist": {
"production": [
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import { ExampleButton } from '../components/ExampleButton';
jest.mock('./button.scss', () => ({}));
describe('ExampleButton', () => {
describe('renders as expected - Component API', () => {
it('should match snapshot', () => {
const { container } = render(<ExampleButton />);
expect(container).toMatchSnapshot();
});

it('renders a button element', () => {
render(<ExampleButton />);
expect(screen.getByRole('button')).toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`YourComponent should match snapshot 1`] = `
exports[`ExampleButton renders as expected - Component API should match snapshot 1`] = `
<div>
<button
class="cds--btn cds--btn--primary"
Expand Down
118 changes: 62 additions & 56 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2688,6 +2688,12 @@ __metadata:
languageName: unknown
linkType: soft

"@carbon-labs/example-button@workspace:packages/react/src/components/ExampleButton":
version: 0.0.0-use.local
resolution: "@carbon-labs/example-button@workspace:packages/react/src/components/ExampleButton"
languageName: unknown
linkType: soft

"@carbon-labs/network-graph@workspace:packages/web-components/src/components/network-graph":
version: 0.0.0-use.local
resolution: "@carbon-labs/network-graph@workspace:packages/web-components/src/components/network-graph"
Expand Down Expand Up @@ -2785,6 +2791,62 @@ __metadata:
languageName: node
linkType: hard

"@carbon/labs-react-components@workspace:packages/react":
version: 0.0.0-use.local
resolution: "@carbon/labs-react-components@workspace:packages/react"
dependencies:
"@babel/core": "npm:^7.26.0"
"@babel/preset-env": "npm:^7.26.0"
"@babel/preset-react": "npm:^7.26.3"
"@babel/preset-typescript": "npm:^7.26.0"
"@carbon/react": "npm:^1.71.1"
"@carbon/styles": "npm:^1.70.0"
"@chromatic-com/storybook": "npm:^3.2.2"
"@mdx-js/react": "npm:^3.1.0"
"@storybook/addon-docs": "npm:^8.4.6"
"@storybook/addon-essentials": "npm:^8.4.6"
"@storybook/addon-interactions": "npm:^8.4.6"
"@storybook/addon-onboarding": "npm:^8.4.6"
"@storybook/addon-storysource": "npm:^8.4.6"
"@storybook/addon-webpack5-compiler-babel": "npm:^3.0.3"
"@storybook/blocks": "npm:^8.4.6"
"@storybook/react": "npm:^8.4.6"
"@storybook/react-webpack5": "npm:^8.4.6"
"@storybook/test": "npm:^8.4.6"
"@testing-library/jest-dom": "npm:^5.17.0"
"@testing-library/react": "npm:^16.1.0"
"@testing-library/user-event": "npm:^14.5.2"
"@types/babel__core": "npm:^7"
"@types/babel__preset-env": "npm:^7"
"@types/jest": "npm:^27.5.2"
"@types/node": "npm:^16.18.121"
"@types/prop-types": "npm:^15"
"@types/react": "npm:^18.3.12"
"@types/react-dom": "npm:^18.3.1"
autoprefixer: "npm:^10.4.20"
babel-jest: "npm:^29.7.0"
css-loader: "npm:^7.1.2"
eslint-plugin-storybook: "npm:^0.11.1"
jest: "npm:^29.7.0"
jest-environment-jsdom: "npm:^29.7.0"
mini-css-extract-plugin: "npm:^2.9.2"
postcss: "npm:^8.4.49"
postcss-loader: "npm:^8.1.1"
prop-types: "npm:^15.8.1"
react: "npm:^18.3.1"
react-dom: "npm:^18.3.1"
remark-gfm: "npm:^4.0.0"
sass-loader: "npm:^16.0.4"
storybook: "npm:^8.4.6"
storybook-addon-accessibility-checker: "npm:^3.1.61-rc.3"
style-loader: "npm:^4.0.0"
ts-jest: "npm:^29.2.5"
typescript: "npm:^5.2.2"
typescript-config-carbon: "npm:^0.3.0"
webpack: "npm:^5.97.0"
languageName: unknown
linkType: soft

"@carbon/labs-web-components@workspace:packages/web-components":
version: 0.0.0-use.local
resolution: "@carbon/labs-web-components@workspace:packages/web-components"
Expand Down Expand Up @@ -21666,62 +21728,6 @@ __metadata:
languageName: node
linkType: hard

"my-app@workspace:packages/react":
version: 0.0.0-use.local
resolution: "my-app@workspace:packages/react"
dependencies:
"@babel/core": "npm:^7.26.0"
"@babel/preset-env": "npm:^7.26.0"
"@babel/preset-react": "npm:^7.26.3"
"@babel/preset-typescript": "npm:^7.26.0"
"@carbon/react": "npm:^1.71.1"
"@carbon/styles": "npm:^1.70.0"
"@chromatic-com/storybook": "npm:^3.2.2"
"@mdx-js/react": "npm:^3.1.0"
"@storybook/addon-docs": "npm:^8.4.6"
"@storybook/addon-essentials": "npm:^8.4.6"
"@storybook/addon-interactions": "npm:^8.4.6"
"@storybook/addon-onboarding": "npm:^8.4.6"
"@storybook/addon-storysource": "npm:^8.4.6"
"@storybook/addon-webpack5-compiler-babel": "npm:^3.0.3"
"@storybook/blocks": "npm:^8.4.6"
"@storybook/react": "npm:^8.4.6"
"@storybook/react-webpack5": "npm:^8.4.6"
"@storybook/test": "npm:^8.4.6"
"@testing-library/jest-dom": "npm:^5.17.0"
"@testing-library/react": "npm:^16.1.0"
"@testing-library/user-event": "npm:^14.5.2"
"@types/babel__core": "npm:^7"
"@types/babel__preset-env": "npm:^7"
"@types/jest": "npm:^27.5.2"
"@types/node": "npm:^16.18.121"
"@types/prop-types": "npm:^15"
"@types/react": "npm:^18.3.12"
"@types/react-dom": "npm:^18.3.1"
autoprefixer: "npm:^10.4.20"
babel-jest: "npm:^29.7.0"
css-loader: "npm:^7.1.2"
eslint-plugin-storybook: "npm:^0.11.1"
jest: "npm:^29.7.0"
jest-environment-jsdom: "npm:^29.7.0"
mini-css-extract-plugin: "npm:^2.9.2"
postcss: "npm:^8.4.49"
postcss-loader: "npm:^8.1.1"
prop-types: "npm:^15.8.1"
react: "npm:^18.3.1"
react-dom: "npm:^18.3.1"
remark-gfm: "npm:^4.0.0"
sass-loader: "npm:^16.0.4"
storybook: "npm:^8.4.6"
storybook-addon-accessibility-checker: "npm:^3.1.61-rc.3"
style-loader: "npm:^4.0.0"
ts-jest: "npm:^29.2.5"
typescript: "npm:^5.2.2"
typescript-config-carbon: "npm:^0.3.0"
webpack: "npm:^5.97.0"
languageName: unknown
linkType: soft

"nan@npm:^2.12.1":
version: 2.19.0
resolution: "nan@npm:2.19.0"
Expand Down

0 comments on commit 8690547

Please sign in to comment.