Skip to content

Commit

Permalink
Merge branch 'master' into chore/vite-ts-strict
Browse files Browse the repository at this point in the history
  • Loading branch information
Barthélémy Ledoux authored Jul 29, 2021
2 parents 3be176d + a3f55d8 commit 63825df
Show file tree
Hide file tree
Showing 100 changed files with 2,597 additions and 828 deletions.
4 changes: 2 additions & 2 deletions browser-versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"chrome:beta": "92.0.4515.101",
"chrome:stable": "91.0.4472.164"
"chrome:beta": "92.0.4515.107",
"chrome:stable": "92.0.4515.107"
}
6 changes: 3 additions & 3 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1270,9 +1270,6 @@ jobs:
- run:
name: Build
command: yarn workspace @cypress/webpack-preprocessor build
- run:
name: Run tests
command: yarn workspace @cypress/webpack-preprocessor test
- run:
name: Test babelrc
command: yarn test
Expand All @@ -1298,6 +1295,9 @@ jobs:
name: Test React app
command: yarn test
working_directory: npm/webpack-preprocessor/examples/react-app
- run:
name: Run tests
command: yarn workspace @cypress/webpack-preprocessor test
- store-npm-logs

npm-webpack-dev-server:
Expand Down
6 changes: 4 additions & 2 deletions cli/NPM_README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Cypress

Fast, easy and reliable testing for anything that runs in a browser.

## What is this?

