Skip to content

Commit

Permalink
Merge branch 'develop' into update-v8-snapshot-cache-on-develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthemanuel authored Jun 5, 2023
2 parents 3c743f3 + ffe4734 commit 77b2f79
Show file tree
Hide file tree
Showing 27 changed files with 177 additions and 414 deletions.
12 changes: 1 addition & 11 deletions .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,6 @@ commands:
name: Restore cache state, to check for known modules cache existence
keys:
- v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" }}-state-of-system-tests-projects-node-modules-cache-{{ checksum "system_tests_cache_key" }}
- run:
name: Send root honeycomb event for this CI build
command: cd system-tests/scripts && node ./send-root-honeycomb-event.js
- run:
name: Bail if specific cache exists
command: |
Expand Down Expand Up @@ -2036,20 +2033,13 @@ jobs:
command: rm -rf cypress.json
- run:
name: Install prod dependencies
command: yarn --production
command: yarn --production --ignore-engines
working_directory: /tmp/cypress-example-kitchensink
- run:
name: Example server
command: yarn start
working_directory: /tmp/cypress-example-kitchensink
background: true
- run:
name: Rename support file
working_directory: /tmp/cypress-example-kitchensink
command: |
if [[ -f cypress/support/index.js ]]; then
mv cypress/support/index.js cypress/support/e2e.js
fi
- run:
name: Run Kitchensink example project
command: |
Expand Down
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ module.exports = {
rules: {
'no-restricted-properties': 'off',
'no-restricted-syntax': 'off',
'no-console': 'off',
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/snyk_sca_scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ jobs:
- name: Perform SCA Scan
continue-on-error: false
run: |
snyk test --yarn-workspaces --strict-out-of-sync=false --detection-depth=6 --exclude=docker,Dockerfile --severity-threshold=critical
snyk test --all-projects --strict-out-of-sync=false --detection-depth=6 --exclude=docker,Dockerfile --severity-threshold=critical
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
8 changes: 8 additions & 0 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,15 @@
"devDependencies": {
"@babel/cli": "7.13.0",
"@babel/preset-env": "7.13.5",
"@cypress/angular": "0.0.0-development",
"@cypress/grep": "0.0.0-development",
"@cypress/mount-utils": "0.0.0-development",
"@cypress/react": "0.0.0-development",
"@cypress/react18": "0.0.0-development",
"@cypress/sinon-chai": "2.9.1",
"@cypress/svelte": "0.0.0-development",
"@cypress/vue": "0.0.0-development",
"@cypress/vue2": "0.0.0-development",
"@packages/root": "0.0.0-development",
"@types/bluebird": "3.5.33",
"@types/chai": "4.2.15",
Expand Down
3 changes: 2 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"packages/*",
"npm/*",
"tooling/*",
"system-tests"
"system-tests",
"scripts"
],
"useWorkspaces": true,
"useNx": true,
Expand Down
1 change: 1 addition & 0 deletions npm/angular/src/mount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export type MountResponse<T> = {
// 'zone.js/testing' is not properly aliasing `it.skip` but it does provide `xit`/`xspecify`
// Written up under https://github.com/angular/angular/issues/46297 but is not seeing movement
// so we'll patch here pending a fix in that library
// @ts-ignore Ignore so that way we can bypass semantic error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature.
globalThis.it.skip = globalThis.xit

@Injectable()
Expand Down
1 change: 0 additions & 1 deletion npm/create-cypress-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"copy": "0.3.2",
"mocha": "7.1.1",
"mock-fs": "5.1.1",
"shx": "0.3.3",
"snap-shot-it": "7.9.3",
"typescript": "^4.7.4"
},
Expand Down
41 changes: 39 additions & 2 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,46 @@
"default": {
"runner": "nx-cloud",
"options": {
"cacheableOperations": [],
"cacheableOperations": [
"lint"
],
"accessToken": "ZmNlNjA0YzAtNTM1NS00MDIwLWFlMWItNWYxYzNiMjQ4N2VkfHJlYWQtb25seQ=="
}
}
},
"targetDefaults": {
"lint": {
"inputs": [
"default",
"{workspaceRoot}/.eslintrc.js"
]
},
"build": {
"dependsOn": [
"^build"
]
},
"build-prod": {
"dependsOn": [
"^build-prod"
]
}
},
"namedInputs": {
"sharedGlobals": [],
"default": [
"{projectRoot}/**/*",
"sharedGlobals"
],
"production": [
"default",
"!{projectRoot}/**/*.spec.ts",
"!{projectRoot}/**/*.md",
"!{projectRoot}/tsconfig.spec.json",
"!{projectRoot}/.eslintrc.json",
"!{projectRoot}/.mocharc.{js,json}",
"!{projectRoot/cypress.config.{ts,js}",
"!{projectRoot/**/*.cy.ts"
]
}
}
}
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"binary-upload": "node ./scripts/binary.js upload",
"binary-zip": "node ./scripts/binary.js zip",
"build": "yarn build-npm-modules && lerna run build --stream --no-bail --ignore create-cypress-tests --ignore cypress --ignore \"'@packages/{runner}'\" --ignore \"'@cypress/{angular,react,react18,vue,vue2,mount-utils,svelte}'\" && node ./cli/scripts/post-build.js && lerna run build --stream --scope create-cypress-tests",
"build-npm-modules": "lerna run build --scope cypress --scope @cypress/mount-utils && lerna run build --scope \"'@cypress/{angular,react,react18,vue,vue2,svelte}'\"",
"build-npm-modules": "lerna run build --scope cypress --scope @cypress/mount-utils --scope @cypress/react && lerna run build --scope \"'@cypress/{angular,react18,vue,vue2,svelte}'\"",
"build-prod": "lerna run build-prod-ui --stream && lerna run build-prod --stream --ignore create-cypress-tests && node ./cli/scripts/post-build.js && lerna run build-prod --stream --scope create-cypress-tests --scope",
"build-v8-snapshot-dev": "node --max-old-space-size=8192 tooling/v8-snapshot/scripts/setup-v8-snapshot-in-cypress.js --env=dev",
"build-v8-snapshot-prod": "node --max-old-space-size=8192 tooling/v8-snapshot/scripts/setup-v8-snapshot-in-cypress.js",
Expand Down Expand Up @@ -41,7 +41,7 @@
"ensure-deps": "./scripts/ensure-dependencies.sh",
"get-next-version": "node scripts/get-next-version.js",
"postinstall": "node ./scripts/run-postInstall.js",
"lint": "lerna run lint --no-bail --concurrency 2 && eslint --ext .js,.ts,.json, scripts",
"lint": "lerna run lint --no-bail --concurrency 2",
"prepare-release-artifacts": "node ./scripts/prepare-release-artifacts.js",
"npm-release": "node scripts/npm-release.js",
"prestart": "yarn ensure-deps",
Expand Down Expand Up @@ -120,7 +120,6 @@
"@typescript-eslint/eslint-plugin": "4.18.0",
"@typescript-eslint/parser": "4.18.0",
"@urql/introspection": "^0.3.0",
"arg": "4.1.2",
"ascii-table": "0.0.9",
"autobarrel": "^1.1.0",
"aws-sdk": "2.814.0",
Expand Down Expand Up @@ -159,7 +158,6 @@
"filesize": "4.1.2",
"fs-extra": "9.1.0",
"getenv": "^1.0.0",
"gift": "0.10.2",
"glob": "7.1.6",
"got": "11.8.5",
"graphql": "^15.5.1",
Expand Down Expand Up @@ -196,7 +194,6 @@
"semantic-release-monorepo": "7.0.3",
"semver": "7.3.2",
"shelljs": "0.8.5",
"shx": "0.3.3",
"sinon": "7.3.2",
"snap-shot-it": "7.9.3",
"start-server-and-test": "1.10.8",
Expand Down Expand Up @@ -247,7 +244,8 @@
"packages/*",
"npm/*",
"tooling/*",
"system-tests"
"system-tests",
"scripts"
],
"nohoist": [
"**/webpack-preprocessor/babel-loader",
Expand Down
6 changes: 6 additions & 0 deletions packages/data-context/src/actions/ProjectActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export interface ProjectApiShape {
resetBrowserTabsForNextTest(shouldKeepTabOpen: boolean): Promise<void>
resetServer(): void
runSpec(spec: Cypress.Spec): Promise<void>
routeToDebug(): void
}

export interface FindSpecs<T> {
Expand Down Expand Up @@ -637,4 +638,9 @@ export class ProjectActions {
}
}
}

