mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-11 11:29:42 +02:00
Merge pull request #4500 from mermaid-js/sidv/mergeCoverage
Merge coverage
This commit is contained in:
@@ -124,7 +124,7 @@ export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions)
|
|||||||
// @ts-expect-error According to the type definitions, rollup plugins are incompatible with vite
|
// @ts-expect-error According to the type definitions, rollup plugins are incompatible with vite
|
||||||
typescript({ compilerOptions: { declaration: false } }),
|
typescript({ compilerOptions: { declaration: false } }),
|
||||||
istanbul({
|
istanbul({
|
||||||
exclude: ['node_modules', 'test/'],
|
exclude: ['node_modules', 'test/', '__mocks__'],
|
||||||
extension: ['.js', '.ts'],
|
extension: ['.js', '.ts'],
|
||||||
requireEnv: true,
|
requireEnv: true,
|
||||||
forceBuildInstrument: coverage,
|
forceBuildInstrument: coverage,
|
||||||
|
14
package.json
14
package.json
@@ -22,7 +22,6 @@
|
|||||||
"build:watch": "pnpm build:vite --watch",
|
"build:watch": "pnpm build:vite --watch",
|
||||||
"build": "pnpm run -r clean && pnpm build:types && pnpm build:vite",
|
"build": "pnpm run -r clean && pnpm build:types && pnpm build:vite",
|
||||||
"dev": "concurrently \"pnpm build:vite --watch\" \"ts-node-esm .vite/server.ts\"",
|
"dev": "concurrently \"pnpm build:vite --watch\" \"ts-node-esm .vite/server.ts\"",
|
||||||
"dev:coverage": "VITE_COVERAGE=true pnpm dev",
|
|
||||||
"release": "pnpm build",
|
"release": "pnpm build",
|
||||||
"lint": "eslint --cache --cache-strategy content --ignore-path .gitignore . && pnpm lint:jison && prettier --cache --check .",
|
"lint": "eslint --cache --cache-strategy content --ignore-path .gitignore . && pnpm lint:jison && prettier --cache --check .",
|
||||||
"lint:fix": "eslint --cache --cache-strategy content --fix --ignore-path .gitignore . && prettier --write . && ts-node-esm scripts/fixCSpell.ts",
|
"lint:fix": "eslint --cache --cache-strategy content --fix --ignore-path .gitignore . && prettier --write . && ts-node-esm scripts/fixCSpell.ts",
|
||||||
@@ -32,6 +31,8 @@
|
|||||||
"cypress:open": "cypress open",
|
"cypress:open": "cypress open",
|
||||||
"e2e": "start-server-and-test dev http://localhost:9000/ cypress",
|
"e2e": "start-server-and-test dev http://localhost:9000/ cypress",
|
||||||
"e2e:coverage": "VITE_COVERAGE=true pnpm e2e",
|
"e2e:coverage": "VITE_COVERAGE=true pnpm e2e",
|
||||||
|
"coverage:merge": "ts-node-esm scripts/coverage.ts",
|
||||||
|
"coverage": "pnpm test:coverage && pnpm e2e:coverage && pnpm coverage:merge",
|
||||||
"ci": "vitest run",
|
"ci": "vitest run",
|
||||||
"test": "pnpm lint && vitest run",
|
"test": "pnpm lint && vitest run",
|
||||||
"test:watch": "vitest --watch",
|
"test:watch": "vitest --watch",
|
||||||
@@ -57,7 +58,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@applitools/eyes-cypress": "^3.32.0",
|
"@applitools/eyes-cypress": "^3.33.1",
|
||||||
"@commitlint/cli": "^17.6.1",
|
"@commitlint/cli": "^17.6.1",
|
||||||
"@commitlint/config-conventional": "^17.6.1",
|
"@commitlint/config-conventional": "^17.6.1",
|
||||||
"@cspell/eslint-plugin": "^6.31.1",
|
"@cspell/eslint-plugin": "^6.31.1",
|
||||||
@@ -75,9 +76,9 @@
|
|||||||
"@types/rollup-plugin-visualizer": "^4.2.1",
|
"@types/rollup-plugin-visualizer": "^4.2.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.59.0",
|
"@typescript-eslint/eslint-plugin": "^5.59.0",
|
||||||
"@typescript-eslint/parser": "^5.59.0",
|
"@typescript-eslint/parser": "^5.59.0",
|
||||||
"@vitest/coverage-c8": "^0.32.0",
|
"@vitest/coverage-istanbul": "^0.32.2",
|
||||||
"@vitest/spy": "^0.32.0",
|
"@vitest/spy": "^0.32.2",
|
||||||
"@vitest/ui": "^0.32.0",
|
"@vitest/ui": "^0.32.2",
|
||||||
"concurrently": "^8.0.1",
|
"concurrently": "^8.0.1",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"coveralls": "^3.1.1",
|
"coveralls": "^3.1.1",
|
||||||
@@ -104,6 +105,7 @@
|
|||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"jsdom": "^21.1.1",
|
"jsdom": "^21.1.1",
|
||||||
"lint-staged": "^13.2.1",
|
"lint-staged": "^13.2.1",
|
||||||
|
"nyc": "^15.1.0",
|
||||||
"path-browserify": "^1.0.1",
|
"path-browserify": "^1.0.1",
|
||||||
"pnpm": "^8.3.1",
|
"pnpm": "^8.3.1",
|
||||||
"prettier": "^2.8.8",
|
"prettier": "^2.8.8",
|
||||||
@@ -115,7 +117,7 @@
|
|||||||
"typescript": "^5.1.3",
|
"typescript": "^5.1.3",
|
||||||
"vite": "^4.3.9",
|
"vite": "^4.3.9",
|
||||||
"vite-plugin-istanbul": "^4.1.0",
|
"vite-plugin-istanbul": "^4.1.0",
|
||||||
"vitest": "^0.31.0"
|
"vitest": "^0.32.2"
|
||||||
},
|
},
|
||||||
"volta": {
|
"volta": {
|
||||||
"node": "18.16.0"
|
"node": "18.16.0"
|
||||||
|
886
pnpm-lock.yaml
generated
886
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
19
scripts/coverage.ts
Normal file
19
scripts/coverage.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { execSync } from 'child_process';
|
||||||
|
import { cp } from 'fs/promises';
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
const coverageDir = 'coverage';
|
||||||
|
const coverageFiles = ['vitest', 'cypress'].map(
|
||||||
|
(dir) => `${coverageDir}/${dir}/coverage-final.json`
|
||||||
|
);
|
||||||
|
|
||||||
|
//copy coverage files from vitest and cypress to coverage folder
|
||||||
|
await Promise.all(
|
||||||
|
coverageFiles.map((file) => cp(file, `${coverageDir}/combined/${file.split('/')[1]}.json`))
|
||||||
|
);
|
||||||
|
|
||||||
|
execSync('npx nyc merge coverage/combined coverage/combined-final.json');
|
||||||
|
execSync('npx nyc report -t coverage --report-dir coverage/html --reporter=html-spa');
|
||||||
|
};
|
||||||
|
|
||||||
|
void main();
|
@@ -17,8 +17,10 @@ export default defineConfig({
|
|||||||
// TODO: should we move this to a mermaid-core package?
|
// TODO: should we move this to a mermaid-core package?
|
||||||
setupFiles: ['packages/mermaid/src/tests/setup.ts'],
|
setupFiles: ['packages/mermaid/src/tests/setup.ts'],
|
||||||
coverage: {
|
coverage: {
|
||||||
|
provider: 'istanbul',
|
||||||
reporter: ['text', 'json', 'html', 'lcov'],
|
reporter: ['text', 'json', 'html', 'lcov'],
|
||||||
reportsDirectory: './coverage/vitest',
|
reportsDirectory: './coverage/vitest',
|
||||||
|
exclude: ['**/node_modules/**', '**/tests/**', '**/__mocks__/**'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
|
Reference in New Issue
Block a user