From e884ffc254bc43a56692bc16da4d8a200d44c5f6 Mon Sep 17 00:00:00 2001 From: Yen Truong Date: Wed, 3 Aug 2022 14:04:00 -0400 Subject: [PATCH] bash script --- package.json | 4 ++-- tests/scripts/visual-coverage.sh | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100755 tests/scripts/visual-coverage.sh diff --git a/package.json b/package.json index 770d54190..26726d2d5 100644 --- a/package.json +++ b/package.json @@ -38,10 +38,10 @@ "generate-docs": "api-documenter markdown --input-folder temp --output-folder docs && rm -rf temp", "generate-notices": "generate-license-file --input package.json --output ./THIRD-PARTY-NOTICES --overwrite", "prepublishOnly": "npm run build", - "test": "jest --coverage", "storybook": "start-storybook -p 6006", "build-storybook": "build-storybook", - "test-storybook": "start-storybook -p 6006 --ci & sleep 10 && test-storybook --coverage" + "test:unit": "jest --coverage --coverageDirectory=coverage/unit", + "test:visual": "./tests/scripts/visual-coverage.sh" }, "devDependencies": { "@babel/core": "^7.17.5", diff --git a/tests/scripts/visual-coverage.sh b/tests/scripts/visual-coverage.sh new file mode 100755 index 000000000..3d637aec3 --- /dev/null +++ b/tests/scripts/visual-coverage.sh @@ -0,0 +1,11 @@ +#generate coverage from storybook test runner +start-storybook -p 6006 --ci & +echo $! #get the background job ID +sleep 10 +test-storybook --coverage + +#todo: kill the start-storybook command + +#generate lcov coverage +cp coverage/storybook/coverage-storybook.json coverage/coverage-storybook.json +nyc report --reporter=lcov -t coverage --report-dir coverage/visual