chore: add codecov coverage reports

This commit is contained in:
Sam Tolmay 2020-10-14 15:59:12 +02:00
parent ec9bd03662
commit cbcc2e49e2
24 changed files with 98 additions and 200 deletions

View File

@ -23,3 +23,5 @@ jobs:
# format tests don't pass on node 12 since icu is missing and tests don't work with locals
- name: Test packages
run: yarn test --ignore='@lowdefy/format'
- name: Upload coverage to codecov
run: bash <(curl -s https://codecov.io/bash)

View File

@ -0,0 +1,18 @@
module.exports = {
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ['src/**/*.{js,jsx}', '!demo/*'],
coverageDirectory: 'coverage',
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/tests/'],
coverageReporters: ['lcov', 'text', 'clover'],
errorOnDeprecated: true,
testPathIgnorePatterns: ['<rootDir>/dist/'],
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node', 'yaml', 'css'],
moduleNameMapper: {
'\\.(css|less)$': '<rootDir>/tests/__mocks__/styleMock.js',
},
transform: {
'\\.yaml$': 'yaml-jest',
'\\.js?$': 'babel-jest',
},
};

View File

@ -1,11 +0,0 @@
{
"moduleFileExtensions": ["js", "json", "jsx", "ts", "tsx", "node", "yaml", "css"],
"transform": {
"\\.yaml$": "yaml-jest",
"\\.js?$": "babel-jest"
},
"moduleNameMapper": {
"\\.(css|less)$": "<rootDir>/tests/__mocks__/styleMock.js"
},
"collectCoverageFrom": ["src/**/*.{js,jsx}", "!demo/*"]
}

View File

@ -28,7 +28,7 @@
"scripts": {
"start": "webpack serve",
"build": "babel src --out-dir dist",
"test": "jest --coverage --config jest.config.json --no-cache",
"test": "jest --coverage",
"prepare": "yarn build",
"prepublishOnly": "yarn build",
"npm-publish": "npm publish --access public"
@ -69,4 +69,4 @@
"yaml-jest": "1.0.5",
"yaml-loader": "0.6.0"
}
}
}

View File

@ -1,20 +1,11 @@
module.exports = {
// Automatically clear mock calls and instances between every test
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ['src/**/*.js'],
// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: ['/dist/'],
// A list of reporter names that Jest uses when writing coverage reports
coverageReporters: ['text'],
// The test environment that will be used for testing
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/test/'],
coverageReporters: ['lcov', 'text', 'clover'],
errorOnDeprecated: true,
testEnvironment: 'node',
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: ['/dist/'],
testPathIgnorePatterns: ['<rootDir>/dist/'],
};

View File

@ -1,20 +1,11 @@
module.exports = {
// Automatically clear mock calls and instances between every test
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ['src/**/*.js'],
// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: ['/dist/'],
// A list of reporter names that Jest uses when writing coverage reports
coverageReporters: ['text'],
// The test environment that will be used for testing
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/test/'],
coverageReporters: ['lcov', 'text', 'clover'],
errorOnDeprecated: true,
testEnvironment: 'node',
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: ['/dist/'],
testPathIgnorePatterns: ['<rootDir>/dist/'],
};

View File

@ -1,20 +1,12 @@
module.exports = {
// Automatically clear mock calls and instances between every test
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ['src/**/*.js'],
// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/test/'],
coverageReporters: ['lcov', 'text', 'clover'],
errorOnDeprecated: true,
// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: ['/node_modules/', '/dist/'],
// A list of reporter names that Jest uses when writing coverage reports
coverageReporters: ['text', 'lcov'],
// The test environment that will be used for testing
testEnvironment: 'jsdom',
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
testPathIgnorePatterns: ['<rootDir>/dist/'],
};

View File

@ -19,7 +19,6 @@ const rootContext = {
client,
// appGraphql,
message,
document,
openidLogoutUrl,
user,
};

View File

