-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(test): add jest config file (#8)
* feat(test): add jest config file * feat(test): add jest config file * improvement(workflow): update workflow * improvement(yarn lock): update yarn lock * improvement: update workflow * improvement(mock): add mock file * improvement(workflow): update yarn action * improvement: update workflow * improvement: update workflow * improvement: update workflow
- Loading branch information
Showing
3 changed files
with
41 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,20 +4,24 @@ on: [push] | |
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [12.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Run ESLint | ||
uses: stefanoeb/[email protected] | ||
env: | ||
CI: true | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Get yarn cache | ||
id: yarn-cache | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
|
||
- uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.yarn-cache.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: install | ||
run: yarn | ||
|
||
- name: lint | ||
run: yarn lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// eslint-disable-next-line import/no-commonjs | ||
module.exports = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// eslint-disable-next-line import/no-commonjs | ||
module.exports = { | ||
verbose: true, | ||
moduleFileExtensions: ['js', 'jsx', 'json'], | ||
rootDir: __dirname, | ||
testMatch: [ | ||
'<rootDir>/src/components/**/*.test.js', | ||
'<rootDir>/src/components/**/test.js', | ||
], | ||
transform: { | ||
'^.+\\.js?$': 'babel-jest', | ||
}, | ||
transformIgnorePatterns: ['<rootDir>/node_modules/'], | ||
moduleNameMapper: { | ||
react: 'nervjs', | ||
'react-addons-test-utils': 'nerv-test-utils', | ||
'react-dom': 'nervjs', | ||
weui: '<rootDir>/__mock__/styleMock.js', | ||
'\\.(css|less|sass|scss)$': '<rootDir>/__mock__/styleMock.js', | ||
}, | ||
} |