async debugCloudRun (runNumber: number) {
await this.ctx.relevantRuns.moveToRun(runNumber, this.ctx.git?.currentHashes || [])
this.api.routeToDebug()
}
}
13 changes: 13 additions & 0 deletions packages/data-context/test/unit/actions/ProjectActions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,17 @@ describe('ProjectActions', () => {
})
})
})

describe('debugCloudRun', () => {
beforeEach(() => {
sinon.stub(ctx.relevantRuns, 'moveToRun')
})

it('should call moveToRun and routeToDebug', async () => {
await ctx.actions.project.debugCloudRun(123)

expect(ctx.relevantRuns.moveToRun).to.have.been.calledWith(123)
expect(ctx._apis.projectApi.routeToDebug).to.have.been.called
})
})
})
1 change: 1 addition & 0 deletions packages/data-context/test/unit/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export function createTestDataContext (mode: DataContextConfig['mode'] = 'run',
insertProjectToCache: sinon.stub().resolves(),
getProjectRootsFromCache: sinon.stub().resolves([]),
runSpec: sinon.stub(),
routeToDebug: sinon.stub(),
} as unknown as ProjectApiShape,
electronApi: {
isMainWindowFocused: sinon.stub().returns(false),
Expand Down
3 changes: 3 additions & 0 deletions packages/graphql/schemas/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,9 @@ type Mutation {
"""Set failed tests for the current run to be used by the runner"""
setTestsForRun(testsBySpec: [TestsBySpecInput!]!): Boolean

"""Set the route to debug and show the specified CloudRun"""
showDebugForCloudRun(runNumber: Int!): Query

"""Show system notification via Electron"""
showSystemNotification(body: String!, title: String!): Boolean

Expand Down
13 changes: 13 additions & 0 deletions packages/graphql/src/schemaTypes/objectTypes/gql-Mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -847,5 +847,18 @@ export const mutation = mutationType({
return true
},
})

t.field('showDebugForCloudRun', {
type: Query,
description: 'Set the route to debug and show the specified CloudRun',
args: {
runNumber: nonNull(intArg()),
},
resolve: async (_, args, ctx) => {
await ctx.actions.project.debugCloudRun(args.runNumber)

return {}
},
})
},
})
3 changes: 3 additions & 0 deletions packages/server/lib/makeDataContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ export function makeDataContext (options: MakeDataContextOptions): DataContext {
async runSpec (spec: Cypress.Spec): Promise<void> {
openProject.changeUrlToSpec(spec)
},
routeToDebug () {
openProject.changeUrlToDebug()
},
},
electronApi: {
openExternal (url: string) {
Expand Down
14 changes: 14 additions & 0 deletions packages/server/lib/open_project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,20 @@ export class OpenProject {
this.projectBase.server._socket.changeToUrl(newSpecUrl)
}

changeUrlToDebug () {
if (!this.projectBase) {
debug('No projectBase, cannot change url')

return
}

const newUrl = `#/debug`

debug(`New url is ${newUrl}`)

this.projectBase.server._socket.changeToUrl(newUrl)
}

/**
* Sends the new telemetry context to the browser
* @param context - telemetry context string
Expand Down
17 changes: 17 additions & 0 deletions scripts/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"plugins": [
"cypress",
"@cypress/dev"
],
"extends": [
"plugin:@cypress/dev/general",
"plugin:@cypress/dev/tests"
],
"env": {
"cypress/globals": true
},
"rules": {
"no-console": "off",
"prefer-rest-params": "off"
}
}
9 changes: 3 additions & 6 deletions scripts/binary/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const cwd = process.cwd()
const path = require('path')
const _ = require('lodash')
const os = require('os')
const gift = require('gift')
const simpleGit = require('simple-git')
const chalk = require('chalk')
const Promise = require('bluebird')
const minimist = require('minimist')
Expand All @@ -23,9 +23,6 @@ const uploadUtils = require('./util/upload')
const { uploadArtifactToS3 } = require('./upload-build-artifact')
const { moveBinaries } = require('./move-binaries')

// initialize on existing repo
const repo = Promise.promisifyAll(gift(cwd))

const success = (str) => {
return console.log(chalk.bgGreen(` ${chalk.black(str)} `))
}
Expand Down Expand Up @@ -58,8 +55,8 @@ process.chdir(cwd)
const commitVersion = function (version) {
const msg = `release ${version} [skip ci]`

return repo.commitAsync(msg, {
'allow-empty': true,
return simpleGit.commit(msg, {
'--allow-empty': null,
})
}

Expand Down
Loading

2 comments on commit 77b2f79

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 77b2f79 Jun 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.13.1/linux-arm64/update-v8-snapshot-cache-on-develop-77b2f79de59a1b694edee99b5ff1ed4bfe6085e7/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 77b2f79 Jun 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.13.1/linux-x64/update-v8-snapshot-cache-on-develop-77b2f79de59a1b694edee99b5ff1ed4bfe6085e7/cypress.tgz

Please sign in to comment.