Skip to content

Commit

Permalink
Merge pull request #267 from vusion/feature/jest_snapshot
Browse files Browse the repository at this point in the history
Feature/jest snapshot
  • Loading branch information
myronliu347 authored Jan 15, 2024
2 parents b7d667b + db531af commit fc33998
Show file tree
Hide file tree
Showing 238 changed files with 3,270 additions and 53,632 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test CI

on:
push:
branches: [ "master", "release/*", "test" ]
pull_request:
branches: [ "*" ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set node
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install Yarn
run: npm install -g yarn

- name: Install Dependencies
run: yarn install

- run: npm test
35 changes: 35 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const path = require('path');
const { genPackageEntry } = require('@vant/cli/lib/compiler/gen-package-entry');

genPackageEntry({
outputPath: path.join(__dirname, './dist/package-entry.js')
});


module.exports = {
moduleNameMapper: {
'\\.(css|less|scss)$': '<rootDir>/test/config/jest.style-mock.js',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/test/config/jest.file-mock.js',

// iconv/icon.js is a mock file
'\\/icon(\\.js)?': '<rootDir>/test/config/jest.icon-mock.js',
},
setupFilesAfterEnv: ['<rootDir>/test/config/jest.setup.js'],

moduleFileExtensions: ['js', 'jsx', 'vue', 'ts', 'tsx'],

transform: {
'\\.(vue)$': 'vue-jest',
'\\.(js|jsx|ts|tsx)$': 'babel-jest',
},
transformIgnorePatterns: ['api.ts'],
snapshotSerializers: ['jest-serializer-vue'],
collectCoverage: true,
collectCoverageFrom: [
'src/**/*.{js,jsx,ts,tsx,vue}',
'!**/demo/**',
'!src/**/api.ts',
],
coverageReporters: ['html', 'lcov', 'text-summary'],
coverageDirectory: './test/coverage',
};
Loading

0 comments on commit fc33998

Please sign in to comment.