Skip to content

Commit

Permalink
Try coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
joshwooding committed Nov 12, 2024
1 parent dc77771 commit 532f024
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 171 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,8 @@ jobs:
with:
name: cypress-screenshots
path: cypress/screenshots
- uses: actions/upload-artifact@v4
if: success() && ${{ matrix.react == '18' }}
with:
name: coverage
path: coverage
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ storybook-static
# misc
.DS_Store
.eslintcache
.swc

npm-debug.log*
yarn-debug.log*
Expand Down
7 changes: 5 additions & 2 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import installCoverageTask from "@cypress/code-coverage/task";
// @ts-ignore
import { defineConfig } from "cypress";
import { devServer } from "cypress-rspack-dev-server";
import { merge } from "webpack-merge";
// import installCoverageTask from "@cypress/code-coverage/task";

export default defineConfig({
viewportWidth: 1280,
viewportHeight: 1024,
video: false,
component: {
setupNodeEvents(on, config) {
// installCoverageTask(on, config);
installCoverageTask(on, config);
//Setting up a log task to allow logging to the console during an axe test because console.log() does not work directly in a test
on("task", {
log(message: string) {
Expand All @@ -34,5 +34,8 @@ export default defineConfig({
});
},
specPattern: "packages/**/src/**/*.cy.{js,ts,jsx,tsx}",
env: {
coverage: Boolean(process.env.coverage),
},
},
});
18 changes: 14 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"copy:icon:css": "yarn workspace @salt-ds/icons copy:css",
"copy:countries:css": "yarn workspace @salt-ds/countries copy:css",
"test": "vitest",
"test:components": "CYPRESS_NO_COMMAND_LOG=1 cypress run --component --browser chrome",
"test:components": "cypress run --component --browser chrome",
"test:components:local": "cypress open --component --browser electron",
"prettier": "prettier --write .",
"prettier:ci": "prettier --check .",
Expand Down Expand Up @@ -81,7 +81,6 @@
"ag-grid-enterprise": "^31.3.4",
"ag-grid-react": "^31.3.4",
"axe-core": "^4.9.0",
"babel-loader": "^9.1.3",
"chromatic": "^11.10.1",
"ci-info": "^4.0.0",
"clsx": "^2.0.0",
Expand All @@ -104,9 +103,9 @@
"storybook": "^8.3.0",
"style-loader": "^4.0.0",
"stylelint": "^16.0.0",
"swc-plugin-coverage-instrument": "^0.0.25",
"typescript": "4.6.4",
"vite": "^5.0.0",
"vite-plugin-istanbul": "^6.0.0",
"vite-tsconfig-paths": "^4.2.0",
"vitest": "^2.0.0",
"yup": "^1.0.2"
Expand All @@ -117,7 +116,8 @@
"next": "^14.0.0",
"whatwg-url": "^14.0.0",
"@joshwooding/vite-plugin-react-docgen-typescript": "0.4.0",
"cookie": "^0.7.0"
"cookie": "^0.7.0",
"nyc": "^17.0.0"
},
"browserslist": {
"production": [
Expand Down Expand Up @@ -147,5 +147,15 @@
"rollup": "^4.24.2",
"rollup-plugin-esbuild": "^6.1.1",
"rollup-plugin-postcss": "^4.0.2"
},
"nyc": {
"all": false,
"include": [
"**/packages/**"
],
"exclude": [
"**/__tests_/**"
],
"excludeAfterRemap": false
}
}
13 changes: 9 additions & 4 deletions rspack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@ export default defineConfig({
test: /\.css$/,
use: ["style-loader", "css-loader", "postcss-loader"],
},
{
test: /packages\/.*\/src\/.*\.[tj]sx?$/,
use: ["babel-loader"],
},
{
test: /\.(j|t)s$/,
exclude: [/[\\/]node_modules[\\/]/],
loader: "builtin:swc-loader",
options: {
jsc: {
experimental: {
plugins: [["swc-plugin-coverage-instrument", {}]],
},
parser: {
syntax: "typescript",
},
Expand All @@ -46,6 +45,9 @@ export default defineConfig({
exclude: [/[\\/]node_modules[\\/]/],
options: {
jsc: {
experimental: {
plugins: [["swc-plugin-coverage-instrument", {}]],
},
parser: {
syntax: "typescript",
tsx: true,
Expand Down Expand Up @@ -82,4 +84,7 @@ export default defineConfig({
},
extensions: ["...", ".ts", ".tsx", ".js", ".jsx", ".css"],
},
watchOptions: {
ignored: "**/*",
},
});
Loading

0 comments on commit 532f024

Please sign in to comment.