diff --git a/.eslintignore b/.eslintignore index 6f27d588c8e2..18224f7f50c1 100644 --- a/.eslintignore +++ b/.eslintignore @@ -34,6 +34,7 @@ system-tests/projects/e2e/cypress/integration/typescript_syntax_error_spec.ts # cli/types is linted by tslint/dtslint cli/types + # packages/example is not linted (think about changing this) packages/example diff --git a/.gitignore b/.gitignore index dac6ee79c5f4..8101869bac2a 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,9 @@ cypress.zip Cached Theme.pak Cached Theme Material Design.pak +# from config, compiled .js files +packages/config/lib/*.js + # from data-context, compiled .js files packages/data-context/src/**/*.js @@ -20,7 +23,6 @@ packages/data-context/src/**/*.js packages/desktop-gui/cypress/videos packages/desktop-gui/src/jsconfig.json - # from driver packages/driver/cypress/videos packages/driver/cypress/screenshots diff --git a/.node-version b/.node-version index 62df50f1eefe..d9617ea1b408 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -14.17.0 +16.5.0 \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 1c8bfb1fae54..ff504e9917f3 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,12 +1,17 @@ { // To see these extensions in VS Code: - // 1. Open the Command Palette (Ctrl+Shift+P) + // 1. Open the Command Palette: + // - Non-Mac Users: (Ctrl+Shift+P) + // - Mac Users: (Cmd+Shift+P) // 2. Select "Extensions: Show Recommended Extensions" // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. // List of extensions which are recommended for Cypress contributors using VS Code: "recommendations": [ + // Name: Apollo GraphQL + // Description: Rich editor support for GraphQL client and server development that seamlessly integrates with the Apollo platform + "apollographql.vscode-apollo", // Name: ESLint // Description: Integrates ESLint JavaScript into VS Code. "dbaeumer.vscode-eslint", diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2f8687bfb2f7..b1b70f3d2f8f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -327,10 +327,6 @@ The project utilizes [yarn workspaces](https://yarnpkg.com/lang/en/docs/workspac > **โš  Running on Windows?** > > Many of the NPM scripts used during development use commands designed for a Linux-like shell.If you are running a Windows operating system, you may encounter many commands that are not working. To fix this behavior, you have to set a Linux-like shell as the default `npm` script shell. If you have Git for Windows installed, you can set Git Bash as the default script shell by using the following command: -> ```bash -> yarn config set script-shell "C:\\Program Files (x86)\\git\\bin\\bash.exe" -> ``` -> Git Bash may be installed in `Program Files`, if so, use the following command: >```bash > yarn config set script-shell "C:\\Program Files\\git\\bin\\bash.exe" >``` diff --git a/__snapshots__/packages-spec.js b/__snapshots__/packages-spec.js index 4c8e163f5795..861c2e4248cc 100644 --- a/__snapshots__/packages-spec.js +++ b/__snapshots__/packages-spec.js @@ -15,18 +15,19 @@ exports['packages can copy files from package.json 1'] = { "tmp": { "packages": { "coffee": { - "package.json": "{\"main\":\"src/main.js\", \"name\": \"foo\", \"files\": [\"lib\"]}", + "lib": { + "foo.js": "{}" + }, "src": { "main.js": "console.log()" }, - "lib": { - "foo.js": "{}" - } + "package.json": "{\n \"main\": \"src/main.js\",\n \"name\": \"foo\",\n \"files\": [\n \"lib\"\n ]\n}\n" } } } } + exports['transformRequires can find and replace symlink requires 1'] = { "[cwd]": { "build": { diff --git a/__snapshots__/upload-spec.js b/__snapshots__/upload-spec.js index 320fbb9e6331..62eddbe04c0c 100644 --- a/__snapshots__/upload-spec.js +++ b/__snapshots__/upload-spec.js @@ -5,18 +5,12 @@ exports['test runner manifest'] = { "mac": { "url": "https://cdn.cypress.io/desktop/3.3.0/darwin-x64/cypress.zip" }, - "win": { - "url": "https://cdn.cypress.io/desktop/3.3.0/win32-ia32/cypress.zip" - }, "linux64": { "url": "https://cdn.cypress.io/desktop/3.3.0/linux-x64/cypress.zip" }, "darwin": { "url": "https://cdn.cypress.io/desktop/3.3.0/darwin-x64/cypress.zip" }, - "win32": { - "url": "https://cdn.cypress.io/desktop/3.3.0/win32-ia32/cypress.zip" - }, "linux": { "url": "https://cdn.cypress.io/desktop/3.3.0/linux-x64/cypress.zip" }, @@ -26,9 +20,6 @@ exports['test runner manifest'] = { "linux-x64": { "url": "https://cdn.cypress.io/desktop/3.3.0/linux-x64/cypress.zip" }, - "win32-ia32": { - "url": "https://cdn.cypress.io/desktop/3.3.0/win32-ia32/cypress.zip" - }, "win32-x64": { "url": "https://cdn.cypress.io/desktop/3.3.0/win32-x64/cypress.zip" } diff --git a/__snapshots__/util-upload-spec.js b/__snapshots__/util-upload-spec.js index f031bc0c1d99..8cd97721e743 100644 --- a/__snapshots__/util-upload-spec.js +++ b/__snapshots__/util-upload-spec.js @@ -9,10 +9,6 @@ exports['upload util isValidPlatformArch checks given strings second 1'] = { "given": "linux-x64", "expect": true }, - { - "given": "win32-ia32", - "expect": true - }, { "given": "win32-x64", "expect": true diff --git a/appveyor.yml b/appveyor.yml index 51c507ed81f5..9317953db9d6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,13 +2,14 @@ branches: only: - master - develop - - fix-test-other-projects + - windows-code-signing + - 9.0-release - /win*/ # https://www.appveyor.com/docs/lang/nodejs-iojs/ environment: # use matching version of Node.js - nodejs_version: "14.17.0" + nodejs_version: "16.5.0" # encode secure variables which will NOT be used # in pull requests # https://www.appveyor.com/docs/build-configuration/#secure-variables @@ -38,7 +39,6 @@ environment: platform: - x64 - - x86 # https://www.appveyor.com/docs/build-cache/ # hmm, seems there is NPM on windows problem diff --git a/browser-versions.json b/browser-versions.json index bf7bd2e449e1..ab27e988476c 100644 --- a/browser-versions.json +++ b/browser-versions.json @@ -1,4 +1,4 @@ { - "chrome:beta": "96.0.4664.27", - "chrome:stable": "95.0.4638.69" + "chrome:beta": "96.0.4664.45", + "chrome:stable": "96.0.4664.45" } diff --git a/circle.yml b/circle.yml index 039d9442f1be..2391d4c8ba43 100644 --- a/circle.yml +++ b/circle.yml @@ -44,7 +44,6 @@ onlyMainBranches: &onlyMainBranches only: - develop - 10.0-release - - tgriesser/chore/fix-release requires: - create-build-artifacts @@ -52,7 +51,7 @@ executors: # the Docker image with Cypress dependencies and Chrome browser cy-doc: docker: - - image: cypress/browsers:node14.17.0-chrome91-ff89 + - image: cypress/browsers:node16.5.0-chrome94-ff93 # by default, we use "small" to save on CI costs. bump on a per-job basis if needed. resource_class: small environment: @@ -61,7 +60,7 @@ executors: # Docker image with non-root "node" user non-root-docker-user: docker: - - image: cypress/browsers:node14.17.0-chrome91-ff89 + - image: cypress/browsers:node16.5.0-chrome94-ff93 user: node environment: PLATFORM: linux @@ -72,7 +71,7 @@ executors: mac: macos: # Executor should have Node >= required version - xcode: "12.2.0" + xcode: "13.0.0" environment: PLATFORM: mac @@ -271,27 +270,29 @@ commands: install-required-node: # https://discuss.circleci.com/t/switch-nodejs-version-on-machine-executor-solved/26675/2 - description: Install Node version matching .node-version + description: Install Node version + parameters: + version: + type: string + default: "" steps: - run: - name: Install NVM + name: Install NVM + Node # TODO: determine why we get the missing .nvmrc file error command: | - export NODE_VERSION=$(cat .node-version) + export NODE_VERSION=<> + export NODE_VERSION=${NODE_VERSION:-$(cat .node-version)} echo "Installing Node $NODE_VERSION" + echo $NODE_VERSION > .node-version cp .node-version .nvmrc curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh | bash - - run: - # https://github.com/nvm-sh/nvm#nvmrc - name: Install Node - command: | . ./scripts/load-nvm.sh echo "before nvm install" - nvm install + nvm install $NODE_VERSION echo "before nvm use" - nvm use + nvm use $NODE_VERSION echo "before nvm alias default" - nvm alias default + nvm alias default $NODE_VERSION node --version install-chrome: @@ -611,7 +612,7 @@ commands: working_directory: /tmp/<> # force installing the freshly built binary command: | - CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm i ~/cypress/cypress.tgz && [[ -f yarn.lock ]] && yarn + CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm i --legacy-peer-deps ~/cypress/cypress.tgz && [[ -f yarn.lock ]] && yarn - run: name: Print Cypress version working_directory: /tmp/<> @@ -732,7 +733,7 @@ commands: CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip yarn add -D ~/cypress/cypress.tgz else npm install - CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm install ~/cypress/cypress.tgz + CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm install --legacy-peer-deps ~/cypress/cypress.tgz fi working_directory: /tmp/<> - run: @@ -894,7 +895,7 @@ commands: paths: - cypress/binary-url.json - build-npm-package: + build-cypress-npm-package: steps: - run: name: bump NPM version @@ -913,13 +914,12 @@ commands: - run: name: pack NPM package working_directory: cli/build - command: yarn pack + command: yarn pack --filename cypress.tgz - run: name: list created NPM package working_directory: cli/build command: ls -l - # created file should have filename cypress-.tgz - - run: cp cli/build/cypress-v*.tgz cypress.tgz + - run: cp cli/build/cypress.tgz cypress.tgz - store-npm-logs - run: pwd - run: ls -l @@ -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: @@ -1585,20 +1587,27 @@ jobs: <<: *defaults steps: - restore_cached_workspace + - install-required-node: + version: "16.10" - run: - name: Build - command: yarn workspace @cypress/schematic build:all - - run: - name: Install @angular/cli - command: yarn add:angular-cli + name: Build + Install + command: | + . ../../scripts/load-nvm.sh + yarn workspace @cypress/schematic build:all + yarn policies set-version 1.19.0 + yarn add --dev @angular/cli working_directory: npm/cypress-schematic - run: name: Launch - command: yarn launch:test + command: | + . ../../scripts/load-nvm.sh + yarn launch:test working_directory: npm/cypress-schematic - run: name: Run unit tests - command: yarn test + command: | + . ../../scripts/load-nvm.sh + yarn test working_directory: npm/cypress-schematic - store-npm-logs @@ -1618,7 +1627,7 @@ jobs: steps: - restore_cached_workspace - build-binary - - build-npm-package + - build-cypress-npm-package - run: name: Check current branch to persist artifacts command: | @@ -1947,7 +1956,7 @@ jobs: name: Install Cypress working_directory: /tmp/cypress-test-tiny # force installing the freshly built binary - command: CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm i ~/cypress/cypress.tgz + command: CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm i --legacy-peer-deps ~/cypress/cypress.tgz - run: name: Run test project working_directory: /tmp/cypress-test-tiny @@ -2047,6 +2056,7 @@ jobs: repo: cypress-example-conduit-app browser: chrome command: "npm run cypress:run" + wait-on: http://localhost:3000 "test-binary-against-api-testing-firefox": <<: *defaults @@ -2329,7 +2339,6 @@ linux-workflow: &linux-workflow only: - develop - 10.0-release - - tgriesser/chore/fix-release requires: - build - test-kitchensink: @@ -2342,7 +2351,6 @@ linux-workflow: &linux-workflow only: - develop - 10.0-release - - tgriesser/chore/fix-release requires: - build - create-build-artifacts: @@ -2393,7 +2401,6 @@ linux-workflow: &linux-workflow only: - develop - 10.0-release - - tgriesser/chore/fix-release requires: - create-build-artifacts - test-npm-module-and-verify-binary: @@ -2402,7 +2409,6 @@ linux-workflow: &linux-workflow only: - develop - 10.0-release - - tgriesser/chore/fix-release requires: - create-build-artifacts - test-binary-against-staging: @@ -2412,7 +2418,6 @@ linux-workflow: &linux-workflow only: - develop - 10.0-release - - tgriesser/chore/fix-release requires: - create-build-artifacts @@ -2438,7 +2443,6 @@ linux-workflow: &linux-workflow only: - develop - 10.0-release - - tgriesser/chore/fix-release requires: - create-build-artifacts @@ -2511,7 +2515,6 @@ mac-workflow: &mac-workflow only: - develop - 10.0-release - - tgriesser/chore/fix-release requires: - darwin-create-build-artifacts @@ -2524,7 +2527,6 @@ mac-workflow: &mac-workflow only: - develop - 10.0-release - - tgriesser/chore/fix-release requires: - darwin-create-build-artifacts diff --git a/cli/__snapshots__/download_spec.js b/cli/__snapshots__/download_spec.js index e5a519fa9e94..eb89d7910848 100644 --- a/cli/__snapshots__/download_spec.js +++ b/cli/__snapshots__/download_spec.js @@ -28,7 +28,7 @@ URL: https://download.cypress.io/desktop?platform=OS&arch=ARCH ---------- -Platform: darwin (Foo-OsVersion) +Platform: darwin-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` diff --git a/cli/__snapshots__/errors_spec.js b/cli/__snapshots__/errors_spec.js index ffab96079d30..e085d953df00 100644 --- a/cli/__snapshots__/errors_spec.js +++ b/cli/__snapshots__/errors_spec.js @@ -5,7 +5,7 @@ a solution ---------- -Platform: test platform (Foo-OsVersion) +Platform: test platform-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` @@ -22,7 +22,7 @@ If you are using Docker, we provide containers with all required dependencies in ---------- -Platform: test platform (Foo-OsVersion) +Platform: test platform-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` @@ -45,7 +45,7 @@ Please refer to the error above for more detail. ---------- -Platform: test platform (Foo-OsVersion) +Platform: test platform-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` @@ -69,7 +69,7 @@ Consider opening a new issue. ---------- -Platform: test platform (Foo-OsVersion) +Platform: test platform-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` @@ -84,6 +84,7 @@ exports['errors individual has the following errors 1'] = [ "incompatibleTestingTypeAndFlag", "invalidCacheDirectory", "invalidCypressEnv", + "invalidOS", "invalidRunProjectPath", "invalidSmokeTestDisplayError", "invalidTestingType", diff --git a/cli/__snapshots__/install_spec.js b/cli/__snapshots__/install_spec.js index d942db4c9c77..7d6add82dc1e 100644 --- a/cli/__snapshots__/install_spec.js +++ b/cli/__snapshots__/install_spec.js @@ -142,7 +142,7 @@ EACCES: permission denied, mkdir '/invalid' ---------- -Platform: darwin (Foo-OsVersion) +Platform: darwin-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` @@ -246,3 +246,14 @@ Installing Cypress (version: 1.2.3) - npm install --save-dev cypress ` + +exports['error when installing on unsupported os'] = ` +Error: The Cypress App could not be installed. Your machine does not meet the operating system requirements. + +https://on.cypress.io/guides/getting-started/installing-cypress#system-requirements + +---------- + +Platform: win32-ia32 + +` diff --git a/cli/__snapshots__/spawn_spec.js b/cli/__snapshots__/spawn_spec.js index 8b1b60f16621..797395f38fdc 100644 --- a/cli/__snapshots__/spawn_spec.js +++ b/cli/__snapshots__/spawn_spec.js @@ -30,6 +30,6 @@ Consider opening a new issue. ---------- -Platform: darwin (Foo-OsVersion) +Platform: darwin-x64 (Foo-OsVersion) Cypress Version: 0.0.0-development ` diff --git a/cli/__snapshots__/unzip_spec.js b/cli/__snapshots__/unzip_spec.js index b1fc34be5153..830187db819b 100644 --- a/cli/__snapshots__/unzip_spec.js +++ b/cli/__snapshots__/unzip_spec.js @@ -11,7 +11,7 @@ Error: end of central directory record signature not found ---------- -Platform: darwin (Foo-OsVersion) +Platform: darwin-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` diff --git a/cli/__snapshots__/verify_spec.js b/cli/__snapshots__/verify_spec.js index 61e43ed29aca..c77e8394f6ba 100644 --- a/cli/__snapshots__/verify_spec.js +++ b/cli/__snapshots__/verify_spec.js @@ -14,7 +14,7 @@ You can also try clearing the cache with 'cypress cache clear' and reinstalling. ---------- -Platform: darwin (Foo-OsVersion) +Platform: darwin-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` @@ -48,7 +48,7 @@ ENOENT: no such file or directory, stat '/custom/' ---------- -Platform: darwin (Foo-OsVersion) +Platform: darwin-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` @@ -89,7 +89,7 @@ https://on.cypress.io/not-installed-ci-error ---------- -Platform: darwin (Foo-OsVersion) +Platform: darwin-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` @@ -105,7 +105,7 @@ Cypress executable not found at: /cache/Cypress/1.2.3/Cypress.app/Contents/MacOS ---------- -Platform: darwin (Foo-OsVersion) +Platform: darwin-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` @@ -126,7 +126,7 @@ an error about dependencies ---------- -Platform: darwin (Foo-OsVersion) +Platform: darwin-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` @@ -144,7 +144,7 @@ Error: EPERM NOT PERMITTED ---------- -Platform: darwin (Foo-OsVersion) +Platform: darwin-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` @@ -166,7 +166,7 @@ some stderr ---------- -Platform: darwin (Foo-OsVersion) +Platform: darwin-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` @@ -188,7 +188,7 @@ some stderr ---------- -Platform: darwin (Foo-OsVersion) +Platform: darwin-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` @@ -210,7 +210,7 @@ some stdout ---------- -Platform: darwin (Foo-OsVersion) +Platform: darwin-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` @@ -232,7 +232,7 @@ ENOENT: no such file or directory, stat '/custom/' ---------- -Platform: linux (Foo-OsVersion) +Platform: linux-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` @@ -248,7 +248,7 @@ Cypress executable not found at: /cache/Cypress/1.2.3/Cypress.app/Contents/MacOS ---------- -Platform: darwin (Foo-OsVersion) +Platform: darwin-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` @@ -264,7 +264,7 @@ Cypress executable not found at: /cache/Cypress/1.2.3/Cypress.app/Contents/MacOS ---------- -Platform: darwin (Foo-OsVersion) +Platform: darwin-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` @@ -363,7 +363,7 @@ ENOENT: no such file or directory, stat '/custom/' ---------- -Platform: win32 (Foo-OsVersion) +Platform: win32-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` @@ -385,7 +385,7 @@ Error: test without xvfb ---------- -Platform: darwin (Foo-OsVersion) +Platform: darwin-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` @@ -412,6 +412,6 @@ Please refer to the error above for more detail. ---------- -Platform: linux (Foo-OsVersion) +Platform: linux-x64 (Foo-OsVersion) Cypress Version: 1.2.3 ` diff --git a/cli/lib/cli.js b/cli/lib/cli.js index e09b56061db6..5c608ae091a4 100644 --- a/cli/lib/cli.js +++ b/cli/lib/cli.js @@ -614,5 +614,6 @@ module.exports = { if (!module.parent) { logger.error('This CLI module should be required from another Node module') logger.error('and not executed directly') + process.exit(-1) } diff --git a/cli/lib/errors.js b/cli/lib/errors.js index 72b3cc45e29f..2530e231cf8b 100644 --- a/cli/lib/errors.js +++ b/cli/lib/errors.js @@ -38,6 +38,13 @@ const invalidRunProjectPath = { `, } +const invalidOS = { + description: 'The Cypress App could not be installed. Your machine does not meet the operating system requirements.', + solution: stripIndent` + + ${chalk.blue('https://on.cypress.io/guides/getting-started/installing-cypress#system-requirements')}`, +} + const failedDownload = { description: 'The Cypress App could not be downloaded.', solution: stripIndent` @@ -400,6 +407,7 @@ module.exports = { missingApp, notInstalledCI, missingDependency, + invalidOS, invalidSmokeTestDisplayError, versionMismatch, binaryNotExecutable, diff --git a/cli/lib/exec/spawn.js b/cli/lib/exec/spawn.js index 0ff615ee716b..d50fa4bc634a 100644 --- a/cli/lib/exec/spawn.js +++ b/cli/lib/exec/spawn.js @@ -81,7 +81,7 @@ module.exports = { args = [args] } - args = [...args, '--cwd', process.cwd()] + args = [...args, '--cwd', process.cwd(), '--userNodePath', process.execPath, '--userNodeVersion', process.versions.node] _.defaults(options, { dev: false, diff --git a/cli/lib/tasks/download.js b/cli/lib/tasks/download.js index 9fd55cf21da9..c7d60f9931ba 100644 --- a/cli/lib/tasks/download.js +++ b/cli/lib/tasks/download.js @@ -24,20 +24,6 @@ const getProxyForUrlWithNpmConfig = (url) => { null } -const getRealOsArch = () => { - // os.arch() returns the arch for which this node was compiled - // we want the operating system's arch instead: x64 or x86 - - const osArch = arch() - - if (osArch === 'x86') { - // match process.platform output - return 'ia32' - } - - return osArch -} - const getBaseUrl = () => { if (util.getEnv('CYPRESS_DOWNLOAD_MIRROR')) { let baseUrl = util.getEnv('CYPRESS_DOWNLOAD_MIRROR') @@ -77,9 +63,8 @@ const getCA = () => { const prepend = (urlPath) => { const endpoint = url.resolve(getBaseUrl(), urlPath) const platform = os.platform() - const arch = getRealOsArch() - return `${endpoint}?platform=${platform}&arch=${arch}` + return `${endpoint}?platform=${platform}&arch=${arch()}` } const getUrl = (version) => { diff --git a/cli/lib/tasks/install.js b/cli/lib/tasks/install.js index 5aaed0449799..0318619c92b7 100644 --- a/cli/lib/tasks/install.js +++ b/cli/lib/tasks/install.js @@ -38,6 +38,10 @@ const getNpmArgv = () => { const getVersionSpecifier = (startDir = path.resolve(__dirname, '../..')) => { const argv = getNpmArgv() + if ((process.env.npm_package_resolved || '').endsWith('cypress.tgz')) { + return process.env.npm_package_resolved + } + if (argv) { const tgz = _.find(argv, (t) => t.endsWith('cypress.tgz')) @@ -81,7 +85,7 @@ const getVersionSpecifier = (startDir = path.resolve(__dirname, '../..')) => { }) } -const betaNpmUrlRe = /^\/beta\/npm\/(?[0-9.]+)\/(?[^/]+)\/cypress\.tgz$/ +const betaNpmUrlRe = /^\/beta\/npm\/(?[0-9.]+)\/(?.+?)\/cypress\.tgz$/ // convert a prerelease NPM package .tgz URL to the corresponding binary .zip URL const getBinaryUrlFromPrereleaseNpmUrl = (npmUrl) => { @@ -216,6 +220,12 @@ const downloadAndUnzip = ({ version, installDir, downloadDir }) => { return Promise.resolve(tasks.run()) } +const validateOS = () => { + return util.getPlatformInfo().then((platformInfo) => { + return platformInfo.match(/(darwin|linux|win32)-x64/) + }) +} + const start = (options = {}) => { debug('installing with options %j', options) @@ -271,7 +281,14 @@ const start = (options = {}) => { const cacheDir = state.getCacheDir() const binaryDir = state.getBinaryDir(pkgVersion) - return fs.ensureDirAsync(cacheDir) + return validateOS().then((isValid) => { + if (!isValid) { + return throwFormErrorText(errors.invalidOS)() + } + }) + .then(() => { + return fs.ensureDirAsync(cacheDir) + }) .catch({ code: 'EACCES' }, (err) => { return throwFormErrorText(errors.invalidCacheDirectory)(stripIndent` Failed to access ${chalk.cyan(cacheDir)}: diff --git a/cli/lib/util.js b/cli/lib/util.js index 6db85b2a3ad6..e0c537efe824 100644 --- a/cli/lib/util.js +++ b/cli/lib/util.js @@ -1,4 +1,5 @@ const _ = require('lodash') +const arch = require('arch') const os = require('os') const ospath = require('ospath') const crypto = require('crypto') @@ -437,8 +438,14 @@ const util = { getPlatformInfo () { return util.getOsVersionAsync().then((version) => { + let osArch = arch() + + if (osArch === 'x86') { + osArch = 'ia32' + } + return stripIndent` - Platform: ${os.platform()} (${version}) + Platform: ${os.platform()}-${osArch} (${version}) Cypress Version: ${util.pkgVersion()} ` }) diff --git a/cli/package.json b/cli/package.json index dccb14bb48fa..9f4dc31acce4 100644 --- a/cli/package.json +++ b/cli/package.json @@ -4,6 +4,7 @@ "private": true, "main": "index.js", "scripts": { + "clean": "node ./scripts/clean.js", "prebuild": "yarn postinstall && node ./scripts/start-build.js", "build": "node ./scripts/build.js", "dtslint": "dtslint types", @@ -20,14 +21,14 @@ "unit": "cross-env BLUEBIRD_DEBUG=1 NODE_ENV=test mocha --reporter mocha-multi-reporters --reporter-options configFile=../mocha-reporter-config.json" }, "dependencies": { - "@cypress/request": "^2.88.6", + "@cypress/request": "^2.88.7", "@cypress/xvfb": "^1.2.4", "@types/node": "^14.14.31", "@types/sinonjs__fake-timers": "^6.0.2", "@types/sizzle": "^2.3.2", "arch": "^2.2.0", "blob-util": "^2.0.2", - "bluebird": "^3.7.2", + "bluebird": "3.7.2", "cachedir": "^2.3.0", "chalk": "^4.1.0", "check-more-types": "^2.24.0", @@ -85,7 +86,7 @@ "execa-wrap": "1.4.0", "hasha": "5.2.2", "mocha": "6.2.2", - "mock-fs": "4.13.0", + "mock-fs": "5.1.1", "mocked-env": "1.3.2", "nock": "13.0.7", "postinstall-postinstall": "2.1.0", diff --git a/cli/schema/cypress.schema.json b/cli/schema/cypress.schema.json index b204cf285736..cb7d01f7aef4 100644 --- a/cli/schema/cypress.schema.json +++ b/cli/schema/cypress.schema.json @@ -7,6 +7,7 @@ "properties": { "baseUrl": { "type": "string", + "default": null, "description": "Url used as prefix for cy.visit() or cy.request() commandโ€™s url. Example http://localhost:3030 or https://test.my-domain.com" }, "env": { @@ -244,8 +245,8 @@ "system", "bundled" ], - "default": "bundled", - "description": "If set to 'system', Cypress will try to find a Node.js executable on your path to use when executing your plugins. Otherwise, Cypress will use the Node version bundled with Cypress." + "default": "system", + "description": "DEPRECATED: If set to 'bundled', Cypress will use the Node version bundled with Cypress. Otherwise, Cypress will use the Node version that was used to launch the Cypress. This Node version is used when executing your plugins file and building spec files." }, "experimentalInteractiveRunEvents": { "type": "boolean", diff --git a/cli/scripts/clean.js b/cli/scripts/clean.js new file mode 100644 index 000000000000..34eac3ffd710 --- /dev/null +++ b/cli/scripts/clean.js @@ -0,0 +1,8 @@ +const shelljs = require('shelljs') +const { includeTypes } = require('./utils') + +shelljs.rm('-rf', 'build') + +includeTypes.map((m) => { + shelljs.rm('-rf', `types/${m}`) +}) diff --git a/cli/scripts/post-install.js b/cli/scripts/post-install.js index 8439892c633c..1cf84c349552 100644 --- a/cli/scripts/post-install.js +++ b/cli/scripts/post-install.js @@ -89,7 +89,9 @@ filesToUncomment.forEach((file) => { const filePath = join(__dirname, '../types', file) const str = fs.readFileSync(filePath).toString() - const result = str.split('\n').map((line) => line.substring(3)).join('\n') + const result = str.split('\n').map((line) => { + return line.startsWith('// ') ? line.substring(3) : line + }).join('\n') fs.writeFileSync(filePath, result) }) diff --git a/cli/test/lib/exec/spawn_spec.js b/cli/test/lib/exec/spawn_spec.js index 5ccf7a6ceb2c..fe58325145c4 100644 --- a/cli/test/lib/exec/spawn_spec.js +++ b/cli/test/lib/exec/spawn_spec.js @@ -18,6 +18,8 @@ const expect = require('chai').expect const snapshot = require('../../support/snapshot') const cwd = process.cwd() +const execPath = process.execPath +const nodeVersion = process.versions.node const defaultBinaryDir = '/default/binary/dir' @@ -98,6 +100,10 @@ describe('lib/exec/spawn', function () { '--foo', '--cwd', cwd, + '--userNodePath', + execPath, + '--userNodeVersion', + nodeVersion, ], { detached: false, stdio: ['inherit', 'inherit', 'pipe'], @@ -122,6 +128,10 @@ describe('lib/exec/spawn', function () { '--foo', '--cwd', cwd, + '--userNodePath', + execPath, + '--userNodeVersion', + nodeVersion, ] expect(args).to.deep.equal(['/path/to/cypress', expectedCliArgs]) @@ -142,6 +152,10 @@ describe('lib/exec/spawn', function () { '--foo', '--cwd', cwd, + '--userNodePath', + execPath, + '--userNodeVersion', + nodeVersion, ], { detached: false, stdio: ['inherit', 'inherit', 'pipe'], @@ -163,6 +177,10 @@ describe('lib/exec/spawn', function () { '--foo', '--cwd', cwd, + '--userNodePath', + execPath, + '--userNodeVersion', + nodeVersion, ], { detached: false, stdio: ['inherit', 'inherit', 'pipe'], diff --git a/cli/test/lib/tasks/install_spec.js b/cli/test/lib/tasks/install_spec.js index 17498088f7a3..f8a7d9f66e4f 100644 --- a/cli/test/lib/tasks/install_spec.js +++ b/cli/test/lib/tasks/install_spec.js @@ -45,7 +45,6 @@ describe('/lib/tasks/install', function () { beforeEach(function () { logger.reset() - // sinon.stub(os, 'tmpdir').returns('/tmp') sinon.stub(util, 'isCi').returns(false) sinon.stub(util, 'isPostInstall').returns(false) sinon.stub(util, 'pkgVersion').returns(packageVersion) @@ -442,6 +441,23 @@ describe('/lib/tasks/install', function () { ) }) }) + + it('exits with error when installing on unsupported os', function () { + sinon.stub(util, 'getPlatformInfo').resolves('Platform: win32-ia32') + + return install.start() + .then(() => { + throw new Error('should have caught error') + }) + .catch((err) => { + logger.error(err) + + snapshot( + 'error when installing on unsupported os', + normalize(this.stdout.toString()), + ) + }) + }) }) context('._getBinaryUrlFromPrereleaseNpmUrl', function () { @@ -456,6 +472,9 @@ describe('/lib/tasks/install', function () { expect(install._getBinaryUrlFromPrereleaseNpmUrl('https://cdn.cypress.io/beta/npm/5.1.1/circle-develop-3fdfc3b453eb38ad3c0b079531e4dde6668e3dd0-436710/cypress.tgz')) .to.eq('https://cdn.cypress.io/beta/binary/5.1.1/linux-x64/circle-develop-3fdfc3b453eb38ad3c0b079531e4dde6668e3dd0-436710/cypress.zip') + + expect(install._getBinaryUrlFromPrereleaseNpmUrl('https://cdn.cypress.io/beta/npm/5.1.1/circle-develop/some/branch-3fdfc3b453eb38ad3c0b079531e4dde6668e3dd0-436710/cypress.tgz')) + .to.eq('https://cdn.cypress.io/beta/binary/5.1.1/linux-x64/circle-develop/some/branch-3fdfc3b453eb38ad3c0b079531e4dde6668e3dd0-436710/cypress.zip') }) it('returns nothing for an invalid url', function () { @@ -486,6 +505,14 @@ describe('/lib/tasks/install', function () { expect(await install._getVersionSpecifier('/foo/bar/baz')).to.eq('https://foo.com/cypress.tgz') }) + it('resolves with cypress.tgz URL if specified in npm env npm_package_resolved', async function () { + restoreEnv = mockedEnv({ + npm_package_resolved: 'https://foo.com/cypress.tgz', + }) + + expect(await install._getVersionSpecifier('/foo/bar/baz')).to.eq('https://foo.com/cypress.tgz') + }) + it('resolves with versionSpecifier from parent pkg.json', async function () { fs.readJSON.withArgs('/foo/bar/baz/package.json').resolves({ dependencies: { diff --git a/cli/test/lib/util_spec.js b/cli/test/lib/util_spec.js index 98b00b4e4f2e..b325ccab31a0 100644 --- a/cli/test/lib/util_spec.js +++ b/cli/test/lib/util_spec.js @@ -30,7 +30,7 @@ describe('util', () => { }) context('.getGitHubIssueUrl', () => { - it('returls url for issue number', () => { + it('returns url for issue number', () => { const url = util.getGitHubIssueUrl(4034) expect(url).to.equal('https://github.com/cypress-io/cypress/issues/4034') diff --git a/cli/test/support/normalize.js b/cli/test/support/normalize.js index 777f7ccfc107..f04ae809f498 100644 --- a/cli/test/support/normalize.js +++ b/cli/test/support/normalize.js @@ -2,7 +2,7 @@ const stripAnsi = require('strip-ansi') const whitespaceAtEndOfLineRe = /\s+$/g const datesRe = /(\d+:\d+:\d+)/g -const downloadQueryRe = /(\?platform=(darwin|linux|win32)&arch=(x64|ia32))/ +const downloadQueryRe = /(\?platform=(darwin|linux|win32)&arch=x64)/ const removeExcessWhiteSpace = (str) => { return str.replace(whitespaceAtEndOfLineRe, '') diff --git a/cli/types/cypress.d.ts b/cli/types/cypress.d.ts index b33d3cb448a3..ef5d7c3f4d4f 100644 --- a/cli/types/cypress.d.ts +++ b/cli/types/cypress.d.ts @@ -280,7 +280,7 @@ declare namespace Cypress { * Currently executing test runnable instance. */ currentTest: { - title: string, + title: string titlePath: string[] } @@ -420,9 +420,9 @@ declare namespace Cypress { * @see https://on.cypress.io/api/commands */ Commands: { - add(name: string, fn: (...args: any[]) => CanReturnChainable): void - add(name: string, options: CommandOptions, fn: (...args: any[]) => CanReturnChainable): void - overwrite(name: string, fn: (...args: any[]) => CanReturnChainable): void + add(name: T, fn: Chainable[T]): void + add(name: T, options: CommandOptions, fn: Chainable[T]): void + overwrite(name: T, fn: Chainable[T]): void } /** diff --git a/cli/types/tests/cypress-tests.ts b/cli/types/tests/cypress-tests.ts index 1c5643af3e92..6554513c69f7 100644 --- a/cli/types/tests/cypress-tests.ts +++ b/cli/types/tests/cypress-tests.ts @@ -62,17 +62,31 @@ namespace CypressIsCyTests { }) } +declare namespace Cypress { + interface Chainable { + newCommand: (arg: string) => void + } +} + namespace CypressCommandsTests { - Cypress.Commands.add('newCommand', () => { + Cypress.Commands.add('newCommand', (arg) => { + // $ExpectType string + arg return }) - Cypress.Commands.add('newCommand', { prevSubject: true }, () => { + Cypress.Commands.add('newCommand', { prevSubject: true }, (arg) => { + // $ExpectType string + arg return }) - Cypress.Commands.add('newCommand', () => { + Cypress.Commands.add('newCommand', (arg) => { + // $ExpectType string + arg return new Promise((resolve) => {}) }) - Cypress.Commands.overwrite('newCommand', () => { + Cypress.Commands.overwrite('newCommand', (arg) => { + // $ExpectType string + arg return }) } diff --git a/electron-builder.json b/electron-builder.json index c27885731b26..bfe10a1acac0 100644 --- a/electron-builder.json +++ b/electron-builder.json @@ -9,19 +9,7 @@ "hardenedRuntime": true, "entitlements": "./scripts/entitlements.mac.inherit.plist", "entitlementsInherit": "./scripts/entitlements.mac.inherit.plist", - "type": "distribution", - "binaries": [ - "./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/babel-plugin-add-module-exports/node_modules/fsevents/build/Release/.node", - "./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/babel-plugin-add-module-exports/node_modules/fsevents/build/Release/fse.node", - "./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/@ffmpeg-installer/darwin-x64/ffmpeg", - "./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/watchpack-chokidar2/node_modules/fsevents/build/Release/.node", - "./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/watchpack-chokidar2/node_modules/fsevents/build/Release/fse.node", - "./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/registry-js/build/Release/registry.node", - "./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/term-size/vendor/macos/term-size", - "./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/trash/lib/macos-trash", - "./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/fsevents/fsevents.node", - "./build/mac/Cypress.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Helpers/chrome_crashpad_handler" - ] + "type": "distribution" }, "linux": { "target": "dir", diff --git a/npm/angular/cypress.config.ts b/npm/angular/cypress.config.ts index b445b0ffa2d6..69e14d50a43d 100644 --- a/npm/angular/cypress.config.ts +++ b/npm/angular/cypress.config.ts @@ -10,5 +10,14 @@ export default defineConfig({ 'componentFolder': 'src/app', 'testFiles': '**/*cy-spec.ts', 'setupNodeEvents': require('./cypress/plugins'), + devServer (cypressConfig) { + const { startDevServer } = require('@cypress/webpack-dev-server') + const webpackConfig = require('./cypress/plugins/webpack.config') + + return startDevServer({ + options: cypressConfig, + webpackConfig, + }) + }, }, }) diff --git a/npm/angular/cypress/plugins/index.ts b/npm/angular/cypress/plugins/index.ts index 19515cec728b..703cf4278fe7 100644 --- a/npm/angular/cypress/plugins/index.ts +++ b/npm/angular/cypress/plugins/index.ts @@ -1,16 +1,7 @@ import { addMatchImageSnapshotPlugin } from 'cypress-image-snapshot/plugin' -import * as webpackConfig from './webpack.config' module.exports = (on, config) => { addMatchImageSnapshotPlugin(on, config) - const { startDevServer } = require('@cypress/webpack-dev-server') - - on('dev-server:start', (options) => { - return startDevServer({ - options, - webpackConfig, - }) - }) require('@cypress/code-coverage/task')(on, config) diff --git a/npm/angular/package.json b/npm/angular/package.json index 56041a5c9eb0..5a94ec7c4204 100644 --- a/npm/angular/package.json +++ b/npm/angular/package.json @@ -17,7 +17,7 @@ }, "dependencies": { "@cypress/mount-utils": "0.0.0-development", - "debug": "4.3.2" + "debug": "^4.3.2" }, "devDependencies": { "@angular-devkit/build-angular": "0.1102.12", diff --git a/npm/create-cypress-tests/CHANGELOG.md b/npm/create-cypress-tests/CHANGELOG.md index ca5d9c1fd808..9adb34d696ef 100644 --- a/npm/create-cypress-tests/CHANGELOG.md +++ b/npm/create-cypress-tests/CHANGELOG.md @@ -1,3 +1,10 @@ +# [create-cypress-tests-v1.2.0](https://github.com/cypress-io/cypress/compare/create-cypress-tests-v1.1.3...create-cypress-tests-v1.2.0) (2021-11-10) + + +### Features + +* **deps:** update dependency electron to v15 ๐ŸŒŸ ([#18317](https://github.com/cypress-io/cypress/issues/18317)) ([3095d73](https://github.com/cypress-io/cypress/commit/3095d733e92527ffd67344c6899211e058ceefa3)) + # [create-cypress-tests-v1.1.3](https://github.com/cypress-io/cypress/compare/create-cypress-tests-v1.1.2...create-cypress-tests-v1.1.3) (2021-10-29) diff --git a/npm/create-cypress-tests/package.json b/npm/create-cypress-tests/package.json index 86e715cad9f6..1082bb51092a 100644 --- a/npm/create-cypress-tests/package.json +++ b/npm/create-cypress-tests/package.json @@ -17,7 +17,7 @@ "@babel/plugin-transform-typescript": "^7.2.0", "@babel/template": "^7.5.4", "@babel/types": "^7.5.0", - "bluebird": "^3.7.2", + "bluebird": "3.7.2", "chalk": "4.1.0", "cli-highlight": "2.1.10", "commander": "6.1.0", @@ -37,7 +37,7 @@ "@types/ora": "^3.2.0", "copy": "0.3.2", "mocha": "7.1.1", - "mock-fs": "4.13.0", + "mock-fs": "5.1.1", "shx": "0.3.3", "snap-shot-it": "7.9.3", "typescript": "^4.2.3" diff --git a/npm/cypress-schematic/CHANGELOG.md b/npm/cypress-schematic/CHANGELOG.md index f50756a22d84..0a88e0a7d917 100644 --- a/npm/cypress-schematic/CHANGELOG.md +++ b/npm/cypress-schematic/CHANGELOG.md @@ -1,3 +1,10 @@ +# [@cypress/schematic-v1.6.0](https://github.com/cypress-io/cypress/compare/@cypress/schematic-v1.5.3...@cypress/schematic-v1.6.0) (2021-11-10) + + +### Features + +* **deps:** update dependency electron to v15 ๐ŸŒŸ ([#18317](https://github.com/cypress-io/cypress/issues/18317)) ([3095d73](https://github.com/cypress-io/cypress/commit/3095d733e92527ffd67344c6899211e058ceefa3)) + # [@cypress/schematic-v1.5.3](https://github.com/cypress-io/cypress/compare/@cypress/schematic-v1.5.2...@cypress/schematic-v1.5.3) (2021-10-29) diff --git a/npm/cypress-schematic/package.json b/npm/cypress-schematic/package.json index fa053922be27..c89d7f184dd5 100644 --- a/npm/cypress-schematic/package.json +++ b/npm/cypress-schematic/package.json @@ -19,16 +19,15 @@ "unlink:sandbox": "cd sandbox && yarn unlink @cypress/schematic && cd .. && yarn unlink" }, "dependencies": { - "@angular-devkit/architect": "^0.1200.0", - "@angular-devkit/core": "^12.0.0", - "@angular-devkit/schematics": "^12.0.0", - "@schematics/angular": "^12.0.0", + "@angular-devkit/architect": "^0.1202.10", + "@angular-devkit/core": "^12.2.10", + "@angular-devkit/schematics": "^12.2.10", + "@schematics/angular": "^12.2.10", "jsonc-parser": "^3.0.0", "rxjs": "~6.6.0" }, "devDependencies": { - "@angular-devkit/schematics-cli": "^12.0.0", - "@angular/cli": "11.2.12", + "@angular-devkit/schematics-cli": "^12.2.10", "@types/chai-enzyme": "0.6.7", "@types/mocha": "8.0.3", "@types/node": "^12.11.1", diff --git a/npm/design-system/cypress.config.js b/npm/design-system/cypress.config.js index 9305503c4b39..ca69fe413ff6 100644 --- a/npm/design-system/cypress.config.js +++ b/npm/design-system/cypress.config.js @@ -14,12 +14,10 @@ module.exports = { componentFolder: 'src', fixturesFolder: false, component: { - setupNodeEvents (on, config) { + devServer (cypressConfig) { const { startDevServer } = require('@cypress/vite-dev-server') - on('dev-server:start', (options) => startDevServer({ options })) - - return config + return startDevServer({ options: cypressConfig }) }, }, } diff --git a/npm/eslint-plugin-dev/package.json b/npm/eslint-plugin-dev/package.json index 1d24393947df..2062cad77754 100644 --- a/npm/eslint-plugin-dev/package.json +++ b/npm/eslint-plugin-dev/package.json @@ -10,7 +10,7 @@ "test": "jest" }, "dependencies": { - "bluebird": "^3.5.5", + "bluebird": "3.5.5", "chalk": "^2.4.2", "eslint-rule-composer": "^0.3.0", "lodash": "^4.17.15", diff --git a/npm/react/CHANGELOG.md b/npm/react/CHANGELOG.md index 32c8ef992c0d..24ebf69f8b39 100644 --- a/npm/react/CHANGELOG.md +++ b/npm/react/CHANGELOG.md @@ -1,3 +1,10 @@ +# [@cypress/react-v5.10.3](https://github.com/cypress-io/cypress/compare/@cypress/react-v5.10.2...@cypress/react-v5.10.3) (2021-11-01) + + +### Bug Fixes + +* **@cypress/react:** throw if using Next.js swc-loader without nodeVersion=system ([#18686](https://github.com/cypress-io/cypress/issues/18686)) ([d274a5b](https://github.com/cypress-io/cypress/commit/d274a5b5d92323cb6a9c9d0af3e41bf40e679ac1)) + # [@cypress/react-v5.10.2](https://github.com/cypress-io/cypress/compare/@cypress/react-v5.10.1...@cypress/react-v5.10.2) (2021-10-29) diff --git a/npm/react/cypress.config.js b/npm/react/cypress.config.js index 45d6630bd586..e6c48059139c 100644 --- a/npm/react/cypress.config.js +++ b/npm/react/cypress.config.js @@ -15,7 +15,7 @@ module.exports = { ], 'experimentalFetchPolyfill': true, 'component': { - setupNodeEvents (on, config) { + devServer (cypressConfig, devServerConfig) { const { startDevServer } = require('@cypress/webpack-dev-server') const path = require('path') const babelConfig = require('./babel.config.js') @@ -73,11 +73,7 @@ module.exports = { }, } - on('dev-server:start', (options) => { - return startDevServer({ options, webpackConfig, disableLazyCompilation: false }) - }) - - return config + return startDevServer({ options: cypressConfig, disableLazyCompilation: false, webpackConfig }) }, }, } diff --git a/npm/react/examples/find-webpack/cypress.config.ts b/npm/react/examples/find-webpack/cypress.config.ts index c373fc2f894c..6d3c4bb3aeea 100644 --- a/npm/react/examples/find-webpack/cypress.config.ts +++ b/npm/react/examples/find-webpack/cypress.config.ts @@ -6,7 +6,7 @@ export default defineConfig({ 'component': { 'testFiles': '**/*.spec.{js,ts,jsx,tsx}', 'componentFolder': 'src', - setupNodeEvents (on, config) { + devServer (cypressConfig) { const findReactScriptsWebpackConfig = require('@cypress/react/plugins/react-scripts/findReactScriptsWebpackConfig') const { startDevServer } = require('@cypress/webpack-dev-server') const _ = require('lodash') @@ -14,17 +14,17 @@ export default defineConfig({ const map = _.map([4, 8], (n) => n * 2) console.log(map) - require('@cypress/code-coverage/task')(on, config) - const webpackConfig = findReactScriptsWebpackConfig(config) + const webpackConfig = findReactScriptsWebpackConfig(cypressConfig.config) const rules = webpackConfig.module.rules.find((rule) => !!rule.oneOf).oneOf const babelRule = rules.find((rule) => typeof rule.loader === 'string' && /babel-loader/.test(rule.loader)) typeof babelRule.options !== 'string' && babelRule.options.plugins.push(require.resolve('babel-plugin-istanbul')) - on('dev-server:start', (options) => { - return startDevServer({ options, webpackConfig }) - }) + return startDevServer({ options: cypressConfig, webpackConfig }) + }, + setupNodeEvents (on, config) { + require('@cypress/code-coverage/task')(on, config) // IMPORTANT to return the config object // with the any changed environment variables diff --git a/npm/react/examples/webpack-options/cypress.config.js b/npm/react/examples/webpack-options/cypress.config.js index 7cb6fd227250..2f184291aba7 100644 --- a/npm/react/examples/webpack-options/cypress.config.js +++ b/npm/react/examples/webpack-options/cypress.config.js @@ -5,7 +5,7 @@ module.exports = { 'viewportWidth': 500, 'viewportHeight': 500, 'component': { - setupNodeEvents (on, config) { + devServer (cypressConfig) { const path = require('path') const { startDevServer } = require('@cypress/webpack-dev-server') const babelConfig = require('./babel.config') @@ -34,10 +34,8 @@ module.exports = { } process.env.BABEL_ENV = 'test' // this is required to load commonjs babel plugin - on('dev-server:start', (options) => startDevServer({ options, webpackConfig })) - // if adding code coverage, important to return updated config - return config + return startDevServer({ options: cypressConfig, webpackConfig }) }, }, } diff --git a/npm/react/package.json b/npm/react/package.json index cefdf42304ba..fe9b0909bb53 100644 --- a/npm/react/package.json +++ b/npm/react/package.json @@ -21,7 +21,7 @@ }, "dependencies": { "@cypress/mount-utils": "0.0.0-development", - "debug": "4.3.2", + "debug": "^4.3.2", "find-webpack": "2.2.1", "find-yarn-workspace-root": "2.0.0" }, @@ -66,7 +66,7 @@ "date-fns": "2.13.0", "framer-motion": "2.6.13", "i18next": "19.7.0", - "lodash": "4.17.15", + "lodash": "^4.17.15", "mobx": "6.0.0", "mobx-react-lite": "3.0.0", "mocha-junit-reporter": "^2.0.0", diff --git a/npm/vite-dev-server/cypress.config.ts b/npm/vite-dev-server/cypress.config.ts index 0cfe9b4257f2..d315c4aab2e1 100644 --- a/npm/vite-dev-server/cypress.config.ts +++ b/npm/vite-dev-server/cypress.config.ts @@ -7,20 +7,16 @@ export default defineConfig({ 'testFiles': '**/*.spec.*', 'componentFolder': 'cypress/components', 'component': { - setupNodeEvents (on, config) { + devServer (cypressConfig) { const path = require('path') const { startDevServer } = require('./dist') - on('dev-server:start', async (options) => { - return startDevServer({ - options, - viteConfig: { - configFile: path.resolve(__dirname, 'vite.config.ts'), - }, - }) + return startDevServer({ + options: cypressConfig, + viteConfig: { + configFile: path.resolve(__dirname, 'vite.config.ts'), + }, }) - - return config }, }, }) diff --git a/npm/vite-dev-server/tsconfig.json b/npm/vite-dev-server/tsconfig.json index e194d3002e04..6fd8c3eeec59 100644 --- a/npm/vite-dev-server/tsconfig.json +++ b/npm/vite-dev-server/tsconfig.json @@ -1,14 +1,11 @@ { "compilerOptions": { /* Basic Options */ - "target": "ESNEXT" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */, + "target": "ES2019" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */, "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, "moduleResolution": "node", "skipLibCheck": true, - "lib": [ - "es2015", - "dom" - ] /* Specify library files to be included in the compilation: */, + "lib": ["es2019", "es2020.bigint", "es2020.string", "es2020.symbol.wellknown"] /* Specify library files to be included in the compilation: */, "allowJs": true /* Allow javascript files to be compiled. */, // "checkJs": true, /* Report errors in .js files. */ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ diff --git a/npm/vue/.npmrc b/npm/vue/.npmrc index 6778d0857e0d..ff1f40faed0b 100644 --- a/npm/vue/.npmrc +++ b/npm/vue/.npmrc @@ -1,4 +1,3 @@ -registry=http://registry.npmjs.org/ save-exact=true progress=false package-lock=true diff --git a/npm/vue/CHANGELOG.md b/npm/vue/CHANGELOG.md index dd9b8dd160cb..03c062c9e870 100644 --- a/npm/vue/CHANGELOG.md +++ b/npm/vue/CHANGELOG.md @@ -1,3 +1,10 @@ +# [@cypress/vue-v3.0.5](https://github.com/cypress-io/cypress/compare/@cypress/vue-v3.0.4...@cypress/vue-v3.0.5) (2021-11-10) + + +### Bug Fixes + +* remove outdated npm registry links ([#18727](https://github.com/cypress-io/cypress/issues/18727)) ([4ded6c9](https://github.com/cypress-io/cypress/commit/4ded6c9624134fe6203f5377d62d62809cd27cda)) + # [@cypress/vue-v3.0.4](https://github.com/cypress-io/cypress/compare/@cypress/vue-v3.0.3...@cypress/vue-v3.0.4) (2021-10-29) diff --git a/npm/vue/cypress.config.ts b/npm/vue/cypress.config.ts index cc8d4831aa75..8e8bb3b69cb2 100644 --- a/npm/vue/cypress.config.ts +++ b/npm/vue/cypress.config.ts @@ -9,7 +9,7 @@ export default defineConfig({ 'testFiles': '**/*spec.{js,ts,tsx}', 'experimentalFetchPolyfill': true, 'component': { - setupNodeEvents (on, config) { + devServer (cypressConfig) { const { startDevServer } = require('@cypress/webpack-dev-server') const webpackConfig = require('./webpack.config') @@ -22,8 +22,10 @@ export default defineConfig({ '@vue/compiler-core$': '@vue/compiler-core/dist/compiler-core.cjs.js', } + return startDevServer({ options: cypressConfig, webpackConfig }) + }, + setupNodeEvents (on, config) { require('@cypress/code-coverage/task')(on, config) - on('dev-server:start', (options) => startDevServer({ options, webpackConfig })) return config }, diff --git a/npm/vue/examples/code-coverage/cypress.config.js b/npm/vue/examples/code-coverage/cypress.config.js index 03ef54dacedd..ce8c5fdab743 100644 --- a/npm/vue/examples/code-coverage/cypress.config.js +++ b/npm/vue/examples/code-coverage/cypress.config.js @@ -4,17 +4,16 @@ module.exports = { 'testFiles': '**/*.spec.js', 'video': false, 'component': { - setupNodeEvents (on, config) { + devServer (cypressConfig) { const { startDevServer } = require('@cypress/webpack-dev-server') const webpackConfig = require('./webpack.config') - on('dev-server:start', (options) => { - return startDevServer({ - options, - webpackConfig, - }) + return startDevServer({ + options: cypressConfig, + webpackConfig, }) - + }, + setupNodeEvents (on, config) { require('@cypress/code-coverage/task')(on, config) return config diff --git a/npm/vue/examples/vue-cli/cypress.config.js b/npm/vue/examples/vue-cli/cypress.config.js index 14175e60c881..c2a7c127e7b4 100644 --- a/npm/vue/examples/vue-cli/cypress.config.js +++ b/npm/vue/examples/vue-cli/cypress.config.js @@ -4,29 +4,28 @@ module.exports = { 'testFiles': '**/*spec.js', 'componentFolder': 'src', 'component': { - setupNodeEvents (on, config) { + devServer (cypressConfig) { const { startDevServer } = require('@cypress/webpack-dev-server') const webpackConfig = require('@vue/cli-service/webpack.config') - on('dev-server:start', (options) => { - // HtmlPwaPlugin is coupled to a hook in HtmlWebpackPlugin - // that was deprecated after 3.x. We currently only support - // HtmlWebpackPlugin 4.x and 5.x. - // TODO: Figure out how to deal with 2 major versions old HtmlWebpackPlugin - // which is still in widespread usage. - const modifiedWebpackConfig = { - ...webpackConfig, - plugins: (webpackConfig.plugins || []).filter((x) => { - return x.constructor.name !== 'HtmlPwaPlugin' - }), - } + // HtmlPwaPlugin is coupled to a hook in HtmlWebpackPlugin + // that was deprecated after 3.x. We currently only support + // HtmlWebpackPlugin 4.x and 5.x. + // TODO: Figure out how to deal with 2 major versions old HtmlWebpackPlugin + // which is still in widespread usage. + const modifiedWebpackConfig = { + ...webpackConfig, + plugins: (webpackConfig.plugins || []).filter((x) => { + return x.constructor.name !== 'HtmlPwaPlugin' + }), + } - return startDevServer({ - options, - webpackConfig: modifiedWebpackConfig, - }) + return startDevServer({ + options: cypressConfig, + webpackConfig: modifiedWebpackConfig, }) - + }, + setupNodeEvents (on, config) { require('@cypress/code-coverage/task')(on, config) return config diff --git a/npm/vue/package.json b/npm/vue/package.json index e609046a4664..276897eaa3ae 100644 --- a/npm/vue/package.json +++ b/npm/vue/package.json @@ -37,7 +37,7 @@ "babel-preset-typescript-vue3": "^2.0.14", "css-loader": "3.4.2", "cypress": "0.0.0-development", - "debug": "4.3.2", + "debug": "^4.3.2", "eslint-plugin-vue": "7.18.0", "find-webpack": "2.1.0", "mocha": "7.1.1", diff --git a/npm/webpack-dev-server/package.json b/npm/webpack-dev-server/package.json index 3bcd94d74888..0502303399c5 100644 --- a/npm/webpack-dev-server/package.json +++ b/npm/webpack-dev-server/package.json @@ -12,7 +12,7 @@ "watch": "tsc -w" }, "dependencies": { - "debug": "4.3.2", + "debug": "^4.3.2", "semver": "^7.3.4", "webpack-merge": "^5.4.0" }, diff --git a/npm/webpack-preprocessor/.npmrc b/npm/webpack-preprocessor/.npmrc index bb3a5b488e24..204407ec9f22 100644 --- a/npm/webpack-preprocessor/.npmrc +++ b/npm/webpack-preprocessor/.npmrc @@ -1,4 +1,3 @@ -registry=http://registry.npmjs.org/ save-exact=true progress=false package-lock=false diff --git a/npm/webpack-preprocessor/CHANGELOG.md b/npm/webpack-preprocessor/CHANGELOG.md index aa5c3186b61e..edfc4dc8faa5 100644 --- a/npm/webpack-preprocessor/CHANGELOG.md +++ b/npm/webpack-preprocessor/CHANGELOG.md @@ -1,3 +1,15 @@ +# [@cypress/webpack-preprocessor-v5.10.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-preprocessor-v5.9.1...@cypress/webpack-preprocessor-v5.10.0) (2021-11-10) + + +### Bug Fixes + +* remove outdated npm registry links ([#18727](https://github.com/cypress-io/cypress/issues/18727)) ([4ded6c9](https://github.com/cypress-io/cypress/commit/4ded6c9624134fe6203f5377d62d62809cd27cda)) + + +### Features + +* **deps:** update dependency electron to v15 ๐ŸŒŸ ([#18317](https://github.com/cypress-io/cypress/issues/18317)) ([3095d73](https://github.com/cypress-io/cypress/commit/3095d733e92527ffd67344c6899211e058ceefa3)) + # [@cypress/webpack-preprocessor-v5.9.1](https://github.com/cypress-io/cypress/compare/@cypress/webpack-preprocessor-v5.9.0...@cypress/webpack-preprocessor-v5.9.1) (2021-06-24) diff --git a/npm/webpack-preprocessor/package.json b/npm/webpack-preprocessor/package.json index e82b534fb233..493d61f5ec50 100644 --- a/npm/webpack-preprocessor/package.json +++ b/npm/webpack-preprocessor/package.json @@ -20,8 +20,8 @@ "watch": "yarn build --watch" }, "dependencies": { - "bluebird": "^3.7.1", - "debug": "4.3.2", + "bluebird": "3.7.1", + "debug": "^4.3.2", "lodash": "^4.17.20" }, "devDependencies": { @@ -29,6 +29,7 @@ "@babel/plugin-proposal-nullish-coalescing-operator": "7.8.3", "@babel/preset-env": "^7.0.0", "@fellow/eslint-plugin-coffee": "0.4.13", + "@types/mocha": "9.0.0", "@types/webpack": "^4.41.12", "@typescript-eslint/eslint-plugin": "^4.18.0", "@typescript-eslint/parser": "^4.18.0", diff --git a/npm/webpack-preprocessor/test/unit/index.spec.js b/npm/webpack-preprocessor/test/unit/index.spec.js index ceae0032754f..51a85406e4da 100644 --- a/npm/webpack-preprocessor/test/unit/index.spec.js +++ b/npm/webpack-preprocessor/test/unit/index.spec.js @@ -353,7 +353,7 @@ describe('webpack preprocessor', function () { return true }, toJson () { - return { errors: errs } + return { warnings: [], errors: errs } }, } diff --git a/package.json b/package.json index 200c6afc2b6b..da352b5e7e54 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "bump": "node ./scripts/binary.js bump", "check-node-version": "node scripts/check-node-version.js", "check-terminal": "node scripts/check-terminal.js", - "clean": "lerna run clean --parallel", + "clean": "lerna run clean --parallel --no-bail", "check-ts": "gulp checkTs", "clean-deps": "find . -depth -name node_modules -type d -exec rm -rf {} \\;", "clean-untracked-files": "git clean -d -f", @@ -40,7 +40,7 @@ "effective:circle:config": "circleci config process circle.yml | sed /^#/d", "ensure-deps": "./scripts/ensure-dependencies.sh", "get-next-version": "node scripts/get-next-version.js", - "postinstall": "yarn-deduplicate --strategy=highest && patch-package && gulp postinstall && ./scripts/run-if-not-ci.sh yarn build", + "postinstall": "patch-package && ./scripts/run-if-not-ci.sh yarn-deduplicate --strategy=highest && yarn clean && gulp postinstall && ./scripts/run-if-not-ci.sh yarn build", "jscodeshift": "jscodeshift -t ./node_modules/js-codemod/transforms/arrow-function-arguments.js", "lint": "eslint --ext .js,.jsx,.ts,.tsx,.json,.vue .", "lint-changed": "lint-changed", @@ -51,7 +51,7 @@ "stop-only": "npx stop-only --skip .cy,.publish,.projects,node_modules,dist,dist-test,fixtures,lib,bower_components,src,__snapshots__ --exclude e2e.ts,cypress-tests.ts", "stop-only-all": "yarn stop-only --folder packages", "pretest": "yarn ensure-deps", - "test": "yarn lerna exec yarn test --scope cypress --scope \"'@packages/{electron,extension,https-proxy,launcher,net-stubbing,network,proxy,rewriter,runner,runner-shared,socket}'\"", + "test": "yarn lerna exec yarn test --scope cypress --scope \"'@packages/{config,electron,extension,https-proxy,launcher,net-stubbing,network,proxy,rewriter,runner,runner-shared,socket}'\"", "test-debug": "lerna exec yarn test-debug --ignore \"'@packages/{desktop-gui,driver,root,static,web-config}'\"", "pretest-e2e": "yarn ensure-deps", "test-integration": "lerna exec yarn test-integration --ignore \"'@packages/{desktop-gui,driver,root,static,web-config}'\"", @@ -78,7 +78,7 @@ "@cypress/env-or-json-file": "2.0.0", "@cypress/github-commit-status-check": "1.5.0", "@cypress/questions-remain": "1.0.1", - "@cypress/request": "2.88.6", + "@cypress/request": "2.88.7", "@cypress/request-promise": "4.2.6", "@fellow/eslint-plugin-coffee": "0.4.13", "@graphql-codegen/add": "3.1.0", @@ -107,7 +107,7 @@ "@types/getenv": "^1.0.0", "@types/glob": "7.1.1", "@types/gulp": "^4.0.9", - "@types/lodash": "4.14.168", + "@types/lodash": "^4.14.168", "@types/markdown-it": "0.0.9", "@types/mini-css-extract-plugin": "1.2.3", "@types/mocha": "8.0.3", @@ -140,12 +140,12 @@ "commander": "6.2.1", "common-tags": "1.8.0", "conventional-recommended-bump": "6.1.0", - "debug": "4.3.2", + "debug": "^4.3.2", "dedent": "^0.7.0", "del": "3.0.0", "detect-port": "^1.3.0", - "electron-builder": "22.9.1", - "electron-notarize": "1.0.0", + "electron-builder": "^22.13.1", + "electron-notarize": "^1.1.1", "enzyme-adapter-react-16": "1.12.1", "eslint": "7.22.0", "eslint-plugin-cypress": "2.11.2", @@ -185,14 +185,14 @@ "lerna": "3.20.2", "lint-staged": "11.1.2", "listr2": "3.8.3", - "lodash": "4.17.21", + "lodash": "^4.17.21", "make-empty-github-commit": "cypress-io/make-empty-github-commit#4a592aedb776ba2f4cc88979055315a53eec42ee", "minimist": "1.2.5", "mocha": "3.5.3", "mocha-banner": "1.1.2", "mocha-junit-reporter": "2.0.0", "mocha-multi-reporters": "1.1.7", - "mock-fs": "4.9.0", + "mock-fs": "5.1.1", "p-defer": "^3.0.0", "parse-github-repo-url": "1.4.1", "patch-package": "6.4.7", @@ -220,11 +220,11 @@ "through2": "^4.0.2", "tree-kill": "1.2.2", "ts-node": "^10.2.1", - "typescript": "^4.2.3", + "typescript": "^4.4.4", "yarn-deduplicate": "3.1.0" }, "engines": { - "node": ">=14.17.0", + "node": ">=16.5.0", "yarn": ">=1.17.3" }, "productName": "Cypress", @@ -260,8 +260,6 @@ "system-tests" ], "nohoist": [ - "**/@ffmpeg-installer", - "**/@ffmpeg-installer/**", "**/webpack-preprocessor/babel-loader", "**/webpack-batteries-included-preprocessor/ts-loader" ] diff --git a/packages/app/cypress.config.ts b/packages/app/cypress.config.ts index 3aad293d45fc..11f3cef11d55 100644 --- a/packages/app/cypress.config.ts +++ b/packages/app/cypress.config.ts @@ -20,28 +20,24 @@ export default defineConfig({ 'component': { 'testFiles': '**/*.{spec,cy}.{js,ts,tsx,jsx}', 'supportFile': 'cypress/component/support/index.ts', - setupNodeEvents (on, config) { + devServer (cypressConfig, devServerConfig) { const { startDevServer } = require('@cypress/vite-dev-server') - on('dev-server:start', async (options) => { - return startDevServer({ - options, - viteConfig: { - // TODO(tim): Figure out why this isn't being picked up - optimizeDeps: { - include: [ - '@headlessui/vue', - 'vue3-file-selector', - 'just-my-luck', - 'combine-properties', - 'faker', - ], - }, - }, - }) - }) - - return config + return startDevServer({ options: cypressConfig, ...devServerConfig }) + }, + devServerConfig: { + viteConfig: { + // TODO(tim): Figure out why this isn't being picked up + optimizeDeps: { + include: [ + '@headlessui/vue', + 'vue3-file-selector', + 'just-my-luck', + 'combine-properties', + 'faker', + ], + }, + }, }, }, 'e2e': { diff --git a/packages/app/cypress/e2e/integration/index.spec.ts b/packages/app/cypress/e2e/integration/index.spec.ts new file mode 100644 index 000000000000..e2143cbb0c15 --- /dev/null +++ b/packages/app/cypress/e2e/integration/index.spec.ts @@ -0,0 +1,21 @@ +describe('Index', () => { + beforeEach(() => { + cy.setupE2E('component-tests') + cy.initializeApp() + }) + + context('with no specs', () => { + beforeEach(() => { + cy.visitApp() + cy.withCtx((ctx, o) => { + ctx.actions.file.removeFileInProject('cypress/integration/integration-spec.js') + }) + }) + + it('shows "Create your first spec"', () => { + // after removing the default scaffolded spec, we should be prompted to create a first spec + cy.visitApp() + cy.contains('Create your first spec') + }) + }) +}) diff --git a/packages/app/src/pages/Index.vue b/packages/app/src/pages/Index.vue index d0f30ea2e7bb..8f5575edbfa3 100644 --- a/packages/app/src/pages/Index.vue +++ b/packages/app/src/pages/Index.vue @@ -1,7 +1,7 @@