chore: post-merge cleanup

This commit is contained in:
Tim Griesser
2021-11-20 16:11:29 -05:00
parent 7c339d41c8
commit 92aa22a9ac
25 changed files with 54 additions and 149 deletions

View File

@@ -1032,8 +1032,10 @@ jobs:
runner-integration-tests-chrome,
runner-ct-integration-tests-chrome,
reporter-integration-tests,
run-frontend-shared-component-tests-chrome,
run-app-integration-tests-chrome,
run-launchpad-integration-tests-chrome
run-launchpad-integration-tests-chrome,
run-launchpad-component-tests-chrome,
- run: yarn percy build:finalize
cli-visual-tests:

View File

@@ -26,30 +26,6 @@ Platform: test platform-x64 (Foo-OsVersion)
Cypress Version: 1.2.3
`
exports['errors individual has the following errors 1'] = [
"CYPRESS_RUN_BINARY",
"binaryNotExecutable",
"childProcessKilled",
"failedDownload",
"failedUnzip",
"incompatibleHeadlessFlags",
"invalidCacheDirectory",
"invalidCypressEnv",
"invalidOS",
"invalidRunProjectPath",
"invalidSmokeTestDisplayError",
"invalidTestingType",
"missingApp",
"missingDependency",
"missingXvfb",
"nonZeroExitCodeXvfb",
"notInstalledCI",
"smokeTestFailure",
"unexpected",
"unknownError",
"versionMismatch"
]
exports['invalid display error'] = `
Cypress verification failed.
@@ -108,6 +84,7 @@ exports['errors individual has the following errors 1'] = [
"incompatibleTestingTypeAndFlag",
"invalidCacheDirectory",
"invalidCypressEnv",
"invalidOS",
"invalidRunProjectPath",
"invalidSmokeTestDisplayError",
"invalidTestingType",

View File

@@ -1,4 +1,4 @@
const validate = require('./validation')
import validate from './validation'
interface ResolvedConfigOption {
name: string

View File

@@ -6,7 +6,7 @@
"main": "lib/index.js",
"scripts": {
"build-prod": "tsc --project .",
"clean": "rm lib/options.js",
"clean": "rm lib/options.js || echo 'ok'",
"test": "yarn test-unit",
"test-debug": "yarn test-unit --inspect-brk=5566",
"test-unit": "mocha --configFile=../../mocha-reporter-config.json -r @packages/ts/register -extension=.js,.ts test/unit/*spec.* --exit"

View File

@@ -98,7 +98,7 @@ export class DataContext {
this.actions.auth.getUser(),
// and grab the user device settings
this.actions.localSettings.refreshLocalSettings(),
this.actions.app.refreshNodePathAndVersion(),
this.actions.app.refreshNodePath(),
]
if (this._config._internalOptions.loadCachedProjects) {
@@ -161,8 +161,8 @@ export class DataContext {
return this.coreData.app.browsers
}
get nodePathAndVersion () {
return this.coreData.app.nodePathAndVersion
get nodePath () {
return this.coreData.app.nodePath
}
get baseError () {

View File

@@ -1,5 +1,5 @@
import type Bluebird from 'bluebird'
import type { FoundBrowser, NodePathAndVersion } from '@packages/types'
import type { FoundBrowser } from '@packages/types'
import pDefer from 'p-defer'
import type { DataContext } from '..'
@@ -7,7 +7,7 @@ import type { DataContext } from '..'
export interface AppApiShape {
getBrowsers(): Promise<FoundBrowser[]>
ensureAndGetByNameOrPath(nameOrPath: string, returnAll?: boolean, browsers?: FoundBrowser[]): Bluebird<FoundBrowser | FoundBrowser[] | undefined>
findNodePathAndVersion(): Promise<{ path: string, version: string}>
findNodePath(): Promise<string>
}
export class AppActions {
@@ -87,19 +87,19 @@ export class AppActions {
return browsers.some((b) => this.idForBrowser(b) === this.idForBrowser(chosenBrowser))
}
async refreshNodePathAndVersion () {
if (this.ctx.coreData.app.refreshingNodePathAndVersion) {
async refreshNodePath () {
if (this.ctx.coreData.app.refreshingNodePath) {
return
}
const dfd = pDefer<NodePathAndVersion>()
const dfd = pDefer<string>()
this.ctx.coreData.app.refreshingNodePathAndVersion = dfd.promise
this.ctx.coreData.app.refreshingNodePath = dfd.promise
const nodePathAndVersion = await this.ctx._apis.appApi.findNodePathAndVersion()
const nodePath = await this.ctx._apis.appApi.findNodePath()
this.ctx.coreData.app.nodePathAndVersion = nodePathAndVersion
this.ctx.coreData.app.nodePath = nodePath
dfd.resolve(nodePathAndVersion)
dfd.resolve(nodePath)
}
}

View File

@@ -61,7 +61,7 @@ export class ProjectConfigDataActions {
...process.env,
NODE_OPTIONS: process.env.ORIGINAL_NODE_OPTIONS || '',
},
execPath: this.ctx.nodePathAndVersion?.path,
execPath: this.ctx.nodePath ?? undefined,
}
if (inspector.url()) {

View File

@@ -1,4 +1,4 @@
import { BUNDLERS, FoundBrowser, FoundSpec, FullConfig, Preferences, NodePathAndVersion, DevicePreferences, devicePreferenceDefaults, Editor } from '@packages/types'
import { BUNDLERS, FoundBrowser, FoundSpec, FullConfig, Preferences, DevicePreferences, devicePreferenceDefaults, Editor } from '@packages/types'
import type { NexusGenEnums, TestingTypeEnum } from '@packages/graphql/src/gen/nxs.gen'
import type { BrowserWindow } from 'electron'
import type { ChildProcess } from 'child_process'
@@ -59,8 +59,8 @@ export interface AppDataShape {
projects: ProjectShape[]
currentTestingType: Maybe<TestingTypeEnum>
refreshingBrowsers: Promise<FoundBrowser[]> | null
refreshingNodePathAndVersion: Promise<NodePathAndVersion> | null
nodePathAndVersion: NodePathAndVersion | null
refreshingNodePath: Promise<string> | null
nodePath: string | null
}
export interface WizardDataShape {
@@ -112,8 +112,8 @@ export function makeCoreData (): CoreDataShape {
refreshingBrowsers: null,
browsers: null,
projects: [],
refreshingNodePathAndVersion: null,
nodePathAndVersion: null,
refreshingNodePath: null,
nodePath: null,
},
localSettings: {
availableEditors: [],

View File

@@ -13,8 +13,8 @@ export class ProjectConfigDataSource {
configFilePath = await this.getConfigFilePath()
}
if (!this.ctx.nodePathAndVersion) {
await this.ctx.actions.app.refreshNodePathAndVersion()
if (!this.ctx.nodePath) {
await this.ctx.actions.app.refreshNodePath()
}
return this.ctx.deref.actions.projectConfig.refreshProjectConfig(configFilePath)

View File

@@ -1 +0,0 @@
{}

View File

@@ -61,8 +61,8 @@ declare global {
* Removes the sinon spy'ing on the remote GraphQL fake requests
*/
disableRemoteGraphQLFakes(): void
visitApp(href?: string): Chainable<string>
visitLaunchpad(href?: string): Chainable<string>
visitApp(href?: string): Chainable<AUTWindow>
visitLaunchpad(href?: string): Chainable<AUTWindow>
}
}
}
@@ -130,7 +130,7 @@ function visitApp (href?: string) {
throw new Error(`Missing serverPort - did you forget to call cy.initializeApp(...) ?`)
}
cy.withCtx(async (ctx) => {
return cy.withCtx(async (ctx) => {
return JSON.stringify(ctx.html.fetchAppInitialData())
}, { log: false }).then((ssrData) => {
return cy.visit(`dist-app/index.html?serverPort=${e2e_serverPort}${href || ''}`, {
@@ -143,14 +143,14 @@ function visitApp (href?: string) {
})
}
function visitLaunchpad (hash?: string) {
function visitLaunchpad () {
const { e2e_gqlPort } = Cypress.env()
if (!e2e_gqlPort) {
throw new Error(`Missing gqlPort - did you forget to call cy.setupE2E(...) ?`)
}
cy.visit(`dist-launchpad/index.html?gqlPort=${e2e_gqlPort}`)
return cy.visit(`dist-launchpad/index.html?gqlPort=${e2e_gqlPort}`)
}
const pageLoadId = `uid${Math.random()}`

View File

@@ -1,5 +1,5 @@
import '@percy/cypress'
import type { Component } from 'vue'
import type { ComponentPublicInstance } from 'vue'
// Add cy.mount, cy.mountFragment, cy.mountFragmentList
export * from './mock-graphql/mountFragment'
@@ -20,7 +20,7 @@ declare global {
/**
* return Vue Test Utils wrapper wrapped in a cypress chainable
*/
vue(componentToFind?: Component): Cypress.Chainable<any>
vue<T extends ComponentPublicInstance>(componentToFind?: (new () => T) | null): Cypress.Chainable<any>
}
}
}

View File

@@ -28,6 +28,7 @@ export interface MountFnOptions {
export const registerMountFn = ({ plugins }: MountFnOptions = {}) => {
Cypress.Commands.add(
'mount',
// @ts-ignore todo: figure out the correct types
<C extends Parameters<typeof mount>[0]>(comp: C, options: CyMountOptions<C> = {}) => {
options.global = options.global || {}
options.global.stubs = options.global.stubs || {}
@@ -129,6 +130,7 @@ export const registerMountFn = ({ plugins }: MountFnOptions = {}) => {
Cypress.Commands.add('mountFragment', mountFragment)
Cypress.Commands.add('mountFragmentList', (source, options) => {
// @ts-expect-error - todo: tim fix
return mountFragment(source, options, true)
})
}

View File

@@ -22,5 +22,6 @@ export function attachedFileWithPath (subject: HTMLInputElement, path: string) {
Cypress.Commands.add(
'attachFileWithPath',
{ prevSubject: true },
// @ts-ignore - fixed by https://github.com/cypress-io/cypress/pull/19003
attachedFileWithPath,
)

View File

@@ -120,12 +120,6 @@ export function isValidCypressInternalEnvValue (value) {
return _.includes(names, value)
}
export function allowed (obj = {}) {
const propertyNames = publicConfigKeys.concat(breakingKeys)
return _.pick(obj, propertyNames)
}
export type FullConfig =
Cypress.RuntimeConfigOptions &
Cypress.ResolvedConfigOptions &

View File

@@ -62,8 +62,8 @@ export function makeDataContext (options: MakeDataContextOptions): DataContext {
appApi: {
getBrowsers,
ensureAndGetByNameOrPath,
findNodePathAndVersion () {
return findSystemNode.findNodePathAndVersion()
findNodePath () {
return findSystemNode.findNodeInFullPath()
},
},
authApi: {

View File

@@ -441,8 +441,6 @@ describe('lib/util/args', () => {
'--ci=ci',
'--ciBuildId=ciBuildId',
'--clearLogs=clearLogs',
'--userNodePath=userNodePath',
'--userNodeVersion=userNodeVersion',
'--config=config',
'--configFile=configFile',
'--cwd=cwd',
@@ -474,6 +472,8 @@ describe('lib/util/args', () => {
'--tag=tag',
'--testingType=testingType',
'--updating=updating',
'--userNodePath=userNodePath',
'--userNodeVersion=userNodeVersion',
'--version=version',
])
})

View File

@@ -79,8 +79,3 @@ export interface OpenProjectLaunchOptions {
[key: string]: any
}
export interface NodePathAndVersion {
path: string
version: string
}

View File

@@ -128,7 +128,7 @@ export const replaceLocalNpmVersions = async function (basePath: string) {
async function updatePackageJson (pkg: string) {
const pkgJsonPath = path.join(basePath, pkg)
visited.add(pkgJsonPath)
visited.add(pkg)
const json = await fs.readJson(pkgJsonPath)
const { dependencies } = json
@@ -137,17 +137,19 @@ export const replaceLocalNpmVersions = async function (basePath: string) {
let shouldWriteFile = false
for (const [depName, version] of Object.entries(dependencies)) {
if (!depName.startsWith('@cypress/') || version !== '0.0.0-development') {
const matchedPkg = Boolean(depName.startsWith('@cypress/') || depName === 'create-cypress-tests')
if (!matchedPkg || version !== '0.0.0-development') {
continue
}
const [, localPkg] = depName.split('/')
const pkgName = depName.startsWith('@cypress/') ? depName.split('/')[1] : depName
const localPkgJsonPath = path.join(basePath, 'npm', localPkg)
json.dependencies[depName] = `file:${path.join(basePath, 'npm', pkgName)}`
shouldWriteFile = true
dependencies[`@cypress/${localPkg}`] = `file:${localPkgJsonPath}`
if (!visited.has(localPkgJsonPath)) {
await updatePackageJson(`./npm/${localPkg}/package.json`)
if (!visited.has(depName)) {
await updatePackageJson(`./npm/${pkgName}/package.json`)
}
shouldWriteFile = true
@@ -165,7 +167,7 @@ export const replaceLocalNpmVersions = async function (basePath: string) {
export async function removeLocalNpmDirs (distPath: string, except: string[]) {
const toRemove = await globby(`${distPath}/npm/*`, {
ignore: except.map((e) => e.replace('/package.json', '')),
ignore: except.map((e) => path.join(distPath, e).replace('/package.json', '')),
onlyDirectories: true,
})

View File

@@ -13,10 +13,6 @@ Require stack:
- lib/reporter.js
- lib/project-base.ts
- lib/open_project.ts
- lib/makeDataContext.ts
- lib/util/settings.ts
- lib/config.ts
- lib/util/args.js
- lib/cypress.js
- index.js
-

View File

@@ -1,6 +1,6 @@
exports['e2e system node uses system node when launching plugins file 1'] = `
Deprecation Warning: \`nodeVersion\` is currently set to \`system\` in the \`cypress.json\` configuration file. As of Cypress version \`9.0.0\` the default behavior of \`nodeVersion\` has changed to always use the version of Node used to start cypress via the cli.
Please remove the \`nodeVersion\` configuration option from \`cypress.json\`.
Deprecation Warning: \`nodeVersion\` is currently set to \`system\` in the \`cypress.config.js\` configuration file. As of Cypress version \`9.0.0\` the default behavior of \`nodeVersion\` has changed to always use the version of Node used to start cypress via the cli.
Please remove the \`nodeVersion\` configuration option from \`cypress.config.js\`.
====================================================================================================
@@ -59,68 +59,6 @@ Please remove the \`nodeVersion\` configuration option from \`cypress.json\`.
✔ All specs passed! XX:XX 1 1 - - -
`
exports['e2e system node uses bundled node when launching plugins file 1'] = `
Deprecation Warning: \`nodeVersion\` is currently set to \`bundled\` in the \`cypress.json\` configuration file. As of Cypress version \`9.0.0\` the default behavior of \`nodeVersion\` has changed to always use the version of Node used to start cypress via the cli. When \`nodeVersion\` is set to \`bundled\`, Cypress will use the version of Node bundled with electron. This can cause problems running certain plugins or integrations.
As the \`nodeVersion\` configuration option will be removed in a future release, it is recommended to remove the \`nodeVersion\` configuration option from \`cypress.json\`.
====================================================================================================
(Run Starting)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 1.2.3 │
│ Browser: FooBrowser 88 │
│ Specs: 1 found (bundled.spec.js) │
│ Searched: cypress/integration/bundled.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: bundled.spec.js (1 of 1)
✓ has expected resolvedNodePath and resolvedNodeVersion
1 passing
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 1 │
│ Passing: 1 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: X seconds │
│ Spec Ran: bundled.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: /XXX/XXX/XXX/cypress/videos/bundled.spec.js.mp4 (X second)
====================================================================================================
(Run Finished)
Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ ✔ bundled.spec.js XX:XX 1 1 - - - │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
✔ All specs passed! XX:XX 1 1 - - -
`
exports['e2e system node uses default node when launching plugins file 1'] = `

View File

@@ -0,0 +1 @@
module.exports = {}

View File

@@ -1,5 +1,4 @@
module.exports = {
'nodeVersion': 'system',
'e2e': {
setupNodeEvents (on, config) {
process.stderr.write('Plugin Loaded\n')

View File

@@ -38,7 +38,7 @@ describe('e2e system node', () => {
expect(stderr).to.contain('Plugin Electron version: undefined')
})
it('uses bundled node when launching plugins file', async function () {
xit('uses bundled node when launching plugins file', async function () {
const { stderr } = await systemTests.exec(this, {
project: systemNode,
config: {