Cypress comes packaged as an `npm` module, which is all you need to get started.
[Cypress](https://www.cypress.io/) comes packaged as an `npm` module, which is all you need to get started testing.

After installing you'll be able to:

Expand All @@ -12,7 +14,7 @@ After installing you'll be able to:

## Install

Requires Node version >= 10.0.0
Please check our [system requirements](https://on.cypress.io/installing-cypress).

```sh
npm install --save-dev cypress
Expand Down
11 changes: 11 additions & 0 deletions cli/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,20 @@ const util = {
.mapValues((value) => { // stringify to 1 or 0
return value ? '1' : '0'
})
.extend(util.getOriginalNodeOptions(options))
.value()
},

getOriginalNodeOptions (options) {
if (process.env.NODE_OPTIONS) {
return {
ORIGINAL_NODE_OPTIONS: process.env.NODE_OPTIONS,
}
}

return {}
},

getForceTty () {
return {
FORCE_STDIN_TTY: util.isTty(process.stdin.fd),
Expand Down
22 changes: 22 additions & 0 deletions cli/test/lib/util_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ require('../spec_helper')
const os = require('os')
const tty = require('tty')
const snapshot = require('../support/snapshot')
const mockedEnv = require('mocked-env')
const supportsColor = require('supports-color')
const proxyquire = require('proxyquire')
const hasha = require('hasha')
Expand Down Expand Up @@ -254,6 +255,27 @@ describe('util', () => {
})
})

context('.getOriginalNodeOptions', () => {
let restoreEnv

afterEach(() => {
if (restoreEnv) {
restoreEnv()
restoreEnv = null
}
})

it('copy NODE_OPTIONS to ORIGINAL_NODE_OPTIONS', () => {
restoreEnv = mockedEnv({
NODE_OPTIONS: '--require foo.js',
})

expect(util.getOriginalNodeOptions({})).to.deep.eq({
ORIGINAL_NODE_OPTIONS: '--require foo.js',
})
})
})

context('.exit', () => {
it('calls process.exit', () => {
process.exit.withArgs(2).withArgs(0)
Expand Down
8 changes: 4 additions & 4 deletions cli/types/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@ declare namespace Cypress {
* .shadow()
* .find('.my-button')
* .click()
* @see https://on.cypress.io/experimental
* @see https://on.cypress.io/shadow
*/
shadow(): Chainable<Subject>

Expand Down Expand Up @@ -2717,13 +2717,13 @@ declare namespace Cypress {
* Override default config options for Component Testing runner.
* @default {}
*/
component: Omit<ResolvedConfigOptions, 'e2e' | 'component'>
component: Omit<ResolvedConfigOptions, TestingType>

/**
* Override default config options for E2E Testing runner.
* @default {}
*/
e2e: Omit<ResolvedConfigOptions, 'e2e' | 'component'>
e2e: Omit<ResolvedConfigOptions, TestingType>
}

/**
Expand Down Expand Up @@ -2809,7 +2809,7 @@ declare namespace Cypress {
/**
* All configuration items are optional.
*/
type CoreConfigOptions = Partial<Omit<ResolvedConfigOptions, 'e2e' | 'component'>>
type CoreConfigOptions = Partial<Omit<ResolvedConfigOptions, TestingType>>
type ConfigOptions = CoreConfigOptions & {e2e?: CoreConfigOptions, component?: CoreConfigOptions }

interface PluginConfigOptions extends ResolvedConfigOptions {
Expand Down
4 changes: 2 additions & 2 deletions npm/cypress-schematic/LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

MIT License

Original work Copyright (c) 2020 [BrieBug Software]
Original work Copyright (c) 2021 Briebug, Inc.
Modified work Copyright (c) 2021 Cypress.io

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand All @@ -20,4 +20,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
2 changes: 1 addition & 1 deletion npm/vite-dev-server/src/makeCypressPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const makeCypressPlugin = (
debug('handleHotUpdate - mod.file', mod.file)
if (mod.file && specsPathsSet.has(mod.file)) {
debug('handleHotUpdate - compile success')
devServerEvents.emit('dev-server:compile:success')
devServerEvents.emit('dev-server:compile:success', { specFile: mod.file })

return []
}
Expand Down
28 changes: 28 additions & 0 deletions npm/webpack-batteries-included-preprocessor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,28 @@ const addTypeScriptConfig = (file, options) => {
options.__typescriptSupportAdded = true
}

/**
* Config yarn pnp plugin for webpack 4
* @param {*} file file to be processed
* @param {*} options
*/
const addYarnPnpConfig = (file, options) => {
const { makeResolver } = require('pnp-webpack-plugin/resolver')
const findPnpApi = require('module').findPnpApi

if (findPnpApi && file.filePath) {
const pnpapi = findPnpApi(file.filePath)

if (pnpapi) {
const PnpPlugin = {
apply: makeResolver({ pnpapi }),
}

options.webpackOptions.resolve.plugins.push(PnpPlugin)
}
}
}

const getDefaultWebpackOptions = () => {
return {
mode: 'development',
Expand Down Expand Up @@ -125,6 +147,7 @@ const getDefaultWebpackOptions = () => {
'repl': require.resolve('./empty'),
'tls': require.resolve('./empty'),
},
plugins: [],
},
}
}
Expand All @@ -143,6 +166,11 @@ const preprocessor = (options = {}) => {
addTypeScriptConfig(file, options)
}

if (process.versions.pnp) {
// pnp path
addYarnPnpConfig(file, options)
}

return webpackPreprocessor(options)(file)
}
}
Expand Down
3 changes: 2 additions & 1 deletion npm/webpack-batteries-included-preprocessor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"babel-plugin-add-module-exports": "^1.0.2",
"coffee-loader": "^0.9.0",
"coffeescript": "^1.12.7",
"pnp-webpack-plugin": "^1.7.0",
"ts-loader": "^8.0.2",
"tsconfig-package": "npm:tsconfig@^7.0.0",
"tsconfig-paths-webpack-plugin": "^3.3.0",
Expand Down Expand Up @@ -65,4 +66,4 @@
"publishConfig": {
"access": "public"
}
}
}
4 changes: 2 additions & 2 deletions npm/webpack-preprocessor/__snapshots__/compilation.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
exports['webpack preprocessor - e2e correctly preprocesses the file 1'] = `
it("is a test",(function(){expect(1).to.equal(1),expect(2).to.equal(2),expect(Math.min.apply(Math,[3,4])).to.equal(3)}));
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9AY3lwcmVzcy93ZWJwYWNrLXByZXByb2Nlc3Nvci8uL3Rlc3QvX3Rlc3Qtb3V0cHV0L2V4YW1wbGVfc3BlYy5qcyJdLCJuYW1lcyI6WyJpdCIsImV4cGVjdCIsInRvIiwiZXF1YWwiLCJNYXRoIiwibWluIl0sIm1hcHBpbmdzIjoiQUFBQUEsR0FBRyxhQUFhLFdBR2R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FsKDMpXG59KVxuIl0sIm5hbWVzIjpbIml0IiwiZXhwZWN0IiwidG8iLCJlcXVhbCIsIk1hdGgiLCJtaW4iXSwic291cmNlUm9vdCI6IiJ9
`

exports['webpack preprocessor - e2e has less verbose syntax error 1'] = `
Expand All @@ -16,4 +16,4 @@ SyntaxError: <path>/_test-output/syntax_error_spec.js: Unexpected token (1:18)
exports['webpack preprocessor - e2e has less verbose "Module not found" error 1'] = `
Webpack Compilation Error
Module not found: Error: Can't resolve './does/not-exist' in '<path>/_test-output'
`
`
2 changes: 1 addition & 1 deletion npm/webpack-preprocessor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"secure": "nsp check",
"semantic-release": "semantic-release",
"size": "npm pack --dry",
"test": "node ./test-webpack-4-5.js",
"test": "node ./test-webpack-5.js",
"test-debug": "node --inspect --debug-brk ./node_modules/.bin/_mocha",
"test-e2e": "mocha test/e2e/*.spec.*",
"test-unit": "mocha test/unit/*.spec.*",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cypress",
"version": "8.0.0",
"version": "8.1.0",
"description": "Cypress.io end to end testing tool",
"private": true,
"scripts": {
Expand Down
10 changes: 10 additions & 0 deletions packages/desktop-gui/cypress/fixtures/specs_with_components.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@
"name": "admin_users/admin.user/foo_list_spec.coffee",
"absolute": "/user/project/cypress/integration/admin_users/admin.user/foo_list_spec.coffee",
"relative": "cypress/integration/admin_users/admin.user/foo_list_spec.coffee"
},
{
"name": "日本語_spec.coffee",
"absolute": "/user/project/cypress/integration/日本語_spec.coffee",
"relative": "cypress/integration/日本語_spec.coffee"
},
{
"name": "123_spec.coffee",
"absolute": "/user/project/cypress/integration/123_spec.coffee",
"relative": "cypress/integration/123_spec.coffee"
}
],
"component": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const onSubmitNewProject = function (orgId) {
.contains('.btn', 'Set up project').click()
.then(() => {
expect(this.ipc.setupDashboardProject).to.be.calledWith({
projectRoot: '/foo/bar',
projectName: this.config.projectName,
orgId,
public: false,
Expand All @@ -21,6 +22,7 @@ const onSubmitNewProject = function (orgId) {
.then(() => {
expect(this.ipc.setupDashboardProject).to.be.calledWith({
projectName: 'New Project',
projectRoot: '/foo/bar',
orgId,
public: true,
})
Expand Down Expand Up @@ -114,7 +116,7 @@ describe('Connect to Dashboard', function () {
cy.stub(this.ipc, 'getRecordKeys').resolves(this.keys)
cy.stub(this.ipc, 'pingApiServer').resolves()
cy.stub(this.ipc, 'externalOpen')
cy.stub(this.ipc, 'setProjectId').resolvesArg(0)
cy.stub(this.ipc, 'setProjectId').callsFake((arg) => Promise.resolve(arg.id))
cy.stub(this.ipc, 'beginAuth').resolves()

this.getCurrentUser = this.util.deferred()
Expand Down Expand Up @@ -485,7 +487,7 @@ describe('Connect to Dashboard', function () {
cy.get('.setup-project')
.contains('.btn', 'Set up project').click()
.then(() => {
expect(this.ipc.setProjectId).to.be.calledWith(this.dashboardProjects[1].id)
expect(this.ipc.setProjectId).to.be.calledWith({ id: this.dashboardProjects[1].id, projectRoot: '/foo/bar' })
})
})

Expand Down
Loading

0 comments on commit 63825df

Please sign in to comment.