ReactLibraries / storybook-addon-module-mock

Provides module mocking functionality like jest.mock on Storybook.
MIT License
42 stars 5 forks source link

unexpected Error when add the storybook-addon-module-mock #11

Open FoushWare opened 11 months ago

FoushWare commented 11 months ago

main.ts file

import type { StorybookConfig } from "@storybook/nextjs";

const config: StorybookConfig = {
  stories: ["../stories/**/*.mdx", "../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
  addons: [
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    "@storybook/addon-interactions",
    "@storybook/addon-coverage",
    "storybook-addon-module-mock",
    "@storybook/addon-mdx-gfm",
  ],
  framework: {
    name: "@storybook/nextjs",
    options: {},
  },
  docs: {
    autodocs: "tag",
  },
  staticDirs: ["../public/"],
  features: {
    storyStoreV7: true,
  },
  typescript: {
    reactDocgen: "react-docgen",
  },
};
export default config;

package.json

  "dependencies": {

    "styled-bootstrap-grid": "^3.1.0",
    "styled-components": "^5.2.1",
    "styled-normalize": "^8.0.7",
    "stylis-rtlcss": "^2.1.1",

  },
  "devDependencies": {
    "@commitlint/cli": "^17.0.1",
    "@commitlint/lint": "^17.6.5",

    "eslint": "^8.42.0",
    "eslint-import-resolver-typescript": "^2.5.0",
    "eslint-plugin-import": "^2.25.3",
    "eslint-plugin-react": "^7.28.0",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-storybook": "^0.6.15",
    "express": "^4.17.1",
    "husky": "^5.1.1",
    "jest": "^29.5.0",
    "jest-environment-jsdom": "^29.5.0",
    "jest-styled-components": "^7.1.1",
    "lint-staged": "^10.5.4",
    "msw": "^2.0.0",
    "next-sitemap": "^4.1.3",
    "nodemon": "^2.0.7",
    "prettier": "^2.5.1",
    "react-test-renderer": "^18.2.0",
    "storybook": "^7.5.1",
    "ts-jest": "^29.1.0",
    "ts-node": "^9.1.1",
    "typescript": "^5.0.4",
    "webpack": "^5.88.1"
  },

The Error :

Cannot read properties of undefined (reading 'attrs')
TypeError: Cannot read properties of undefined (reading 'attrs')
    at ./node_modules/styled-bootstrap-grid/dist/components/Container/Container.js (http://localhost:6006/vendors-node_modules_babel_runtime_helpers_esm_asyncToGenerator_js-node_modules_babel_runtime-aff414.iframe.bundle.js:119507:46)
    at __webpack_require__ (http://localhost:6006/runtime~main.iframe.bundle.js:28:33)
    at fn (http://localhost:6006/runtime~main.iframe.bundle.js:360:21)
    at ./node_modules/styled-bootstrap-grid/dist/components/Container/index.js (http://localhost:6006/vendors-node_modules_babel_runtime_helpers_esm_asyncToGenerator_js-node_modules_babel_runtime-aff414.iframe.bundle.js:119570:41)
    at __webpack_require__ (http://localhost:6006/runtime~main.iframe.bundle.js:28:33)
    at fn (http://localhost:6006/runtime~main.iframe.bundle.js:360:21)
    at ./node_modules/styled-bootstrap-grid/dist/index.js (http://localhost:6006/vendors-node_modules_babel_runtime_helpers_esm_asyncToGenerator_js-node_modules_babel_runtime-aff414.iframe.bundle.js:120069:41)
    at __webpack_require__ (http://localhost:6006/runtime~main.iframe.bundle.js:28:33)
    at fn (http://localhost:6006/runtime~main.iframe.bundle.js:360:21)
    at ./.storybook/preview.tsx (http://localhost:6006/main.iframe.bundle.js:41:79)