在预提交时使用--findRelatedTests选项运行Storyshots测试

时间:2019-07-29 06:50:57

标签: jest storybook storyshots

我正在尝试使用笑话选项--findRelatedTests运行Storyshots。这只会运行与更改相关但与故事相关的每个测试。有没有一种方法可以将故事快照添加为每个故事和/或组件的依存关系?

package.json如下:

  "scripts": {
    "// test": "",
    "test": "jest -c jest.config.js",
  },
  "husky": {
    "hooks": {
      "pre-commit": "node ./scripts/file-not-exists snapshots || lint-staged"
  },
  "lint-staged": {
    "*.{js,jsx,vue}": [
      "prettier --write",
      "eslint --fix",
      "yarn run test --findRelatedTests",
      "git add"
    ]
  }

我使用的相关软件包:

    "lint-staged": ">=8",
    "jest": "^24.7.1",
    "@storybook/addon-actions": "^5.1.9",
    "@storybook/addon-links": "^5.1.9",
    "@storybook/addon-storyshots": "^5.1.9",
    "@storybook/addon-storyshots-puppeteer": "^5.1.9",
    "@storybook/addons": "^5.1.9",
    "@storybook/vue": "^5.1.9",

0 个答案:

没有答案