@ -56,7 +56,6 @@ const rootContext = {
document,
openidLogoutUrl,
user,
window,
};
beforeEach(() => {

View File

@ -9,19 +9,13 @@ const mockMessageSuccess = jest.fn();
const mockMessageError = jest.fn();
const message = { loading: () => jest.fn(), error: mockMessageError, success: mockMessageSuccess };
const branch = 'master';
const openidLogoutUrl = 'logout';
const pageId = 'one';
const user = { firstName: 'ABC' };
const rootContext = {
branch,
client,
message,
document,
openidLogoutUrl,
user,
window,
};
test('SetGlobal data to global', async () => {

View File

@ -19,7 +19,6 @@ const rootContext = {
client,
// appGraphql,
message,
document,
openidLogoutUrl,
user,
};

View File

@ -9,7 +9,6 @@ const client = { writeFragment: jest.fn() };
const rootContext = {
branch,
client,
window,
};
// eslint-disable-next-line consistent-return

View File

@ -1,20 +1,11 @@
module.exports = {
// Automatically clear mock calls and instances between every test
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ['src/**/*.js'],
// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: ['/node_modules/', '/dist/'],
// A list of reporter names that Jest uses when writing coverage reports
coverageReporters: ['text'],
// The test environment that will be used for testing
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/test/'],
coverageReporters: ['lcov', 'text', 'clover'],
errorOnDeprecated: true,
testEnvironment: 'node',
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
testPathIgnorePatterns: ['<rootDir>/dist/'],
};

View File

@ -1,20 +1,11 @@
module.exports = {
// Automatically clear mock calls and instances between every test
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ['src/**/*.js'],
// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: ['/dist/'],
// A list of reporter names that Jest uses when writing coverage reports
coverageReporters: ['text'],
// The test environment that will be used for testing
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/test/'],
coverageReporters: ['lcov', 'text', 'clover'],
errorOnDeprecated: true,
testEnvironment: 'node',
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: ['/dist/'],
testPathIgnorePatterns: ['<rootDir>/dist/'],
};

View File

@ -1,21 +1,11 @@
module.exports = {
// Automatically clear mock calls and instances between every test
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ['src/**/*.js'],
// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test'],
// A list of reporter names that Jest uses when writing coverage reports
coverageReporters: ['lcov', 'text'],
coverageReporters: ['lcov', 'text', 'clover'],
errorOnDeprecated: true,
// The test environment that will be used for testing
testEnvironment: 'node',
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test'],
};

View File

@ -1,20 +1,11 @@
module.exports = {
// Automatically clear mock calls and instances between every test
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ['src/**/*.js'],
// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: ['/dist/'],
// A list of reporter names that Jest uses when writing coverage reports
coverageReporters: ['text'],
// The test environment that will be used for testing
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/test/'],
coverageReporters: ['lcov', 'text', 'clover'],
errorOnDeprecated: true,
testEnvironment: 'node',
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: ['/dist/'],
testPathIgnorePatterns: ['<rootDir>/dist/'],
};

View File

@ -0,0 +1,18 @@
module.exports = {
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ['src/**/*.{js,jsx}', '!demo/*'],
coverageDirectory: 'coverage',
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/tests/'],
coverageReporters: ['lcov', 'text', 'clover'],
errorOnDeprecated: true,
testPathIgnorePatterns: ['<rootDir>/dist/'],
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node', 'yaml', 'css'],
moduleNameMapper: {
'\\.(css|less)$': '<rootDir>/tests/__mocks__/styleMock.js',
},
transform: {
'\\.yaml$': 'yaml-jest',
'\\.js?$': 'babel-jest',
},
};

View File

@ -1,11 +0,0 @@
{
"moduleFileExtensions": ["js", "json", "jsx", "ts", "tsx", "node", "yaml", "css"],
"transform": {
"\\.yaml$": "yaml-jest",
"\\.js?$": "babel-jest"
},
"moduleNameMapper": {
"\\.(css|less)$": "<rootDir>/tests/__mocks__/styleMock.js"
},
"collectCoverageFrom": ["src/**/*.{js,jsx}", "!demo/*"]
}

View File

@ -28,7 +28,7 @@
"scripts": {
"start": "webpack serve",
"build": "babel src --out-dir dist",
"test": "jest --coverage --config jest.config.json --no-cache",
"test": "jest --coverage",
"prepare": "yarn build",
"prepublishOnly": "yarn build",
"npm-publish": "npm publish --access public"
@ -68,4 +68,4 @@
"yaml-jest": "1.0.5",
"yaml-loader": "0.6.0"
}
}
}

View File

@ -1,20 +1,11 @@
module.exports = {
// Automatically clear mock calls and instances between every test
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ['src/**/*.js'],
// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: ['/node_modules/', '/dist/'],
// A list of reporter names that Jest uses when writing coverage reports
coverageReporters: ['text'],
// The test environment that will be used for testing
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/test/'],
coverageReporters: ['lcov', 'text', 'clover'],
errorOnDeprecated: true,
testEnvironment: 'node',
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
testPathIgnorePatterns: ['<rootDir>/dist/'],
};

View File

@ -1,20 +1,11 @@
module.exports = {
// Automatically clear mock calls and instances between every test
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ['src/**/*.js'],
// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: ['/node_modules/', '/dist/'],
// A list of reporter names that Jest uses when writing coverage reports
coverageReporters: ['text'],
// The test environment that will be used for testing
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/test/'],
coverageReporters: ['lcov', 'text', 'clover'],
errorOnDeprecated: true,
testEnvironment: 'node',
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
testPathIgnorePatterns: ['<rootDir>/dist/'],
};

View File

@ -1,20 +1,11 @@
module.exports = {
// Automatically clear mock calls and instances between every test
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ['src/**/*.js'],
// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: ['/dist/'],
// A list of reporter names that Jest uses when writing coverage reports
coverageReporters: ['text'],
// The test environment that will be used for testing
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/test/'],
coverageReporters: ['lcov', 'text', 'clover'],
errorOnDeprecated: true,
testEnvironment: 'node',
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: ['/dist/'],
testPathIgnorePatterns: ['<rootDir>/dist/'],
};

View File

@ -1,20 +1,11 @@
module.exports = {
// Automatically clear mock calls and instances between every test
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ['src/**/*.js'],
// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: ['/dist/'],
// A list of reporter names that Jest uses when writing coverage reports
coverageReporters: ['text'],
// The test environment that will be used for testing
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/test/'],
coverageReporters: ['lcov', 'text', 'clover'],
errorOnDeprecated: true,
testEnvironment: 'node',
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: ['/dist/'],
testPathIgnorePatterns: ['<rootDir>/dist/'],
};

View File

@ -1,20 +1,11 @@
module.exports = {
// Automatically clear mock calls and instances between every test
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ['src/**/*.js'],
// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: ['/dist/'],
// A list of reporter names that Jest uses when writing coverage reports
coverageReporters: ['text'],
// The test environment that will be used for testing
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/test/'],
coverageReporters: ['lcov', 'text', 'clover'],
errorOnDeprecated: true,
testEnvironment: 'node',
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: ['/dist/'],
testPathIgnorePatterns: ['<rootDir>/dist/'],
};