Skip to content

Commit

Permalink
fix: support using create-cypress-tests as part of build process (#18714
Browse files Browse the repository at this point in the history
)

Co-authored-by: Tim Griesser <[email protected]>
  • Loading branch information
lmiller1990 and tgriesser authored Nov 1, 2021
1 parent a064d1c commit 0501452
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 7 deletions.
6 changes: 5 additions & 1 deletion npm/create-cypress-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0-development",
"description": "Cypress smart installation wizard",
"private": false,
"main": "index.js",
"main": "dist/src/main.js",
"scripts": {
"build": "yarn prepare-example && tsc -p ./tsconfig.json && node scripts/example copy-to ./dist/initial-template && yarn prepare-copy-templates",
"build-prod": "yarn build",
Expand Down Expand Up @@ -41,6 +41,10 @@
"snap-shot-it": "7.9.3",
"typescript": "^4.2.3"
},
"files": [
"dist",
"bin"
],
"bin": {
"create-cypress-tests": "dist/src/index.js"
},
Expand Down
2 changes: 2 additions & 0 deletions npm/create-cypress-tests/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,5 @@ export async function main ({ useNpm, ignoreTs, setupComponentTesting, ignoreExa

console.log(`\nHappy testing with ${chalk.green('cypress.io')} 🌲\n`)
}

export { scanFSForAvailableDependency }
12 changes: 12 additions & 0 deletions packages/data-context/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,21 @@
},
"dependencies": {
"@storybook/csf-tools": "^6.4.0-alpha.38",
"@urql/core": "2.3.1",
"@urql/exchange-execute": "1.1.0",
"@urql/exchange-graphcache": "4.3.3",
"chokidar": "3.5.1",
"create-cypress-tests": "0.0.0-development",
"cross-fetch": "^3.1.4",
"dataloader": "^2.0.0",
"dedent": "^0.7.0",
"electron": "14.1.0",
"endent": "2.0.1",
"execa": "1.0.0",
"fs-extra": "8.1.0",
"getenv": "1.0.0",
"globby": "^11.0.1",
"graphql": "^15.5.1",
"lodash": "4.17.21",
"p-defer": "^3.0.0",
"wonka": "^4.0.15"
Expand All @@ -26,6 +37,7 @@
"@packages/resolve-dist": "0.0.0-development",
"@packages/ts": "0.0.0-development",
"@packages/types": "0.0.0-development",
"@types/dedent": "^0.7.0",
"mocha": "7.0.1",
"rimraf": "3.0.2"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/data-context/src/sources/ProjectDataSource.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { CodeGenType, SpecType } from '@packages/graphql/src/gen/nxs.gen'
import { FrontendFramework, FRONTEND_FRAMEWORKS, FullConfig, ResolvedFromConfig, RESOLVED_FROM, SpecFile, STORYBOOK_GLOB } from '@packages/types'
import { scanFSForAvailableDependency } from 'create-cypress-tests/src/findPackageJson'
import { scanFSForAvailableDependency } from 'create-cypress-tests'
import path from 'path'

import type { DataContext } from '..'
Expand Down
1 change: 0 additions & 1 deletion packages/frontend-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.0.0-development",
"private": true,
"scripts": {
"build-prod": "tsc || echo 'built, with type errors'",
"check-ts": "vue-tsc --noEmit",
"clean-deps": "rimraf node_modules",
"clean": "rimraf dist ./node_modules/.vite src/*.js src/**/*.js && echo 'cleaned'",
Expand Down
18 changes: 16 additions & 2 deletions scripts/binary/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,27 @@ require('./packages/server')\
const runSmokeTests = function () {
log('#runSmokeTests')

const run = function () {
const run = async function () {
// make sure to use a longer timeout - on Mac the first
// launch of a built application invokes gatekeeper check
// which takes a couple of seconds
const executablePath = meta.buildAppExecutable(platform)

return smoke.test(executablePath)
// Moving this package specifically to simulate a failing scenario for
// https://github.com/cypress-io/cypress/pull/18714
await fse.move(
path.join(process.cwd(), 'node_modules/create-cypress-tests'),
path.join(process.cwd(), 'node_modules/_create-cypress-tests'),
)

try {
return await smoke.test(executablePath)
} finally {
await fse.move(
path.join(process.cwd(), 'node_modules/_create-cypress-tests'),
path.join(process.cwd(), 'node_modules/create-cypress-tests'),
)
}
}

if (xvfb.isNeeded()) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/binary/zip.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const checkZipSize = function (zipPath) {
const zipSize = filesize(stats.size, { round: 0 })

console.log(`zip file size ${zipSize}`)
const MAX_ALLOWED_SIZE_MB = os.platform() === 'win32' ? 295 : 260
const MAX_ALLOWED_SIZE_MB = os.platform() === 'win32' ? 295 : 300
const MAX_ZIP_FILE_SIZE = megaBytes(MAX_ALLOWED_SIZE_MB)

if (stats.size > MAX_ZIP_FILE_SIZE) {
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18619,7 +18619,7 @@ end-of-stream@^1.0.0, end-of-stream@^1.1.0, end-of-stream@^1.4.1:
dependencies:
once "^1.4.0"

endent@^2.0.1:
endent@2.0.1, endent@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/endent/-/endent-2.0.1.tgz#fb18383a3f37ae3213a5d9f6c4a880d1061eb4c5"
integrity sha512-mADztvcC+vCk4XEZaCz6xIPO2NHQuprv5CAEjuVAu6aZwqAj7nVNlMyl1goPFYqCCpS2OJV9jwpumJLkotZrNw==
Expand Down

0 comments on commit 0501452

Please sign in to comment.