Added required code coverage for jest

This commit is contained in:
Alejandro Celaya 2021-09-19 10:31:53 +02:00
parent 7fb0658349
commit 3a8c7a7bf4
6 changed files with 22 additions and 13 deletions

View file

@ -8,6 +8,14 @@ module.exports = {
'!src/**/provideServices.ts', '!src/**/provideServices.ts',
'!src/container/*.ts', '!src/container/*.ts',
], ],
coverageThreshold: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: 80,
},
},
resolver: 'jest-pnp-resolver', resolver: 'jest-pnp-resolver',
setupFiles: [ setupFiles: [
'react-app-polyfill/jsdom', 'react-app-polyfill/jsdom',

View file

@ -16,8 +16,9 @@
"serve:build": "serve ./build", "serve:build": "serve ./build",
"build": "node scripts/build.js", "build": "node scripts/build.js",
"test": "node scripts/test.js --env=jsdom --colors --verbose", "test": "node scripts/test.js --env=jsdom --colors --verbose",
"test:ci": "npm run test -- --coverage --coverageReporters=text --coverageReporters=text-summary --coverageReporters=clover", "test:coverage": "npm run test -- --coverage --coverageReporters=text --coverageReporters=text-summary",
"test:pretty": "npm run test -- --coverage --coverageReporters=text --coverageReporters=text-summary --coverageReporters=html", "test:ci": "npm run test:coverage -- --coverageReporters=clover",
"test:pretty": "npm run test:coverage -- --coverageReporters=html",
"mutate": "./node_modules/.bin/stryker run --concurrency 4" "mutate": "./node_modules/.bin/stryker run --concurrency 4"
}, },
"dependencies": { "dependencies": {

View file

@ -1,4 +1,4 @@
@import './utils/base'; @import '../utils/base';
.app-container { .app-container {
height: 100%; height: 100%;

View file

@ -1,11 +1,11 @@
import { useEffect, FC } from 'react'; import { useEffect, FC } from 'react';
import { Route, Switch } from 'react-router-dom'; import { Route, Switch } from 'react-router-dom';
import NotFound from './common/NotFound'; import NotFound from '../common/NotFound';
import { ServersMap } from './servers/data'; import { ServersMap } from '../servers/data';
import { Settings } from './settings/reducers/settings'; import { Settings } from '../settings/reducers/settings';
import { changeThemeInMarkup } from './utils/theme'; import { changeThemeInMarkup } from '../utils/theme';
import { AppUpdateBanner } from './common/AppUpdateBanner'; import { AppUpdateBanner } from '../common/AppUpdateBanner';
import { forceUpdate } from './utils/helpers/sw'; import { forceUpdate } from '../utils/helpers/sw';
import './App.scss'; import './App.scss';
interface AppProps { interface AppProps {

View file

@ -1,6 +1,6 @@
import Bottle from 'bottlejs'; import Bottle from 'bottlejs';
import { appUpdateAvailable, resetAppUpdate } from '../reducers/appUpdates'; import { appUpdateAvailable, resetAppUpdate } from '../reducers/appUpdates';
import App from '../../App'; import App from '../App';
import { ConnectDecorator } from '../../container/types'; import { ConnectDecorator } from '../../container/types';
const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {

View file

@ -1,9 +1,9 @@
import { shallow, ShallowWrapper } from 'enzyme'; import { shallow, ShallowWrapper } from 'enzyme';
import { Route } from 'react-router-dom'; import { Route } from 'react-router-dom';
import { Mock } from 'ts-mockery'; import { Mock } from 'ts-mockery';
import { Settings } from '../src/settings/reducers/settings'; import { Settings } from '../../src/settings/reducers/settings';
import appFactory from '../src/App'; import appFactory from '../../src/app/App';
import { AppUpdateBanner } from '../src/common/AppUpdateBanner'; import { AppUpdateBanner } from '../../src/common/AppUpdateBanner';
describe('<App />', () => { describe('<App />', () => {
let wrapper: ShallowWrapper; let wrapper: ShallowWrapper;