add visual tests for new errors, update formatting + copy of existing errors to bring into parity with new conventions

This commit is contained in:
Brian Mann
2022-02-14 18:35:43 -05:00
parent 6279a7dd10
commit 7848147f88
8 changed files with 207 additions and 17 deletions
@@ -34,11 +34,11 @@
</style>
</head>
<body><pre><span style="color:#e05561">We stopped running your tests because a plugin crashed.<span style="color:#e6e6e6">
<body><pre><span style="color:#e05561">We stopped running your tests because a plugin.<span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561">Your <span style="color:#e5e510">pluginsFile<span style="color:#e05561"> threw an error from: <span style="color:#4ec4ff">/path/to/pluginsFile<span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561">Your <span style="color:#e5e510">configFile<span style="color:#e05561"> threw an error from: <span style="color:#4ec4ff">/path/to/configFile<span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#c062de"><span style="color:#e6e6e6">
<span style="color:#c062de">Error: fail whale<span style="color:#e6e6e6">
<span style="color:#c062de"> at makeErr (cypress/packages/errors/test/unit/visualSnapshotErrors_spec.ts)<span style="color:#e6e6e6">
<span style="color:#c062de"> at PLUGINS_UNEXPECTED_ERROR (cypress/packages/errors/test/unit/visualSnapshotErrors_spec.ts)<span style="color:#e6e6e6"></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
<span style="color:#c062de"> at CHILD_PROCESS_UNEXPECTED_ERROR (cypress/packages/errors/test/unit/visualSnapshotErrors_spec.ts)<span style="color:#e6e6e6"></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
</pre></body></html>
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Courier+Prime&display=swap" rel="stylesheet">
<style>
body {
font-family: "Courier Prime", Courier, monospace;
padding: 0 1em;
line-height: 1.4;
color: #eee;
background-color: #111;
}
pre {
padding: 0 0;
margin: 0 0;
font-family: "Courier Prime", Courier, monospace;
}
body {
margin: 5px;
padding: 0;
overflow: hidden;
}
pre {
white-space: pre-wrap;
word-break: break-word;
-webkit-font-smoothing: antialiased;
}
</style>
</head>
<body><pre><span style="color:#e05561">There is a <span style="color:#e5e510">cypress.json<span style="color:#e05561"> file at the path: <span style="color:#4ec4ff">/path/to/projectRoot<span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561">Cypress version 10.0.0 no longer supports cypress.json.<span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561">Please run <span style="color:#4ec4ff">cypress open<span style="color:#e05561"> to launch the migration tool to migrate to <span style="color:#de73ff">cypress.config.{ts|js}<span style="color:#e05561">.<span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#e6e6e6"></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
</pre></body></html>
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Courier+Prime&display=swap" rel="stylesheet">
<style>
body {
font-family: "Courier Prime", Courier, monospace;
padding: 0 1em;
line-height: 1.4;
color: #eee;
background-color: #111;
}
pre {
padding: 0 0;
margin: 0 0;
font-family: "Courier Prime", Courier, monospace;
}
body {
margin: 5px;
padding: 0;
overflow: hidden;
}
pre {
white-space: pre-wrap;
word-break: break-word;
-webkit-font-smoothing: antialiased;
}
</style>
</head>
<body><pre><span style="color:#e05561">There is both a <span style="color:#e5e510">cypress.json<span style="color:#e05561"> and a <span style="color:#e5e510">cypress.json<span style="color:#e05561"> file at the location below:<span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#4ec4ff">/path/to/projectRoot<span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561">Cypress no longer supports cypress.json, please remove it from your project.<span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#e6e6e6"></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
</pre></body></html>
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Courier+Prime&display=swap" rel="stylesheet">
<style>
body {
font-family: "Courier Prime", Courier, monospace;
padding: 0 1em;
line-height: 1.4;
color: #eee;
background-color: #111;
}
pre {
padding: 0 0;
margin: 0 0;
font-family: "Courier Prime", Courier, monospace;
}
body {
margin: 5px;
padding: 0;
overflow: hidden;
}
pre {
white-space: pre-wrap;
word-break: break-word;
-webkit-font-smoothing: antialiased;
}
</style>
</head>
<body><pre><span style="color:#e05561">There are multiple support files.<span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561">Your supportFile is set to <span style="color:#e5e510">spec.{ts,js}<span style="color:#e05561">, and we found <span style="color:#de73ff">spec.ts,spec.js<span style="color:#e05561">.<span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561">Correct your supportFile config or merge the files into one.<span style="color:#e6e6e6"></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
</pre></body></html>
@@ -34,7 +34,7 @@
</style>
</head>
<body><pre><span style="color:#e05561">Your <span style="color:#de73ff">pluginsFile<span style="color:#e05561"> threw a validation error: <span style="color:#4ec4ff">/path/to/pluginsFile<span style="color:#e05561"><span style="color:#e6e6e6">
<body><pre><span style="color:#e05561">Your <span style="color:#de73ff">configFile<span style="color:#e05561"> threw a validation error: <span style="color:#4ec4ff">/path/to/configFile<span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561">You must pass a valid event name when registering a plugin.<span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#e6e6e6">
@@ -0,0 +1,49 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Courier+Prime&display=swap" rel="stylesheet">
<style>
body {
font-family: "Courier Prime", Courier, monospace;
padding: 0 1em;
line-height: 1.4;
color: #eee;
background-color: #111;
}
pre {
padding: 0 0;
margin: 0 0;
font-family: "Courier Prime", Courier, monospace;
}
body {
margin: 5px;
padding: 0;
overflow: hidden;
}
pre {
white-space: pre-wrap;
word-break: break-word;
-webkit-font-smoothing: antialiased;
}
</style>
</head>
<body><pre><span style="color:#e05561">The <span style="color:#e5e510">setupNodeEvents<span style="color:#e05561"> method does not support <span style="color:#de73ff">dev-server:start<span style="color:#e05561">, use <span style="color:#e5e510">devServer<span style="color:#e05561"> instead:<span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561">Please update this file: <span style="color:#4ec4ff">/path/to/project/cypress.config.js<span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#4ec4ff"><span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#4ec4ff"> devServer (cypressDevServerConfig, devServerConfig) {<span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#4ec4ff"> // start dev server here<span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#4ec4ff"> }<span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#4ec4ff"> <span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#e6e6e6">
<span style="color:#e05561">Learn more: https://on.cypress.io/dev-server<span style="color:#e6e6e6">
<span style="color:#e05561"><span style="color:#e6e6e6"></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
</pre></body></html>
+8 -10
View File
@@ -638,7 +638,7 @@ export const AllCypressErrors = {
CHILD_PROCESS_UNEXPECTED_ERROR: (configFilePath: string, err: Error) => {
return errTemplate`
We stopped running your tests because the config child process crashed.
We stopped running your tests because a plugin.
Your ${fmt.highlight(`configFile`)} threw an error from: ${fmt.path(configFilePath)}
@@ -1164,23 +1164,21 @@ export const AllCypressErrors = {
CONFIG_FILE_MIGRATION_NEEDED: (projectRoot: string) => {
return errTemplate`
There is a cypress.json file at the location below:
There is a ${fmt.highlight(`cypress.json`)} file at the path: ${fmt.path(projectRoot)}
${fmt.path(projectRoot)}
${fmt.cypressVersion('10.0.0')} no longer supports cypress.json.
Cypress 10 no longer supports 'cypress.json'.
Please run ${fmt.highlightTertiary('cypress open')} to launch the migration tool to migrate to ${fmt.highlightSecondary('cypress.config.{ts|js}')}.
`
},
LEGACY_CONFIG_FILE: (fileName: string, projectRoot: string) => {
LEGACY_CONFIG_FILE: (baseFileName: string, projectRoot: string) => {
return errTemplate`
There is both a ${fmt.highlight(fileName)} and a cypress.json file at the location below:
There is both a ${fmt.highlight(baseFileName)} and a ${fmt.highlight(`cypress.json`)} file at the location below:
${fmt.path(projectRoot)}
Cypress no longer supports ${fmt.highlightSecondary('cypress.json')} config, please remove it from your project.
Cypress no longer supports cypress.json, please remove it from your project.
`
},
@@ -1188,7 +1186,7 @@ export const AllCypressErrors = {
return errTemplate`\
The ${fmt.highlight('setupNodeEvents')} method does not support ${fmt.highlightSecondary('dev-server:start')}, use ${fmt.highlight('devServer')} instead:
${fmt.path(configPath)}
Please update this file: ${fmt.path(configPath)}
${fmt.code(`
devServer (cypressDevServerConfig, devServerConfig) {
@@ -675,11 +675,11 @@ describe('visual error templates', () => {
default: ['/path/to/pluginsFile', err],
}
},
PLUGINS_UNEXPECTED_ERROR: () => {
CHILD_PROCESS_UNEXPECTED_ERROR: () => {
const err = makeErr()
return {
default: ['/path/to/pluginsFile', err],
default: ['/path/to/configFile', err],
}
},
PLUGINS_INVALID_EVENT_NAME_ERROR: () => {
@@ -687,7 +687,7 @@ describe('visual error templates', () => {
return {
default: [
'/path/to/pluginsFile',
'/path/to/configFile',
'invalid:event',
['foo', 'bar', 'baz'],
err,
@@ -1036,6 +1036,21 @@ describe('visual error templates', () => {
default: [{ name: 'nodeVersion', value: 'system', 'configFile': 'cypress.json' }],
}
},
CONFIG_FILE_MIGRATION_NEEDED: () => {
return {
default: ['/path/to/projectRoot'],
}
},
LEGACY_CONFIG_FILE: () => {
return {
default: ['cypress.json', '/path/to/projectRoot'],
}
},
SETUP_NODE_EVENTS_DO_NOT_SUPPORT_DEV_SERVER: () => {
return {
default: ['/path/to/project/cypress.config.js'],
}
},
CT_NO_DEV_START_EVENT: () => {
return {
default: ['/path/to/plugins/file.js'],