Skip to content
This repository has been archived by the owner on Jan 1, 2022. It is now read-only.

Commit

Permalink
add code coverage but it doesn't work all the way yet
Browse files Browse the repository at this point in the history
getting this error when trying to view the html report for some files: istanbuljs/istanbuljs#322
  • Loading branch information
itsMapleLeaf committed Sep 29, 2021
1 parent d4f56f9 commit d3953ed
Show file tree
Hide file tree
Showing 9 changed files with 1,992 additions and 91 deletions.
4 changes: 4 additions & 0 deletions .babelrc
@@ -0,0 +1,4 @@
{
"presets": ["next/babel"],
"plugins": ["istanbul"]
}
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -14,3 +14,6 @@ cypress/videos
cypress/screenshots

*.tsbuildinfo

coverage
.nyc_output
7 changes: 6 additions & 1 deletion cypress.json
@@ -1,4 +1,9 @@
{
"nodeVersion": "system",
"baseUrl": "http://localhost:4000/"
"baseUrl": "http://localhost:4000/",
"env": {
"codeCoverage": {
"url": "/api/__coverage__"
}
}
}
4 changes: 4 additions & 0 deletions cypress/plugins/index.ts
Expand Up @@ -11,6 +11,10 @@ const pluginConfig: Cypress.PluginConfig = (on, config) => {
},
}),
)

require("@cypress/code-coverage/task")(on, config)

return config
}

export = pluginConfig
1 change: 1 addition & 0 deletions cypress/support/index.ts
@@ -1,3 +1,4 @@
import "@cypress/code-coverage/support"
import "@testing-library/cypress/add-commands"

before(() => {
Expand Down
28 changes: 26 additions & 2 deletions package.json
Expand Up @@ -2,12 +2,13 @@
"name": "thoughtbucket",
"private": true,
"scripts": {
"clean": "trash .next coverage .nyc_output",
"dev": "next dev",
"dev-test": "trash .next && dotenv -e .env.test -- concurrently --kill-others npm:dev npm:cypress-open",
"dev-test": "npm run clean && dotenv -e .env.test -- concurrently --kill-others npm:dev npm:cypress-open",
"test-dev": "npm run dev-test",
"build": "next build",
"start": "next start",
"test": "dotenv -e .env.test -- ts-node --transpile-only ./scripts/test.ts",
"test": "npm run clean && dotenv -e .env.test -- ts-node --transpile-only ./scripts/test.ts",
"typecheck": "tsc --noEmit",
"lint": "eslint --ext js,ts,tsx .",
"format": "prettier --write .",
Expand Down Expand Up @@ -40,6 +41,8 @@
"zod": "3.9.1"
},
"devDependencies": {
"@cypress/code-coverage": "3.9.11",
"@istanbuljs/nyc-config-typescript": "1.0.1",
"@itsmapleleaf/configs": "1.0.0",
"@next/eslint-plugin-next": "11.1.2",
"@tailwindcss/line-clamp": "0.2.1",
Expand All @@ -53,6 +56,7 @@
"@typescript-eslint/eslint-plugin": "4.31.2",
"@typescript-eslint/parser": "4.31.2",
"autoprefixer": "10.3.6",
"babel-plugin-istanbul": "6.0.0",
"concurrently": "6.2.1",
"cypress": "8.4.1",
"cypress-esbuild-preprocessor": "1.0.2",
Expand Down Expand Up @@ -99,5 +103,25 @@
}
}
]
},
"nyc": {
"extension": [
".js",
".jsx",
".ts",
".tsx"
],
"extends": "@istanbuljs/nyc-config-typescript",
"include": [
"src/**/*"
],
"exclude": [
"src/pages/api/__coverage__.js"
],
"sourceMap": true,
"instrument": true,
"reporter": [
"html"
]
}
}

0 comments on commit d3953ed

Please sign in to comment.