mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-22 23:20:24 -05:00
chore: fix typing errors
This commit is contained in:
@@ -28,6 +28,10 @@ export interface StartDevServerOptions {
|
||||
export const resolveServerConfig = async ({ viteConfig, options, indexHtml }: StartDevServerOptions): Promise<InlineConfig> => {
|
||||
const { projectRoot, supportFile, namespace } = options.config
|
||||
|
||||
if (!projectRoot) {
|
||||
throw Error('Expected projectRoot to be defined on options.config. Did you forget to pass `config`?')
|
||||
}
|
||||
|
||||
const requiredOptions: InlineConfig = {
|
||||
base: `/${namespace}/src/`,
|
||||
root: projectRoot,
|
||||
@@ -35,7 +39,7 @@ export const resolveServerConfig = async ({ viteConfig, options, indexHtml }: St
|
||||
|
||||
const finalConfig: InlineConfig = { ...viteConfig, ...requiredOptions }
|
||||
|
||||
finalConfig.plugins = [...(finalConfig.plugins || []), makeCypressPlugin(projectRoot, supportFile, options.devServerEvents, options.specs, options.config.namespace, indexHtml)]
|
||||
finalConfig.plugins = [...(finalConfig.plugins || []), makeCypressPlugin(projectRoot, supportFile, options.devServerEvents, options.specs, options.config.namespace || '', indexHtml)]
|
||||
|
||||
// This alias is necessary to avoid a "prefixIdentifiers" issue from slots mounting
|
||||
// only cjs compiler-core accepts using prefixIdentifiers in slots which vue test utils use.
|
||||
|
||||
@@ -27,7 +27,11 @@ export async function start ({ webpackConfig: userWebpackConfig, indexHtml, opti
|
||||
debug('User did not pass in any webpack configuration')
|
||||
}
|
||||
|
||||
const { projectRoot, devServerPublicPathRoute, isTextTerminal } = options.config
|
||||
const { projectRoot, devServerPublicPathRoute = '', isTextTerminal } = options.config
|
||||
|
||||
if (!projectRoot) {
|
||||
throw Error('Expected projectRoot to be defined on options.config. Did you forget to pass `config`?')
|
||||
}
|
||||
|
||||
const webpackConfig = await makeWebpackConfig(userWebpackConfig || {}, {
|
||||
files: options.specs,
|
||||
|
||||
@@ -234,7 +234,7 @@ export class ProjectBase<TServer extends Server> extends EE {
|
||||
await this.saveState(stateToSave)
|
||||
|
||||
await Promise.all([
|
||||
checkSupportFile({ configFile: cfg.configFile, supportFile: cfg.supportFile }),
|
||||
checkSupportFile(cfg.supportFile),
|
||||
])
|
||||
|
||||
if (cfg.isTextTerminal) {
|
||||
|
||||
@@ -36,13 +36,7 @@ export const getSpecUrl = ({
|
||||
return specUrl
|
||||
}
|
||||
|
||||
export const checkSupportFile = async ({
|
||||
supportFile,
|
||||
configFile,
|
||||
}: {
|
||||
supportFile?: string | boolean
|
||||
configFile?: string | false
|
||||
}) => {
|
||||
export const checkSupportFile = async (supportFile?: string | boolean) => {
|
||||
if (supportFile && typeof supportFile === 'string') {
|
||||
const found = await fs.pathExists(supportFile)
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ export interface FullConfig extends Partial<Cypress.RuntimeConfigOptions & Cypre
|
||||
// Instead, this is an interface of values that have been manually validated to exist
|
||||
// and are required when creating a project.
|
||||
export type ReceivedCypressOptions =
|
||||
Pick<Cypress.RuntimeConfigOptions, 'hosts' | 'projectName' | 'clientRoute' | 'devServerPublicPathRoute' | 'namespace' | 'report' | 'socketIoCookie' | 'configFile' | 'isTextTerminal' | 'isNewProject' | 'proxyUrl' | 'browsers' | 'browserUrl' | 'socketIoRoute' | 'arch' | 'platform' | 'spec' | 'specs' | 'browser' | 'version' | 'remote'>
|
||||
Pick<Cypress.RuntimeConfigOptions, 'hosts' | 'projectName' | 'clientRoute' | 'devServerPublicPathRoute' | 'namespace' | 'report' | 'socketIoCookie' | 'isTextTerminal' | 'isNewProject' | 'proxyUrl' | 'browsers' | 'browserUrl' | 'socketIoRoute' | 'arch' | 'platform' | 'spec' | 'specs' | 'browser' | 'version' | 'remote'>
|
||||
& Pick<Cypress.ResolvedConfigOptions, 'chromeWebSecurity' | 'supportFolder' | 'experimentalSourceRewriting' | 'fixturesFolder' | 'reporter' | 'reporterOptions' | 'screenshotsFolder' | 'pluginsFile' | 'supportFile' | 'baseUrl' | 'viewportHeight' | 'viewportWidth' | 'port' | 'experimentalInteractiveRunEvents' | 'userAgent' | 'downloadsFolder' | 'env' | 'testFiles' | 'excludeSpecPattern' | 'specPattern'> // TODO: Figure out how to type this better.
|
||||
|
||||
export interface SampleConfigFile{
|
||||
|
||||
Reference in New Issue
Block a user