-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
chore: convert xhrs js to ts #30935
base: develop
Are you sure you want to change the base?
chore: convert xhrs js to ts #30935
Conversation
cypress Run #60030
Run Properties:
|
Project |
cypress
|
Branch Review |
convert-ts-2
|
Run status |
Passed #60030
|
Run duration | 17m 41s |
Commit |
52e1368882: install mime in net-stubbing package
|
Committer | Jennifer Shehane |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
13
|
Pending |
1099
|
Skipped |
0
|
Passing |
26478
|
View all changes introduced in this branch ↗︎ |
UI Coverage
45.83%
|
|
---|---|
Untested elements |
190
|
Tested elements |
165
|
Accessibility
92.54%
|
|
---|---|
Failed rules |
3 critical
8 serious
2 moderate
2 minor
|
Failed elements |
888
|
@@ -18,12 +19,43 @@ import type { CypressIncomingRequest } from '@packages/proxy' | |||
import type { InterceptedRequest } from './intercepted-request' | |||
import { caseInsensitiveGet, caseInsensitiveHas } from '../util' | |||
|
|||
// TODO: move this into net-stubbing once cy.route is removed |
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.
There was a note about moving this into net-stubbing once cy.route was removed, so I did that 🤷🏻♀️
import { expect } from 'chai' | ||
import { join } from 'path' | ||
import { readFileSync } from 'fs' | ||
|
||
const imageBuffer = readFileSync(join(__dirname, '..', 'fixtures', 'cypress-logo.png')) | ||
|
||
describe('net-stubbing util', () => { | ||
describe('parseContentType', () => { |
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.
just moved the unit tests into net-stubbing with the function
import type { CyHttpMessages } from '../external-types' | ||
import { getEncoding } from 'istextorbinary' | ||
|
||
const debug = Debug('cypress:net-stubbing:server:util') | ||
const htmlLikeRe = /<.+>[\s\S]+<\/.+>/ | ||
|
||
const isValidJSON = function (text) { |
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.
const isValidJSON = function (text) { | |
const isValidJSON = function (text: unknown) { |
} | ||
|
||
export function parseContentType (response?: string) { | ||
const ret = (type) => { |
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.
Do we really get anything out of having this be its own function?
const ret = (type) => { | |
const ret = (type: string) => { |
Additional details
Converting server xhrs.js to typescript. There could be better types, but I didn't want to get too caught up in an area of code that I'm not super familiar with. Still attempting to have all references of
mime
be in TS files so we can upgrade the dep.Steps to test
ts lint/checks + tests pass
How has the user experience changed?
N/A
PR Tasks
cypress-documentation
?type definitions
?