소스 검색

feat: prepare jest coverage support

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
tags/v28.0.0beta1
John Molakvoæ 11 달 전
부모
커밋
45ecd55d89
No account linked to committer's email address
6개의 변경된 파일33개의 추가작업 그리고 23개의 파일을 삭제
  1. 9
    4
      .github/workflows/node-tests.yml
  2. 1
    0
      .gitignore
  3. 2
    2
      dist/files-main.js
  4. 1
    1
      dist/files-main.js.map
  5. 19
    16
      jest.config.ts
  6. 1
    0
      package.json

+ 9
- 4
.github/workflows/node-tests.yml 파일 보기

@@ -25,8 +25,8 @@ jobs:
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1
id: versions
with:
fallbackNode: '^12'
fallbackNpm: '^6'
fallbackNode: '^16'
fallbackNpm: '^7'

test:
runs-on: ubuntu-latest
@@ -47,8 +47,13 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Test
run: npm run test
- name: Test and process coverage
run: npm run test:coverage
- name: Collect coverage
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
files: ./coverage/lcov.info

jsunit:
runs-on: ubuntu-latest

+ 1
- 0
.gitignore 파일 보기

@@ -154,6 +154,7 @@ Vagrantfile
/config/config-autotest-backup.php
/config/autoconfig.php
clover.xml
/coverage

# Tests - dependencies
tests/acceptance/vendor/

+ 2
- 2
dist/files-main.js
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 1
- 1
dist/files-main.js.map
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 19
- 16
jest.config.ts 파일 보기

@@ -37,34 +37,37 @@ const ignorePatterns = [

const config: Config = {
testMatch: ['<rootDir>/**/*.(spec|test).(ts|js)'],
modulePathIgnorePatterns: [
'<rootDir>/apps2/',
'<rootDir>/apps-extra/',
],
transformIgnorePatterns: [
'node_modules/(?!(' + ignorePatterns.join('|') + ')/)',
],
clearMocks: true,
collectCoverageFrom: [
'<rootDir>/**/*.{js,vue}',
],

clearMocks: true,
setupFilesAfterEnv: ['<rootDir>/__tests__/jest-setup.ts'],

testEnvironment: 'jest-environment-jsdom',
preset: 'ts-jest/presets/js-with-ts',

// Allow mocking svg files
moduleDirectories: ['node_modules', '<rootDir>/'],
moduleNameMapper: {
'^.+\\.svg(\\?raw)?$': '<rootDir>/__mocks__/svg.js',
},
roots: [
'<rootDir>/__mocks__',
'<rootDir>/__tests__',
'<rootDir>/apps',
'<rootDir>/core',
],

transform: {
// process `*.js` files with `babel-jest`
'^.+\\.js$': 'babel-jest',
'^.+\\.vue$': '@vue/vue2-jest',
},
transformIgnorePatterns: [
'node_modules/(?!(' + ignorePatterns.join('|') + ')/)',
],

// Allow mocking svg files
moduleNameMapper: {
'^.+\\.svg(\\?raw)?$': '<rootDir>/__mocks__/svg.js',
},
modulePathIgnorePatterns: [
'<rootDir>/apps2/',
'<rootDir>/apps-extra/',
],
}

export default config

+ 1
- 0
package.json 파일 보기

@@ -16,6 +16,7 @@
"lint:fix": "eslint 'apps/*/src/**/*.{vue,js}' 'core/src/**/*.{vue,js}' --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"test:jsunit": "karma start tests/karma.config.js --single-run",
"sass": "sass --style compressed --load-path core/css core/css/ $(for cssdir in $(find apps -mindepth 2 -maxdepth 2 -name \"css\"); do if ! $(git check-ignore -q $cssdir); then echo -n \"$cssdir \"; fi; done)",
"sass:watch": "sass --watch --load-path core/css core/css/ $(for cssdir in $(find apps -mindepth 2 -maxdepth 2 -name \"css\"); do if ! $(git check-ignore -q $cssdir); then echo -n \"$cssdir \"; fi; done)",

Loading…
취소
저장