Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cypress-io/cypress
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v10.0.1
Choose a base ref
...
head repository: cypress-io/cypress
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v10.0.2
Choose a head ref
  • 7 commits
  • 29 files changed
  • 7 contributors

Commits on Jun 2, 2022

  1. chore: enable runner to be rebuild with general watcher (#21664)

    Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
    AtofStryker and mjhenkes authored Jun 2, 2022
    3

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    9cdab56 View commit details
  2. fix: Change ffmpeg to post process at priority 20 (#21587)

    Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
    rrauenza and mjhenkes authored Jun 2, 2022
    3
    Copy the full SHA
    a0a64cc View commit details
  3. fix: #22038 support esm import for windows (#22042)

    * fix: #22038 better windows ESM interop
    
    * updates from @flotwig feedback
    tgriesser authored Jun 2, 2022
    3
    Copy the full SHA
    b83bdc2 View commit details
  4. 3
    Copy the full SHA
    e170d5d View commit details
  5. fix: sanitize internal vite plugins (#22055)

    * fix: sanitize internal vite plugins
    ZachJW34 authored Jun 2, 2022
    2
    Copy the full SHA
    3b5a245 View commit details
  6. fix: changes to correct typescript detection behavior (#22058)

    * fix: changes to correct typescript detection behavior, fixes #22034
    
    Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
    tgriesser and mjhenkes authored Jun 2, 2022
    3
    Copy the full SHA
    309c31f View commit details
  7. release 10.0.2 [skip ci]

    flotwig committed Jun 2, 2022
    Copy the full SHA
    9407d07 View commit details
Showing with 684 additions and 134 deletions.
  1. +7 −2 npm/vite-dev-server/package.json
  2. +3 −1 npm/vite-dev-server/src/plugins/inspect.ts
  3. +1 −1 npm/vite-dev-server/src/resolveConfig.ts
  4. +4 −0 npm/vite-dev-server/test/.mocharc.js
  5. +65 −0 npm/vite-dev-server/test/resolveConfig.spec.ts
  6. +12 −0 npm/vite-dev-server/test/test-helpers/scaffoldProject.ts
  7. +1 −1 package.json
  8. +3 −3 packages/data-context/src/data/ProjectLifecycleManager.ts
  9. +6 −0 packages/data-context/src/sources/ProjectDataSource.ts
  10. +127 −81 packages/data-context/test/unit/sources/ProjectDataSource.spec.ts
  11. +7 −0 packages/launchpad/cypress/e2e/scaffold-project.cy.ts
  12. +27 −7 packages/scaffold-config/src/detect.ts
  13. +3 −1 packages/scaffold-config/test/.mocharc.js
  14. +74 −12 packages/scaffold-config/test/unit/detect.spec.ts
  15. +5 −12 packages/server/lib/plugins/child/run_require_async_child.js
  16. +3 −1 packages/server/lib/video_capture.ts
  17. +2 −1 scripts/gulp/gulpfile.ts
  18. +9 −1 scripts/gulp/tasks/gulpWebpack.ts
  19. +0 −3 system-tests/__snapshots__/config_modules_spec.ts.js
  20. +1 −0 system-tests/projects/migration-dts-files-only/cypress.json
  21. 0 system-tests/projects/migration-dts-files-only/cypress/component/foo.spec.js
  22. 0 system-tests/projects/migration-dts-files-only/cypress/integration/foo.spec.js
  23. 0 system-tests/projects/migration-dts-files-only/cypress/plugins/index.js
  24. 0 system-tests/projects/migration-dts-files-only/cypress/support/index.d.ts
  25. 0 system-tests/projects/migration-dts-files-only/cypress/support/index.js
  26. +1 −0 system-tests/projects/migration-dts-files-only/tsconfig.json
  27. +8 −0 system-tests/projects/vite-inspect/package.json
  28. +315 −0 system-tests/projects/vite-inspect/yarn.lock
  29. +0 −7 system-tests/test/config_modules_spec.ts
9 changes: 7 additions & 2 deletions npm/vite-dev-server/package.json
Original file line number Diff line number Diff line change
@@ -11,8 +11,9 @@
"cypress:run": "yarn cypress:run-cypress-in-cypress node ../../scripts/cypress run --project . --browser chrome",
"cypress:run-cypress-in-cypress": "cross-env HTTP_PROXY_TARGET_FOR_ORIGIN_REQUESTS=http://localhost:4455 CYPRESS_REMOTE_DEBUGGING_PORT=6666 TZ=America/New_York",
"cypress:open": "yarn cypress:run-cypress-in-cypress gulp open --project .",
"test": "yarn cypress:run",
"watch": "tsc -w"
"watch": "tsc -w",
"test": "yarn test-unit",
"test-unit": "mocha -r ts-node/register/transpile-only --config ./test/.mocharc.js"
},
"dependencies": {
"debug": "4.3.3",
@@ -21,7 +22,11 @@
"pathe": "0.2.0"
},
"devDependencies": {
"chai": "^4.3.6",
"dedent": "^0.7.0",
"mocha": "^9.2.2",
"sinon": "^13.0.1",
"ts-node": "^10.2.1",
"vite": "2.9.0-beta.3",
"vite-plugin-inspect": "0.4.3"
},
4 changes: 3 additions & 1 deletion npm/vite-dev-server/src/plugins/inspect.ts
Original file line number Diff line number Diff line change
@@ -16,7 +16,9 @@ export const CypressInspect = (config: ViteDevServerConfig): PluginOption | null
try {
const inspectPluginPath = require.resolve('vite-plugin-inspect', { paths: [config.cypressConfig.projectRoot] })

Inspect = require(inspectPluginPath).default
const inspectModule = require(inspectPluginPath)

Inspect = inspectModule.default ?? inspectModule
debug('inspect was found', Inspect)
} catch (err) {
debug(`Tried to import the inspect plugin 'vite-plugin-inspect'. It's an optional peerDependency so install it if you'd like.`)
2 changes: 1 addition & 1 deletion npm/vite-dev-server/src/resolveConfig.ts
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ export const createViteDevServerConfig = async (config: ViteDevServerConfig, vit
plugins: [
Cypress(config, vite),
CypressInspect(config),
],
].filter((p) => p != null),
}

const finalConfig = vite.mergeConfig(viteBaseConfig, viteOverrides as Record<string, any>)
4 changes: 4 additions & 0 deletions npm/vite-dev-server/test/.mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
spec: 'test/**/*.spec.ts',
timeout: 10000,
}
65 changes: 65 additions & 0 deletions npm/vite-dev-server/test/resolveConfig.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { expect } from 'chai'
import { EventEmitter } from 'events'
import * as vite from 'vite'
import { scaffoldSystemTestProject } from './test-helpers/scaffoldProject'
import { createViteDevServerConfig } from '../src/resolveConfig'
import type { ViteDevServerConfig } from '../src/devServer'

const getViteDevServerConfig = (projectRoot: string) => {
return {
specs: [],
cypressConfig: {
projectRoot,
},
devServerEvents: new EventEmitter(),
onConfigNotFound: () => {},
framework: 'react',
viteConfig: {},
} as unknown as ViteDevServerConfig
}

describe('resolveConfig', function () {
this.timeout(1000 * 60)

context('inspect plugin', () => {
it('should not include inspect plugin by default', async () => {
const projectRoot = await scaffoldSystemTestProject('vite-inspect')
const viteDevServerConfig = getViteDevServerConfig(projectRoot)

const viteConfig = await createViteDevServerConfig(viteDevServerConfig, vite)

expect(viteConfig.plugins).to.have.lengthOf(1)
expect(viteConfig.plugins[0].name).to.equal('cypress:main')
})

context('with CYPRESS_INTERNAL_VITE_INSPECT provided', () => {
before(() => {
process.env.CYPRESS_INTERNAL_VITE_INSPECT = 'true'
})

after(() => {
process.env.CYPRESS_INTERNAL_VITE_INSPECT = undefined
})

it('should add inspect plugin', async () => {
const projectRoot = await scaffoldSystemTestProject('vite-inspect')
const viteDevServerConfig = getViteDevServerConfig(projectRoot)

const viteConfig = await createViteDevServerConfig(viteDevServerConfig, vite)

expect(viteConfig.plugins).to.have.lengthOf(2)
expect(viteConfig.plugins[1].name).to.equal('cypress:inspect')
})

it('should not add inspect plugin if not installed', async () => {
const projectRoot = await scaffoldSystemTestProject('vite2.9.1-react')
const viteDevServerConfig = getViteDevServerConfig(projectRoot)

const viteConfig = await createViteDevServerConfig(viteDevServerConfig, vite)

expect(viteConfig.plugins).to.have.lengthOf(1)
expect(viteConfig.plugins[0].name).to.equal('cypress:main')
})
})
})
})
12 changes: 12 additions & 0 deletions npm/vite-dev-server/test/test-helpers/scaffoldProject.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Fixtures, { ProjectFixtureDir } from '@tooling/system-tests'
import * as FixturesScaffold from '@tooling/system-tests/lib/dep-installer'

export async function scaffoldSystemTestProject (project: ProjectFixtureDir) {
Fixtures.removeProject(project)

await Fixtures.scaffoldProject(project)

await FixturesScaffold.scaffoldProjectNodeModules(project)

return Fixtures.projectPath(project)
}
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": "10.0.1",
"version": "10.0.2",
"description": "Cypress.io end to end testing tool",
"private": true,
"scripts": {
6 changes: 3 additions & 3 deletions packages/data-context/src/data/ProjectLifecycleManager.ts
Original file line number Diff line number Diff line change
@@ -619,13 +619,13 @@ export class ProjectLifecycleManager {
}

try {
const packageJson = this.ctx.fs.readJsonSync(this._pathToFile('package.json'))
const pkgJson = this.ctx.fs.readJsonSync(this._pathToFile('package.json'))

if (packageJson.type === 'module') {
if (pkgJson.type === 'module') {
metaState.isProjectUsingESModules = true
}

metaState.isUsingTypeScript = detectLanguage(this.projectRoot, packageJson) === 'ts'
metaState.isUsingTypeScript = detectLanguage({ projectRoot: this.projectRoot, pkgJson, isMigrating: metaState.hasLegacyCypressJson }) === 'ts'
} catch {
// No need to handle
}
6 changes: 6 additions & 0 deletions packages/data-context/src/sources/ProjectDataSource.ts
Original file line number Diff line number Diff line change
@@ -297,6 +297,12 @@ export class ProjectDataSource {
}: FindSpecs<string[]>) {
this.stopSpecWatcher()

// Early return the spec watcher if we're in run mode, we do not want to
// init a lot of files watchers that are unneeded
if (this.ctx.isRunMode) {
return
}

const currentProject = this.ctx.currentProject

if (!currentProject) {
Loading