Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 6e70692

Browse files
committed
fix: fixed test coverage
1 parent 18fbf87 commit 6e70692

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+655
-433
lines changed

docusaurus.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const config = {
4141
},
4242
blog: false,
4343
theme: {
44-
customCss: [require.resolve('./src/css/custom.css'), './src/css/index.scss'],
44+
customCss: [require.resolve('./src/styles/index.scss')],
4545
},
4646
}),
4747
],

jest.config.js

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,37 @@
11
/** @type {import('ts-jest').JestConfigWithTsJest} */
22
module.exports = {
33
collectCoverage: true,
4-
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}', '!**/node_modules/**', '!src/configs/cms/**'],
5-
moduleNameMapper: {
6-
'\\.(css|scss)$': 'identity-obj-proxy',
7-
},
4+
collectCoverageFrom: [
5+
'src/**/*.{js,jsx,ts,tsx}',
6+
'!**/node_modules/**',
7+
'!src/configs/**',
8+
'!src/pages/**', // TODO: Fix the docusuarus module naming
9+
'!src/theme/**', // TODO: Fix the docusuarus module naming
10+
'!src/test-utils.tsx',
11+
],
812
coverageDirectory: './coverage/',
9-
coverageReporters: ['lcov'],
13+
// coverageReporters: ['lcov'],
1014
testEnvironment: 'jsdom',
11-
preset: 'ts-jest',
1215
transform: {
13-
'^.+\\.ts?$': ['ts-jest'],
14-
'^.+\\.tsx?$': ['ts-jest', { babelConfig: true }],
16+
'^.+\\.(j|t)sx?$': ['ts-jest', { babelConfig: true }],
17+
'^.+\\.mjs$': ['babel-jest'],
18+
},
19+
moduleNameMapper: {
20+
'\\.(css|scss)$': 'identity-obj-proxy',
21+
'@theme/(.*)': '@docusaurus/theme-classic/src/theme/$1',
22+
23+
'@docusaurus/(ErrorBoundary|BrowserOnly|ComponentCreator|constants|ExecutionEnvironment|Head|Interpolate|isInternalUrl|Link|Noop|renderRoutes|router|Translate|use.*)':
24+
'@docusaurus/core/lib/client/exports/$1',
25+
26+
'@generated/(.*)': '<rootDir>/.docusaurus/$1',
27+
28+
'@docusaurus/plugin-content-docs/client': '@docusaurus/plugin-content-docs/src/client/index.ts',
29+
'@site/(.*)': '<rootDir>/$1',
1530
},
31+
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'mjs', 'json'],
32+
rootDir: '.',
33+
roots: ['<rootDir>'],
34+
modulePaths: ['<rootDir>'],
35+
transformIgnorePatterns: ['node_modules/(?!(@docusaurus)|@theme)'],
36+
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
1637
};

jest.setup.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

jest.setup.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import '@testing-library/jest-dom';
2+
3+
// HINT: we need this mock for the tests with docusaurus components
4+
window['docusaurus'] = {
5+
prefetch: jest.fn(),
6+
preload: jest.fn(),
7+
};

package-lock.json

Lines changed: 75 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@docusaurus/preset-classic": "2.2.0",
2727
"@docusaurus/theme-live-codeblock": "^2.2.0",
2828
"@mdx-js/react": "^1.6.22",
29+
"@testing-library/react-hooks": "^8.0.1",
2930
"babel-plugin-jsx-remove-data-test-id": "^3.0.0",
3031
"clsx": "^1.2.1",
3132
"docusaurus-plugin-sass": "^0.2.2",
@@ -49,6 +50,7 @@
4950
"@testing-library/react": "^12.1.5",
5051
"@testing-library/user-event": "^14.4.3",
5152
"@tsconfig/docusaurus": "^1.0.5",
53+
"@types/jest": "^29.2.5",
5254
"@types/node-sass": "^4.11.3",
5355
"@typescript-eslint/eslint-plugin": "^5.46.1",
5456
"@typescript-eslint/parser": "^5.46.1",

src/components/ApiFeatures/ApiFeatures.module.scss

Lines changed: 0 additions & 59 deletions
This file was deleted.

src/components/ApiFeatures/__tests__/ApiFeatures.test.tsx

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)