-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code coverage for cypress testing #2031
base: main
Are you sure you want to change the base?
Changes from all commits
bd1287d
ccaa79b
7488842
5d864c3
cbd1181
c3dd4c8
888746b
627c528
cdf0ca7
ebd8a90
41b803c
9332db0
66b72de
0ca3cb8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,3 +54,6 @@ fingerprints.json | |
# Pen test related | ||
pen-test/temp.json | ||
pen-test/cookies | ||
|
||
.nyc_output | ||
instrumented |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"extends": "@istanbuljs/nyc-config-babel", | ||
"all": true, | ||
"reporter": [ | ||
"html", | ||
"text-summary", | ||
"l-cov" | ||
], | ||
"include": [ | ||
"src/**/*.js", | ||
"../common-canvas/src" | ||
], | ||
"instrument": true, | ||
"sourceMap": true, | ||
"require": [ | ||
"./scripts/babel/babelOptions.js" | ||
], | ||
"webpack": { | ||
"config": [ | ||
"./webpack.config.dev.js", | ||
"./webpack.config.prod.js" | ||
] | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,13 +12,17 @@ module.exports = defineConfig({ | |
e2e: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add this file to be checked in linting. It should have flagged the new code since we don't use single quotes. |
||
setupNodeEvents(on, config) { | ||
// `cy.log()` command's output can be seen on the screen along with test steps | ||
require("@cypress/code-coverage/task")(on, config) | ||
on("task", { | ||
log(message) { | ||
console.log(message); /* eslint no-console: "off" */ | ||
return null; | ||
} | ||
}); | ||
return config; | ||
}, | ||
baseUrl: "http://localhost:3001", | ||
specPattern: "cypress/e2e/**/*.cy.{js,jsx,ts,tsx}", | ||
supportFile: "cypress/support/e2e.js", | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ import "./canvas/utils-cmds"; | |
import "./canvas/verification-cmds"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also add the entire cypress directory. It should have flagged this well in the build. |
||
import "./canvas/operation-cmds"; | ||
import "./canvas/palette-cmds"; | ||
import "@cypress/code-coverage/support"; | ||
|
||
// turn off screenshots when running in headless mode. | ||
Cypress.Screenshot.defaults({ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,4 +141,4 @@ module.exports = { | |
rules: rules | ||
}, | ||
plugins: plugins | ||
}; | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are these files changed? Looks like an addition line? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the webpack.config.dev.js and webpack.config.prod.js, I reverted them to their original state because I believe I added a comma in the previous commit last Thursday. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are still showing up as changed though. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,4 +131,4 @@ module.exports = { | |
rules: rules | ||
}, | ||
plugins: plugins | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why this is needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.nycrc file is needed to configure NYC which generates code coverage reports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give more details on this? For example how does webpack get used and is there any documentation on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this file and it doesn't seem to make a different in the result.