Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into refactor-defaultBr…
Browse files Browse the repository at this point in the history
…owserOpts
  • Loading branch information
flotwig committed Aug 29, 2022
2 parents 9b8cfbe + 3c2fea2 commit a7f6d4b
Show file tree
Hide file tree
Showing 152 changed files with 16,999 additions and 3,428 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
// Volar is the main extension that powers Vue's language features.
// These are commented out because they slow down node development
// "volar.autoCompleteRefs": false,
"volar.takeOverMode.enabled": true,
"volar.takeOverMode.enabled": "auto",

"editor.tabSize": 2,
}
5 changes: 2 additions & 3 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ commands:
- run:
name: Check current branch to persist artifacts
command: |
if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "tbiethman/22272-globbing-working-dir" ]]; then
if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "tbiethman/23380-root-spec-pattern" ]]; then
echo "Not uploading artifacts or posting install comment for this branch."
circleci-agent step halt
fi
Expand Down Expand Up @@ -1831,7 +1831,6 @@ jobs:

npm-react:
<<: *defaults
parallelism: 8
steps:
- restore_cached_workspace
- run:
Expand Down Expand Up @@ -2320,7 +2319,7 @@ linux-x64-workflow: &linux-x64-workflow
requires:
- build
- percy-finalize:
context: test-runner:poll-circle-workflow
context: [test-runner:poll-circle-workflow, test-runner:percy]
required_env_var: PERCY_TOKEN # skips job if not defined (external PR)
requires:
- build
Expand Down
3 changes: 2 additions & 1 deletion cli/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ vue
vue2
react*
mount-utils
angular
angular
svelte
8 changes: 7 additions & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@
"react",
"vue2",
"react18",
"angular"
"angular",
"svelte"
],
"bin": {
"cypress": "bin/cypress"
Expand Down Expand Up @@ -155,6 +156,11 @@
"import": "./angular/dist/index.js",
"require": "./angular/dist/index.js",
"types": "./angular/dist/index.d.ts"
},
"./svelte": {
"import": "./svelte/dist/cypress-svelte.esm-bundler.js",
"require": "./svelte/dist/cypress-svelte.cjs.js",
"types": "./svelte/dist/index.d.ts"
}
},
"workspaces": {
Expand Down
1 change: 1 addition & 0 deletions cli/scripts/post-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const npmModulesToCopy = [
'vue',
'vue2',
'angular',
'svelte',
]

npmModulesToCopy.forEach((folder) => {
Expand Down
17 changes: 15 additions & 2 deletions cli/types/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3048,16 +3048,29 @@ declare namespace Cypress {

type PickConfigOpt<T> = T extends keyof DefineDevServerConfig ? DefineDevServerConfig[T] : any

interface AngularDevServerProjectConfig {
root: string,
sourceRoot: string,
buildOptions: Record<string, any>
}

type DevServerFn<ComponentDevServerOpts = any> = (cypressDevServerConfig: DevServerConfig, devServerConfig: ComponentDevServerOpts) => ResolvedDevServerConfig | Promise<ResolvedDevServerConfig>

type DevServerConfigOptions = {
bundler: 'webpack'
framework: 'react' | 'vue' | 'vue-cli' | 'nuxt' | 'create-react-app' | 'next' | 'angular'
framework: 'react' | 'vue' | 'vue-cli' | 'nuxt' | 'create-react-app' | 'next' | 'svelte'
webpackConfig?: PickConfigOpt<'webpackConfig'>
} | {
bundler: 'vite'
framework: 'react' | 'vue'
framework: 'react' | 'vue' | 'svelte'
viteConfig?: Omit<Exclude<PickConfigOpt<'viteConfig'>, undefined>, 'base' | 'root'>
} | {
bundler: 'webpack',
framework: 'angular',
webpackConfig?: PickConfigOpt<'webpackConfig'>,
options?: {
projectConfig: AngularDevServerProjectConfig
}
}

interface ComponentConfigOptions<ComponentDevServerOpts = any> extends Omit<CoreConfigOptions, 'baseUrl' | 'experimentalSessionAndOrigin'> {
Expand Down
11 changes: 5 additions & 6 deletions npm/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@
"main": "dist/index.js",
"scripts": {
"prebuild": "rimraf dist",
"build": "rollup -c rollup.config.js",
"build": "rollup -c rollup.config.mjs",
"postbuild": "node ../../scripts/sync-exported-npm-with-cli.js",
"build-prod": "yarn build",
"check-ts": "tsc --noEmit"
},
"dependencies": {},
"devDependencies": {
"@angular/common": "^14.0.6",
"@angular/core": "^14.0.6",
"@angular/platform-browser-dynamic": "^14.0.6",
"@rollup/plugin-node-resolve": "^11.1.1",
"rollup-plugin-typescript2": "^0.29.0",
"@angular/common": "^14.2.0",
"@angular/core": "^14.2.0",
"@angular/platform-browser-dynamic": "^14.2.0",
"@cypress/mount-utils": "0.0.0-development",
"typescript": "^4.7.4",
"zone.js": "~0.11.4"
},
Expand Down
61 changes: 0 additions & 61 deletions npm/angular/rollup.config.js

This file was deleted.

14 changes: 14 additions & 0 deletions npm/angular/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { createEntries } from '@cypress/mount-utils/create-rollup-entry.mjs'

const config = {
external: [
'@angular/core',
'@angular/core/testing',
'@angular/common',
'@angular/platform-browser-dynamic/testing',
'zone.js',
'zone.js/testing',
],
}

export default createEntries({ formats: ['es'], input: 'src/index.ts', config })
14 changes: 8 additions & 6 deletions npm/angular/src/mount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { Component, EventEmitter, Type } from '@angular/core'
import {
ComponentFixture,
getTestBed,
TestBed,
TestModuleMetadata,
TestBed,
} from '@angular/core/testing'
import {
BrowserDynamicTestingModule,
Expand Down Expand Up @@ -144,12 +144,12 @@ function initTestBed<T> (

const componentFixture = createComponentFixture(component) as Type<T>

TestBed.configureTestingModule({
getTestBed().configureTestingModule({
...bootstrapModule(componentFixture, configRest),
})

if (providers != null) {
TestBed.overrideComponent(componentFixture, {
getTestBed().overrideComponent(componentFixture, {
add: {
providers,
},
Expand All @@ -172,6 +172,8 @@ function createComponentFixture<T> (
component: Type<T> | string,
): Type<T | WrapperComponent> {
if (typeof component === 'string') {
// getTestBed().overrideTemplate is available in v14+
// The static TestBed.overrideTemplate is available across versions
TestBed.overrideTemplate(WrapperComponent, component)

return WrapperComponent
Expand All @@ -192,7 +194,7 @@ function setupFixture<T> (
component: Type<T>,
config: MountConfig<T>,
): ComponentFixture<T> {
const fixture = TestBed.createComponent(component)
const fixture = getTestBed().createComponent(component)

fixture.whenStable().then(() => {
fixture.autoDetectChanges(config.autoDetectChanges ?? true)
Expand Down Expand Up @@ -309,6 +311,6 @@ getTestBed().initTestEnvironment(

setupHooks(() => {
// Not public, we need to call this to remove the last component from the DOM
TestBed['tearDownTestingModule']()
TestBed.resetTestingModule()
getTestBed()['tearDownTestingModule']()
getTestBed().resetTestingModule()
})
Loading

0 comments on commit a7f6d4b

Please sign in to comment.