Skip to content

Commit 480d7d9

Browse files
chore: remove dead code from errors.ts in packages/errors (#31536)
* chore: remove 'not logged in' error - which is dead code * Remove function getMsgByType which is no longer called in code * remove errors around 'private test' plans * Remove snapshots * update system test snapshot
1 parent fc5627a commit 480d7d9

12 files changed

+8
-331
lines changed

packages/errors/__snapshot-html__/NOT_LOGGED_IN.html renamed to packages/errors/__snapshot-html__/CDP_FIREFOX_DEPRECATED.html

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/errors/__snapshot-html__/FREE_PLAN_EXCEEDS_MONTHLY_PRIVATE_TESTS.html

Lines changed: 0 additions & 42 deletions
This file was deleted.

packages/errors/__snapshot-html__/FREE_PLAN_IN_GRACE_PERIOD_EXCEEDS_MONTHLY_PRIVATE_TESTS.html

Lines changed: 0 additions & 42 deletions
This file was deleted.

packages/errors/__snapshot-html__/PAID_PLAN_EXCEEDS_MONTHLY_PRIVATE_TESTS.html

Lines changed: 0 additions & 42 deletions
This file was deleted.

packages/errors/src/errors.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,6 @@ export const AllCypressErrors = {
138138
139139
${fmt.highlightSecondary(arg2)}`
140140
},
141-
NOT_LOGGED_IN: () => {
142-
return errTemplate`\
143-
You're not logged in.
144-
145-
Run ${fmt.highlight(`cypress open`)} to open Cypress and log in.`
146-
},
147141
TESTS_DID_NOT_START_RETRYING: (arg1: string) => {
148142
return errTemplate`Timed out waiting for the browser to connect. ${fmt.off(arg1)}`
149143
},
@@ -1032,30 +1026,6 @@ export const AllCypressErrors = {
10321026
10331027
https://on.cypress.io/installing-cypress`
10341028
},
1035-
FREE_PLAN_EXCEEDS_MONTHLY_PRIVATE_TESTS: (arg1: {link: string, usedTestsMessage: string, limit: number}) => {
1036-
return errTemplate`\
1037-
You've exceeded the limit of private test results under your free plan this month. ${getUsedTestsMessage(arg1.limit, arg1.usedTestsMessage)}
1038-
1039-
To continue recording tests this month you must upgrade your account. Please visit your billing to upgrade to another billing plan.
1040-
1041-
${fmt.off(arg1.link)}`
1042-
},
1043-
FREE_PLAN_IN_GRACE_PERIOD_EXCEEDS_MONTHLY_PRIVATE_TESTS: (arg1: {link: string, usedTestsMessage: string, gracePeriodMessage: string, limit: number}) => {
1044-
return errTemplate`\
1045-
You've exceeded the limit of private test results under your free plan this month. ${getUsedTestsMessage(arg1.limit, arg1.usedTestsMessage)}
1046-
1047-
Your plan is now in a grace period, which means your tests will still be recorded until ${fmt.off(arg1.gracePeriodMessage)}. Please upgrade your plan to continue recording tests on Cypress Cloud in the future.
1048-
1049-
${fmt.off(arg1.link)}`
1050-
},
1051-
PAID_PLAN_EXCEEDS_MONTHLY_PRIVATE_TESTS: (arg1: {link: string, usedTestsMessage: string, limit: number}) => {
1052-
return errTemplate`\
1053-
You've exceeded the limit of private test results under your current billing plan this month. ${getUsedTestsMessage(arg1.limit, arg1.usedTestsMessage)}
1054-
1055-
To upgrade your account, please visit your billing to upgrade to another billing plan.
1056-
1057-
${fmt.off(arg1.link)}`
1058-
},
10591029
FREE_PLAN_EXCEEDS_MONTHLY_TESTS: (arg1: {link: string, usedTestsMessage: string, limit: number}) => {
10601030
return errTemplate`\
10611031
You've exceeded the limit of test results under your free plan this month. ${getUsedTestsMessage(arg1.limit, arg1.usedTestsMessage)}
@@ -1901,12 +1871,6 @@ export type AllCypressErrorObj = typeof AllCypressErrors
19011871

19021872
export type AllCypressErrorNames = keyof typeof AllCypressErrors
19031873

1904-
export function getMsgByType<Type extends keyof AllCypressErrorObj> (type: Type, ...args: Parameters<AllCypressErrorObj[Type]>): string {
1905-
const err = getError(type, ...args)
1906-
1907-
return err.message
1908-
}
1909-
19101874
/**
19111875
* Given an error name & params for the error, returns a "CypressError",
19121876
* with a forBrowser property, used when we want to format the value for sending to

packages/errors/test/unit/errors_spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('lib/errors', () => {
1717

1818
context('.log', () => {
1919
it('uses red by default', () => {
20-
const err = errors.get('NOT_LOGGED_IN')
20+
const err = errors.get('TESTS_DID_NOT_START_FAILED')
2121

2222
const ret = errors.log(err)
2323

@@ -33,7 +33,7 @@ describe('lib/errors', () => {
3333
})
3434

3535
it('can change the color', () => {
36-
const err = errors.get('NOT_LOGGED_IN')
36+
const err = errors.get('TESTS_DID_NOT_START_FAILED')
3737

3838
const ret = errors.log(err, 'yellow')
3939

packages/errors/test/unit/visualSnapshotErrors_spec.ts

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,6 @@ describe('visual error templates', () => {
364364
default: ['/path/does/not/exist', err.message],
365365
}
366366
},
367-
NOT_LOGGED_IN: () => {
368-
return {
369-
default: [],
370-
}
371-
},
372367
TESTS_DID_NOT_START_RETRYING: () => {
373368
return {
374369
default: ['Retrying...'],
@@ -971,34 +966,6 @@ describe('visual error templates', () => {
971966
default: [],
972967
}
973968
},
974-
FREE_PLAN_EXCEEDS_MONTHLY_PRIVATE_TESTS: () => {
975-
return {
976-
default: [{
977-
link: 'https://cloud.cypress.io/project/abcd',
978-
limit: 500,
979-
usedTestsMessage: 'test',
980-
}],
981-
}
982-
},
983-
FREE_PLAN_IN_GRACE_PERIOD_EXCEEDS_MONTHLY_PRIVATE_TESTS: () => {
984-
return {
985-
default: [{
986-
link: 'https://cloud.cypress.io/project/abcd',
987-
limit: 500,
988-
usedTestsMessage: 'test',
989-
gracePeriodMessage: 'the grace period ends',
990-
}],
991-
}
992-
},
993-
PAID_PLAN_EXCEEDS_MONTHLY_PRIVATE_TESTS: () => {
994-
return {
995-
default: [{
996-
link: 'https://on.cypress.io/set-up-billing',
997-
limit: 25000,
998-
usedTestsMessage: 'private test',
999-
}],
1000-
}
1001-
},
1002969
FREE_PLAN_EXCEEDS_MONTHLY_TESTS: () => {
1003970
return {
1004971
default: [{

packages/graphql/schemas/schema.graphql

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,9 +1207,7 @@ enum ErrorTypeEnum {
12071207
FIREFOX_GECKODRIVER_FAILURE
12081208
FIXTURE_NOT_FOUND
12091209
FOLDER_NOT_WRITABLE
1210-
FREE_PLAN_EXCEEDS_MONTHLY_PRIVATE_TESTS
12111210
FREE_PLAN_EXCEEDS_MONTHLY_TESTS
1212-
FREE_PLAN_IN_GRACE_PERIOD_EXCEEDS_MONTHLY_PRIVATE_TESTS
12131211
FREE_PLAN_IN_GRACE_PERIOD_EXCEEDS_MONTHLY_TESTS
12141212
FREE_PLAN_IN_GRACE_PERIOD_PARALLEL_FEATURE
12151213
INCOMPATIBLE_PLUGIN_RETRIES
@@ -1229,12 +1227,10 @@ enum ErrorTypeEnum {
12291227
MIGRATION_CYPRESS_NOT_FOUND
12301228
MIGRATION_MISMATCHED_CYPRESS_VERSIONS
12311229
MULTIPLE_SUPPORT_FILES_FOUND
1232-
NOT_LOGGED_IN
12331230
NO_DEFAULT_CONFIG_FILE_FOUND
12341231
NO_PROJECT_FOUND_AT_PROJECT_ROOT
12351232
NO_PROJECT_ID
12361233
NO_SPECS_FOUND
1237-
PAID_PLAN_EXCEEDS_MONTHLY_PRIVATE_TESTS
12381234
PARALLEL_FEATURE_NOT_AVAILABLE_IN_PLAN
12391235
PLAN_EXCEEDS_MONTHLY_TESTS
12401236
PLAN_IN_GRACE_PERIOD_RUN_GROUPING_FEATURE_USED

packages/server/lib/modes/record.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,6 @@ const createRun = Promise.method((options: any = {}) => {
306306

307307
return _.each(response.warnings, (warning: any) => {
308308
switch (warning.code) {
309-
case 'FREE_PLAN_IN_GRACE_PERIOD_EXCEEDS_MONTHLY_PRIVATE_TESTS':
310-
return errorsWarning('FREE_PLAN_IN_GRACE_PERIOD_EXCEEDS_MONTHLY_PRIVATE_TESTS', {
311-
limit: warning.limit,
312-
usedTestsMessage: 'private test',
313-
gracePeriodMessage: gracePeriodMessage(warning.gracePeriodEnds),
314-
link: billingLink(warning.orgId),
315-
})
316309
case 'FREE_PLAN_IN_GRACE_PERIOD_EXCEEDS_MONTHLY_TESTS':
317310
return errorsWarning('FREE_PLAN_IN_GRACE_PERIOD_EXCEEDS_MONTHLY_TESTS', {
318311
limit: warning.limit,
@@ -332,13 +325,6 @@ const createRun = Promise.method((options: any = {}) => {
332325
usedTestsMessage: 'test',
333326
link: billingLink(warning.orgId),
334327
})
335-
case 'PAID_PLAN_EXCEEDS_MONTHLY_PRIVATE_TESTS':
336-
return errorsWarning('PLAN_EXCEEDS_MONTHLY_TESTS', {
337-
planType: 'current',
338-
limit: warning.limit,
339-
usedTestsMessage: 'private test',
340-
link: billingLink(warning.orgId),
341-
})
342328
case 'PAID_PLAN_EXCEEDS_MONTHLY_TESTS':
343329
return errorsWarning('PLAN_EXCEEDS_MONTHLY_TESTS', {
344330
planType: 'current',
@@ -380,12 +366,6 @@ const createRun = Promise.method((options: any = {}) => {
380366
const orgId = _.get(payload, 'orgId')
381367

382368
switch (code) {
383-
case 'FREE_PLAN_EXCEEDS_MONTHLY_PRIVATE_TESTS':
384-
return throwErr('FREE_PLAN_EXCEEDS_MONTHLY_PRIVATE_TESTS', {
385-
limit,
386-
usedTestsMessage: 'private test',
387-
link: billingLink(orgId),
388-
})
389369
case 'FREE_PLAN_EXCEEDS_MONTHLY_TESTS':
390370
return throwErr('FREE_PLAN_EXCEEDS_MONTHLY_TESTS', {
391371
limit,

packages/server/test/unit/errors_spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ context('.logException', () => {
2828
sinon.stub(exception, 'create').resolves()
2929
sinon.stub(process.env, 'CYPRESS_INTERNAL_ENV').value('production')
3030

31-
const err = errors.get('NOT_LOGGED_IN')
31+
const err = errors.get('TESTS_DID_NOT_START_FAILED')
3232

3333
return errors.logException(err)
3434
.then(() => {
@@ -56,7 +56,7 @@ context('.logException', () => {
5656
sinon.stub(exception, 'create').rejects(new Error('foo'))
5757
sinon.stub(process.env, 'CYPRESS_INTERNAL_ENV').value('production')
5858

59-
const err = errors.get('NOT_LOGGED_IN')
59+
const err = errors.get('TESTS_DID_NOT_START_FAILED')
6060

6161
return errors.logException(err)
6262
.then((ret) => {

system-tests/__snapshots__/record_spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,9 +1878,9 @@ Warning from Cypress Cloud:
18781878
This feature will not be supported soon, please check with Cypress to learn more: https://on.cypress.io/
18791879
----------------------------------------------------------------------
18801880
1881-
You've exceeded the limit of private test results under your free plan this month. The limit is 500 private test results.
1881+
You've exceeded the limit of test results under your current billing plan this month. The limit is 500 test results.
18821882
1883-
Your plan is now in a grace period, which means your tests will still be recorded until 2999-12-31. Please upgrade your plan to continue recording tests on Cypress Cloud in the future.
1883+
To continue getting the full benefits of your current plan, please visit your billing to upgrade.
18841884
18851885
https://on.cypress.io/dashboard/organizations/org-id-1234/billing
18861886

0 commit comments

Comments
 (0)