diff --git a/.eslintrc.json b/.eslintrc.json index 101de32ea..e539eecd9 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,18 @@ { - "root": true, - "extends": [ - "@vant/eslint-config" - ] + "extends": "vusion/all", + "env": { + "browser": true, + "node": true + }, + "rules": { + "no-alert": [0], + "function-paren-newline": [0], + "vue/html-indent": [0], + "vue/no-unused-vars": [0], + "linebreak-style": 0, + "vue/component-definition-name-casing": [2, "kebab-case"], + "vue/first-attribute-linebreak": [0], + "vue/no-mutating-props": [0], + "vue/name-property-casing": 0 + } } diff --git a/.github/workflows/jest.yml b/.github/workflows/jest.yml new file mode 100644 index 000000000..234739d59 --- /dev/null +++ b/.github/workflows/jest.yml @@ -0,0 +1,31 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Jest Test CI + +on: + push: + branches: [ "master", "release/*", "test" ] + pull_request: + branches: [ "*" ] + +jobs: + test: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [14.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + - name: Install dependencies + run: yarn install --frozen-lockfile + - run: npm test diff --git a/.gitignore b/.gitignore index 530b1a045..e54c8dd94 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ assets-package changelog.generated.md test/coverage vetur + +# 测试入口 +scripts/test/package-entry.js diff --git a/.stylelintrc.json b/.stylelintrc.json index fa198f42c..08a875208 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -1,5 +1,6 @@ { - "extends": [ - "@vant/stylelint-config" - ] + "extends": "stylelint-config-vusion", + "rules": { + "length-zero-no-unit": null + } } diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 000000000..d7badb433 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,31 @@ +process.env.TZ = 'Asia/Shanghai'; + +module.exports = { + testEnvironment: 'jsdom', + testEnvironmentOptions: { + // i-ico.vue/icon.js 要求文档必须有一个 script 标签 + html: '
' + }, + testMatch: ["