GeezerVison is showing github.com — Merge pull request #402 from alibaba/feat/render-jest-config · webstager/lowcode-engine@670eeb9
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .github/workflows/cov packages.yml +36Lines changed: 36 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 24 | 24 | with: | 25 | 25 | working-directory: packages/designer | 26 | 26 | test-script: npm test -- --jest-ci --jest-json --jest-coverage --jest-testLocationInResults --jest-outputFile=report.json | | 27 | + skip-step: install | | 28 | + cov-renderer-core: | | 29 | + runs-on: ubuntu-latest | | 30 | + steps: | | 31 | + - name: checkout | | 32 | + uses: actions/checkout@v2 | | 33 | + | | 34 | + - uses: actions/setup-node@v2 | | 35 | + with: | | 36 | + node-version: '14' | | 37 | + | | 38 | + - name: install | | 39 | + run: npm i && npm run setup:skip-build | | 40 | + | | 41 | + - uses: ArtiomTr/jest-coverage-report-action@v2 | | 42 | + with: | | 43 | + working-directory: packages/renderer-core | | 44 | + test-script: npm test -- --jest-ci --jest-json --jest-coverage --jest-testLocationInResults --jest-outputFile=report.json | | 45 | + skip-step: install | | 46 | + cov-react-simulator-renderer: | | 47 | + runs-on: ubuntu-latest | | 48 | + steps: | | 49 | + - name: checkout | | 50 | + uses: actions/checkout@v2 | | 51 | + | | 52 | + - uses: actions/setup-node@v2 | | 53 | + with: | | 54 | + node-version: '14' | | 55 | + | | 56 | + - name: install | | 57 | + run: npm i && npm run setup:skip-build | | 58 | + | | 59 | + - uses: ArtiomTr/jest-coverage-report-action@v2 | | 60 | + with: | | 61 | + working-directory: packages/react-simulator-renderer | | 62 | + test-script: npm test -- --jest-ci --jest-json --jest-coverage --jest-testLocationInResults --jest-outputFile=report.json | 27 | 63 | skip-step: install |
Collapse file Copy file name to clipboard +20-3Lines changed: 20 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -module.exports = { | | 1 | +const fs = require('fs'); | | 2 | +const { join } = require('path'); | | 3 | +const esModules = ['zen-logger'].join('|'); | | 4 | +const pkgNames = fs.readdirSync(join('..')).filter(pkgName => !pkgName.startsWith('.')); | | 5 | + | | 6 | +const jestConfig = { | 2 | 7 | // transform: { | 3 | 8 | // '^.+\\.[jt]sx?$': 'babel-jest', | 4 | 9 | // // '^.+\\.(ts|tsx)$': 'ts-jest', | 5 | 10 | // // '^.+\\.(js|jsx)$': 'babel-jest', | 6 | 11 | // }, | | 12 | + // testMatch: ['**/document/node/node.test.ts'], | | 13 | + // testMatch: ['**/designer/builtin-hotkey.test.ts'], | | 14 | + // testMatch: ['**/plugin/plugin-manager.test.ts'], | 7 | 15 | // testMatch: ['(/tests?/.*(test))\\.[jt]s$'], | | 16 | + transformIgnorePatterns: [ | | 17 | + `/node_modules/(?!${esModules})/`, | | 18 | + ], | 8 | 19 | moduleFileExtensions: ['ts', 'tsx', 'js', 'json'], | 9 | 20 | collectCoverage: true, | 10 | 21 | collectCoverageFrom: [ | 11 | | - 'src/**/*.{ts,tsx}', | | 22 | + 'src/**/*.ts', | | 23 | + '!src/**/*.d.ts', | 12 | 24 | '!**/node_modules/**', | 13 | | - '!**/vendor/**', | 14 | 25 | ], | 15 | 26 | }; | | 27 | + | | 28 | +// 只对本仓库内的 pkg 做 mapping | | 29 | +jestConfig.moduleNameMapper = {}; | | 30 | +jestConfig.moduleNameMapper[`^@alilc/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src'; | | 31 | + | | 32 | +module.exports = jestConfig; |
Collapse file Copy file name to clipboardExpand all lines: packages/react-simulator-renderer/jest.config.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -18,7 +18,7 @@ const jestConfig = { | 18 | 18 | ], | 19 | 19 | setupFiles: ['./test/utils/host.ts'], | 20 | 20 | moduleFileExtensions: ['ts', 'tsx', 'js', 'json'], | 21 | | - collectCoverage: false, | | 21 | + collectCoverage: true, | 22 | 22 | collectCoverageFrom: [ | 23 | 23 | 'src/**/*.ts', | 24 | 24 | '!src/**/*.d.ts', | |
Collapse file Copy file name to clipboardExpand all lines: packages/renderer-core/jest.config.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -16,7 +16,7 @@ const jestConfig = { | 16 | 16 | ], | 17 | 17 | setupFiles: ['./tests/fixtures/unhandled-rejection.ts'], | 18 | 18 | moduleFileExtensions: ['ts', 'tsx', 'js', 'json'], | 19 | | - collectCoverage: false, | | 19 | + collectCoverage: true, | 20 | 20 | collectCoverageFrom: [ | 21 | 21 | 'src/**/*.ts', | 22 | 22 | '!src/**/*.d.ts', | |
|