Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make cypress.config.js available #17000

Closed
wants to merge 227 commits into from
Closed
Show file tree
Hide file tree
Changes from 211 commits
Commits
Show all changes
227 commits
Select commit Hold shift + click to select a range
703b848
feat: make cypress.js available
elevatebart Jun 17, 2021
e3ee515
test: test cypress.js
elevatebart Jun 17, 2021
7344f15
clear cache after each test
elevatebart Jun 22, 2021
3a57ee1
test: mock configFile resolve
elevatebart Jun 22, 2021
b55ecc0
test: mock fs instead of settings
elevatebart Jun 22, 2021
714311a
test: mock fs and fix setup
elevatebart Jun 22, 2021
00cb9bd
test: cleanup cypress.json
elevatebart Jun 22, 2021
584fe63
add unit tests for cypress js loading
elevatebart Jun 22, 2021
ac65d2f
refactro: use cypress.config instead of cypress.js
elevatebart Jun 23, 2021
0c89df5
tests: integration tests
elevatebart Jun 24, 2021
2efedc1
refactor: mutualize tests cahche management
elevatebart Jun 24, 2021
db2a0bd
test: make last test pass (stop mocking internals)
elevatebart Jun 24, 2021
27f7344
chore: remove test
elevatebart Jun 24, 2021
3dc6220
test: fix another cache oops
elevatebart Jun 24, 2021
cc7cd59
fix: make cypress.config.js the default
elevatebart Jun 24, 2021
e6b1123
tests: fix a bunch
elevatebart Jun 25, 2021
6371846
tests: fix more tests
elevatebart Jun 25, 2021
2aa9038
only create/update config file if its json
elevatebart Jun 25, 2021
7bf6c8b
fix: add missing options param
elevatebart Jun 25, 2021
a51dbc8
use the new default cypress.config.js
elevatebart Jun 25, 2021
956184b
finally all project tests are passing
elevatebart Jun 25, 2021
6bd9e08
test: fix FQDN driver tests
elevatebart Jun 28, 2021
5cf6433
feat: allow users to supply e2e and components as functions
elevatebart Jun 28, 2021
0b8818d
fix some issues
elevatebart Jun 28, 2021
4164104
make it work
elevatebart Jun 28, 2021
4b1f723
use a testingType there and avoid recreating pluginsfile
elevatebart Jun 29, 2021
bd07a49
feat: allow use of typescript for cypres.config.ts
elevatebart Jun 29, 2021
5a27ad1
fix tsnode registration
elevatebart Jun 29, 2021
3323910
feat: add defineConfig function
elevatebart Jun 29, 2021
c10b56e
reeanble cleanup with remove fixtures
elevatebart Jun 29, 2021
97e3131
fix comment on cache helper
elevatebart Jun 29, 2021
771ed0e
make ipc util typescript
elevatebart Jul 6, 2021
da5031d
fix run_plugins debug
elevatebart Jul 6, 2021
e9296d7
make cypress.config.ts run in a separate thread
elevatebart Jul 6, 2021
57cdc4d
add debugs and fix error messages
elevatebart Jul 6, 2021
2cc9867
transmit references to functions
elevatebart Jul 6, 2021
e3526fa
fix webpack config
elevatebart Jul 6, 2021
72c3592
update the cypress API
elevatebart Jul 6, 2021
bc5f963
Update cypress types
elevatebart Jul 6, 2021
43edb2b
avoid failling to close a project when it was never open
elevatebart Jul 7, 2021
ca36415
kill configFile process once done or errored
elevatebart Jul 7, 2021
3c07ce9
fix a few issues
elevatebart Jul 7, 2021
5bcfd62
add typescript to saved state
elevatebart Jul 7, 2021
dbaab7f
show the right file in desktop-gui
elevatebart Jul 8, 2021
0c083cf
don't show e2e & component in the e2e desktop-gui
elevatebart Jul 8, 2021
abfc9bb
display e2e func instead of plugin when no plugin
elevatebart Jul 8, 2021
cfbd2ea
make the settings menu display the proper name
elevatebart Jul 8, 2021
88ec179
make sure file only appears once
elevatebart Jul 9, 2021
b49f7d1
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Jul 9, 2021
9687b55
tests: fix some tests on moved files
elevatebart Jul 9, 2021
86b47c2
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Jul 16, 2021
52620b4
tests: fix tests of desktop-gui
elevatebart Jul 16, 2021
2dc75d2
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Jul 16, 2021
3f23589
fix: error and specs when request is non FQDN
elevatebart Jul 16, 2021
6c12a0b
fix: make sure that configFile always has a value
elevatebart Jul 16, 2021
70a86db
tests: restore some of the test
elevatebart Jul 16, 2021
36fbafb
test: fix 2 tests desktop gui
elevatebart Jul 16, 2021
30c2b36
tests: make project nav tests pass
elevatebart Jul 16, 2021
08303ae
test: desktop-gui more fixes
elevatebart Jul 16, 2021
e122dfb
test: fix settings
elevatebart Jul 16, 2021
cb0e187
tess: last tests for desktop-gui
elevatebart Jul 16, 2021
73fc60d
chore: revert "fix(deps): update dependency electron to v13 🌟 (#17037…
flotwig Jul 16, 2021
34b7094
fix(ui): use mouseenter instead of mouseover for ui hover events (#17…
kuceb Jul 16, 2021
604607f
add some logs
elevatebart Jul 17, 2021
3959fc3
scaffold an empty es6 config file
elevatebart Jul 17, 2021
7b62c9d
add more logs
elevatebart Jul 17, 2021
1c053b7
add some output to childprocess
elevatebart Jul 17, 2021
075b3f4
rename registered variable
elevatebart Jul 17, 2021
8531751
fix: avoid running the cypress.config twice with the same code
elevatebart Jul 17, 2021
28e896e
rollback change on ts_node
elevatebart Jul 17, 2021
99518d2
protect project base against configFile:false
elevatebart Jul 18, 2021
bb675d3
add missing snapshot for plugins
elevatebart Jul 18, 2021
40575fa
fix mismatching validations
elevatebart Jul 18, 2021
8e0380c
validation fixes on e2e and component
elevatebart Jul 18, 2021
b8f845f
deal with unmentionned e2e and component functions
elevatebart Jul 19, 2021
62b0200
fi tests
elevatebart Jul 20, 2021
1063c01
test: make path ponint to an existing path
elevatebart Jul 20, 2021
3b3d755
allow for no cypress config to be found
elevatebart Jul 20, 2021
1b825a6
make better mocks for getProjectId
elevatebart Jul 20, 2021
359cda1
test: fix events comps
elevatebart Jul 20, 2021
7321ec8
test: files repairs
elevatebart Jul 20, 2021
2b9e2c3
test: plugins files
elevatebart Jul 20, 2021
9841b01
fix some more tests
elevatebart Jul 20, 2021
360d0be
test: fix project test
elevatebart Jul 20, 2021
34c77bc
test: fix settings tests
elevatebart Jul 21, 2021
4b55c3f
make sure we load ts code and js code separately
elevatebart Jul 21, 2021
8a15f6b
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Jul 21, 2021
5cb69a9
fix build
elevatebart Jul 21, 2021
5c4d6eb
test: fix the crasher ?
elevatebart Jul 21, 2021
da79d58
return objects when creating settings file
elevatebart Jul 21, 2021
20dd33b
test: fix some tests
elevatebart Jul 21, 2021
49b9a82
remove changes to socket
elevatebart Jul 21, 2021
90e3816
fix: if closeProcessor is false
elevatebart Jul 22, 2021
615f368
tests: close the ct server after test
elevatebart Jul 22, 2021
391ee8a
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Jul 22, 2021
bc8e74f
feat: detect tsconfig.json and create ts file
elevatebart Jul 23, 2021
5ca271c
make sure we scaffold properly
elevatebart Jul 23, 2021
3ddbccc
add the path to the config file that we could not read
elevatebart Jul 23, 2021
a13395f
allow to scaffold js/ts config file
elevatebart Jul 23, 2021
b3a837a
test: fix one more cypress integration test
elevatebart Jul 23, 2021
9d8de32
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Jul 23, 2021
6850f02
test: setup config the right way (gui)
elevatebart Jul 23, 2021
1a26d85
feat: deal with functions in wrapIpc
elevatebart Jul 23, 2021
1e1e974
accept null values in wrapIpc
elevatebart Jul 23, 2021
e009586
remove need for function names in ipc
elevatebart Jul 24, 2021
83c86e6
allow array serialization
elevatebart Jul 24, 2021
a5f38c8
avoid useless changes to desktop gui
elevatebart Jul 24, 2021
7f2c9a5
move function in testing type
elevatebart Jul 24, 2021
9db9e16
protect against noe e2e object
elevatebart Jul 24, 2021
9444605
test adjust e2e test for function
elevatebart Jul 24, 2021
633e4f7
fix browser options API
elevatebart Jul 24, 2021
c12c633
allow null and subfunctions in clean up for browser event
elevatebart Jul 24, 2021
821bef6
fix server unit test
elevatebart Jul 24, 2021
17f26c8
no creating the pluginsFile when converted to js
elevatebart Jul 24, 2021
f4c2c1b
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Jul 26, 2021
d43d473
fix: merge issue
elevatebart Jul 26, 2021
38e76ac
update types
elevatebart Jul 29, 2021
b1b2b8e
fix text typo "in the" instead of "if the"
elevatebart Jul 29, 2021
4c73fc1
remove return statement since we mutated passed object
elevatebart Jul 29, 2021
5ec842e
make the getPluginsFunction function easier to read
elevatebart Jul 29, 2021
00c799d
clearer serialization of objects
elevatebart Jul 29, 2021
878035d
make a list of accepted default config files
elevatebart Jul 29, 2021
a8db112
avoid repeating the pattern of finding config file
elevatebart Jul 29, 2021
29687d6
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Jul 29, 2021
2726081
update comment in javascript function
elevatebart Jul 30, 2021
0dd3649
fix isEmpy object
elevatebart Jul 30, 2021
147a1a9
lint: remove white-space (!!!%%^&^%)
elevatebart Jul 30, 2021
601f0d7
refactor: merge e2e in config instead of settings for validation
elevatebart Jul 30, 2021
48239ee
rename plugins to setupNodeServer for finding
elevatebart Jul 30, 2021
322e350
validate setupnodeserver config
elevatebart Jul 30, 2021
97655d1
error when using pluginsFile in cypress.config.jsts
elevatebart Jul 30, 2021
d4b1dfb
fix: error when both a cypress.config.js and .ts
elevatebart Jul 30, 2021
5a338da
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Jul 30, 2021
b8a1aee
fix types and test it out on cypress vue
elevatebart Jul 30, 2021
b6108ea
fix: comment on the location of the plugins function
elevatebart Jul 30, 2021
59c33bc
fix: update watcher to watch dependencies of config
elevatebart Jul 30, 2021
943878d
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Jul 30, 2021
2b8086c
add the setupDevServer function
elevatebart Jul 31, 2021
34dc08a
rename setupServer => setupEvents
elevatebart Jul 31, 2021
e5838e1
fix: types
elevatebart Aug 2, 2021
46b90d6
better validation of setupDevServer
elevatebart Aug 2, 2021
81516d7
better validation for config
elevatebart Aug 2, 2021
677b67f
fix validation of config
elevatebart Aug 2, 2021
a1c3a2a
fix watch tests
elevatebart Aug 2, 2021
7c442c5
avoid creating pluginsFile when unnecessary
elevatebart Aug 2, 2021
bc5770d
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Aug 2, 2021
77b21f3
test: weird webpack bug
elevatebart Aug 2, 2021
3f9fbeb
types: no pluginsFile and supportFile on root config
elevatebart Aug 2, 2021
c38c2dd
fix types
elevatebart Aug 2, 2021
6a06540
style: add comment
elevatebart Aug 2, 2021
c1ab0d1
Add deprecation warning for e2e gui
elevatebart Aug 3, 2021
db2f45f
add error message display to runnerCT
elevatebart Aug 3, 2021
2c539f4
types: export configuration types
elevatebart Aug 3, 2021
a015c9f
remove lalala
elevatebart Aug 3, 2021
27a6c5e
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Aug 3, 2021
5adb9ee
style: typo in commment
elevatebart Aug 4, 2021
36e4fef
style: comment typo
elevatebart Aug 4, 2021
e903baa
remove useless function
elevatebart Aug 3, 2021
9fa76f7
add console warning for deprecation
elevatebart Aug 4, 2021
87c1202
fix linting
elevatebart Aug 4, 2021
12a20f9
convert require_async_child to ts
elevatebart Aug 4, 2021
d0a8a9e
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Aug 4, 2021
bb00ece
make cache_helper typescript
elevatebart Aug 4, 2021
72b0ee9
cmake desktop-gui more readable
elevatebart Aug 4, 2021
d5909d7
style: replace indexOf with includes
elevatebart Aug 4, 2021
5c1cb6d
remove function for renderWarnings
elevatebart Aug 4, 2021
81f93b5
fix indentation in warningMessage
elevatebart Aug 4, 2021
2178b93
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Aug 4, 2021
0022fe9
Revert "convert require_async_child to ts"
elevatebart Aug 4, 2021
2f7bffa
Revert "convert require_async_child to ts"
elevatebart Aug 4, 2021
2806527
avoid trying to close a non open project
elevatebart Aug 4, 2021
319671b
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Aug 4, 2021
a31dff3
highlight the path to the file in error
elevatebart Aug 5, 2021
f735048
show a better error when TS node fails
elevatebart Aug 5, 2021
9083997
wire runner-ct to receive warnings
elevatebart Aug 5, 2021
e89e875
implement the removeWarning function in state
elevatebart Aug 5, 2021
43f46c9
finnsh the runner-ct message
elevatebart Aug 5, 2021
5f04acc
don't wait for runner-ct tu run a spec to connect
elevatebart Aug 5, 2021
81d5b79
add link to error
elevatebart Aug 5, 2021
3059088
use markdown-renderer to render warning
elevatebart Aug 5, 2021
9dca3fb
fix lint types
elevatebart Aug 5, 2021
4c966fd
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Aug 5, 2021
bd4dae6
test: fix unit tests for project-base
elevatebart Aug 5, 2021
3d38d9f
fix files tests
elevatebart Aug 5, 2021
fe91bd8
test: flag projects as open to close them properly
elevatebart Aug 5, 2021
58bf2f2
test: flag project as open so that it closes properly
elevatebart Aug 5, 2021
ca5cbe8
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Aug 6, 2021
a3e068a
remove duplicated console message
elevatebart Aug 6, 2021
6ae9d9d
us stripAnsi instead of regexp to clean up tserror
elevatebart Aug 6, 2021
4b41205
avoid showing deprecation warning in every test
elevatebart Aug 6, 2021
70687b5
add comment about why
elevatebart Aug 6, 2021
503a44d
style: better indentation
elevatebart Aug 6, 2021
4ad572a
fix runner-ct test
elevatebart Aug 6, 2021
b89d3d7
stop running unimplemented e2e tests
elevatebart Aug 6, 2021
bdfeb9a
migrate all npm packages to cypress.config.js
elevatebart Aug 6, 2021
d3c8c6d
avoid creating pluginsFile when only dev server
elevatebart Aug 6, 2021
8bcb731
fix: merge defaults / config validation reorder
elevatebart Aug 6, 2021
c8a38e3
fix config refactor
elevatebart Aug 6, 2021
9e6ca6e
fix: create a pluginsFile when config is json
elevatebart Aug 7, 2021
6805f1a
fix: error when using new syntax
elevatebart Aug 8, 2021
dd555a7
test: http server tests rely on undefined pluginsFile
elevatebart Aug 8, 2021
4dba779
test: use the component testing defaults for snapshots
elevatebart Aug 8, 2021
91aae87
fix: avoid crash when no plugins function provided
elevatebart Aug 8, 2021
c32305b
simplify and fix plugins management
elevatebart Aug 8, 2021
f81c67c
fix: runner-ct config needs to follow the full migration
elevatebart Aug 8, 2021
da1c409
test: fix plugins test
elevatebart Aug 8, 2021
198c36a
fix: when configFile is null, use the pluginsFile
elevatebart Aug 9, 2021
26dd624
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Aug 9, 2021
0723aa8
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Aug 10, 2021
c4faae1
fix: conflict when both config.json and js
elevatebart Aug 11, 2021
69ebdba
add promises to setup functions returns
elevatebart Aug 13, 2021
a46f367
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Aug 31, 2021
b998201
refactor: rename option setupDevServer
elevatebart Sep 9, 2021
c608a9e
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Sep 9, 2021
4789731
chore: error wording changes
elevatebart Sep 9, 2021
7bcafa0
chore: update error wording
elevatebart Sep 9, 2021
07be3c4
fix: reword unit test title in server settings
elevatebart Sep 10, 2021
49f97eb
fix: build process
elevatebart Sep 10, 2021
4cdef63
build: make build artifacts on this PR branch
elevatebart Oct 1, 2021
27597fc
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Oct 1, 2021
2fb6862
Merge branch 'develop' into feat/allow-cypress-js
elevatebart Oct 1, 2021
38a9a27
make build pass
elevatebart Oct 1, 2021
61a2f58
fix types missing
elevatebart Oct 1, 2021
d44aada
fix changed types
elevatebart Oct 1, 2021
f94d433
fix vite too
elevatebart Oct 1, 2021
241b096
fix build process on darwin
elevatebart Oct 2, 2021
a120c2c
fix the build
elevatebart Oct 2, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1347,10 +1347,6 @@ jobs:
name: Run component tests
command: yarn test:ci:ct
working_directory: npm/vue
- run:
name: Run e2e tests
command: yarn test:ci:e2e
working_directory: npm/vue
- store_test_results:
path: npm/vue/test_results
- store_artifacts:
Expand Down
13 changes: 13 additions & 0 deletions cli/lib/cypress.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,19 @@ const cypressModuleApi = {
return cli.parseRunCommand(args)
},
},

/**
* This function should not be used in pure JavaScript
* By the type of its argument it allows autocompletion and
* type checking of the configuration given by users.
*
* @see ../types/cypress-npm-api.d.ts
* @param {Cypress.ConfigOptions} config
cowboy marked this conversation as resolved.
Show resolved Hide resolved
* @returns {Cypress.ConfigOptions} the configuration passed in parameter
*/
defineConfig (config) {
cowboy marked this conversation as resolved.
Show resolved Hide resolved
return config
},
}

module.exports = cypressModuleApi
80 changes: 42 additions & 38 deletions cli/types/cypress-npm-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ declare namespace CypressCommandLine {
/**
* Specify configuration
*/
config: Cypress.ConfigOptions
config: Cypress.ConfigOptionsMergedWithTestingTypes
/**
* Path to the config file to be used.
*
Expand Down Expand Up @@ -335,8 +335,7 @@ declare namespace CypressCommandLine {
}
}

declare module 'cypress' {
/**
/**
* Cypress NPM module interface.
* @see https://on.cypress.io/module-api
* @example
Expand All @@ -345,41 +344,46 @@ declare module 'cypress' {
cypress.run().then(results => ...)
```
*/
interface CypressNpmApi {
/**
* Execute a headless Cypress test run.
* @see https://on.cypress.io/module-api#cypress-run
* @example
```
const cypress = require('cypress')
// runs all spec files matching a wildcard
cypress.run({
spec: 'cypress/integration/admin*-spec.js'
}).then(results => {
if (results.status === 'failed') {
// Cypress could not run
} else {
// inspect results object
}
})
```
*/
run(options?: Partial<CypressCommandLine.CypressRunOptions>): Promise<CypressCommandLine.CypressRunResult | CypressCommandLine.CypressFailedRunResult>
/**
* Opens Cypress GUI. Resolves with void when the
* GUI is closed.
* @see https://on.cypress.io/module-api#cypress-open
*/
open(options?: Partial<CypressCommandLine.CypressOpenOptions>): Promise<void>
declare module 'cypress' {
/**
* Execute a headless Cypress test run.
* @see https://on.cypress.io/module-api#cypress-run
* @example
```
const cypress = require('cypress')
// runs all spec files matching a wildcard
cypress.run({
spec: 'cypress/integration/admin*-spec.js'
}).then(results => {
if (results.status === 'failed') {
// Cypress could not run
} else {
// inspect results object
}
})
```
*/
function run(options?: Partial<CypressCommandLine.CypressRunOptions>): Promise<CypressCommandLine.CypressRunResult | CypressCommandLine.CypressFailedRunResult>
/**
* Opens Cypress GUI. Resolves with void when the
* GUI is closed.
* @see https://on.cypress.io/module-api#cypress-open
*/
function open(options?: Partial<CypressCommandLine.CypressOpenOptions>): Promise<void>

/**
* Utility functions for parsing CLI arguments the same way
* Cypress does
*/
cli: CypressCommandLine.CypressCliParser
}
/**
* Utility functions for parsing CLI arguments the same way
* Cypress does
*/
const cli: CypressCommandLine.CypressCliParser

// export Cypress NPM module interface
const cypress: CypressNpmApi
export = cypress
/**
* Type helper to make writing `cypress.config.ts` easier
*/
function defineConfig(config: Cypress.ConfigOptions): Cypress.ConfigOptions

/**
* Types for configuring cypress in cypress.config.ts
*/
type ConfigOptions = Cypress.ConfigOptions
}
56 changes: 41 additions & 15 deletions cli/types/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ declare namespace Cypress {
type ViewportOrientation = 'portrait' | 'landscape'
type PrevSubject = 'optional' | 'element' | 'document' | 'window'
type TestingType = 'e2e' | 'component'
type PluginConfig = (on: PluginEvents, config: PluginConfigOptions) => void | ConfigOptions | Promise<ConfigOptions>
type PluginConfig = (on: PluginEvents, config: PluginConfigOptions) => void | ConfigOptionsMergedWithTestingTypes | Promise<ConfigOptionsMergedWithTestingTypes>

interface CommandOptions {
prevSubject: boolean | PrevSubject | PrevSubject[]
Expand Down Expand Up @@ -310,7 +310,7 @@ declare namespace Cypress {
// 60000
```
*/
config<K extends keyof ConfigOptions>(key: K): ResolvedConfigOptions[K]
config<K extends keyof ResolvedConfigOptions>(key: K): ResolvedConfigOptions[K]
/**
* Sets one configuration value.
* @see https://on.cypress.io/config
Expand All @@ -319,7 +319,7 @@ declare namespace Cypress {
Cypress.config('viewportWidth', 800)
```
*/
config<K extends keyof ConfigOptions>(key: K, value: ResolvedConfigOptions[K]): void
config<K extends keyof ResolvedConfigOptions>(key: K, value: ResolvedConfigOptions[K]): void
/**
* Sets multiple configuration values at once.
* @see https://on.cypress.io/config
Expand All @@ -331,7 +331,7 @@ declare namespace Cypress {
})
```
*/
config(Object: ConfigOptions): void
config(Object: ConfigOptionsMergedWithTestingTypes): void

// no real way to type without generics
/**
Expand Down Expand Up @@ -2488,6 +2488,17 @@ declare namespace Cypress {
cmdKey: boolean
}

type PluginsFunction = ((on: PluginEvents, config: PluginConfigOptions) => Promise<ConfigOptionsMergedWithTestingTypes> | ConfigOptionsMergedWithTestingTypes | undefined | void)

type TestingTypeConfig = Omit<ResolvedConfigOptions, TestingType> & { setupNodeEvents?: PluginsFunction }
type TestingTypeConfigComponent = TestingTypeConfig & {
/**
* Return the setup of your server
* @param options the dev server options to pass directly to the dev-server
*/
setupDevServer(options: DevServerOptions): Promise<ResolvedDevServerConfig> | ResolvedDevServerConfig
}

interface ResolvedConfigOptions {
/**
* Url used as prefix for [cy.visit()](https://on.cypress.io/visit) or [cy.request()](https://on.cypress.io/request) command’s url
Expand Down Expand Up @@ -2521,7 +2532,7 @@ declare namespace Cypress {
reporter: string
/**
* Some reporters accept [reporterOptions](https://on.cypress.io/reporters) that customize their behavior
* @default "spec"
* @default {}
*/
reporterOptions: { [key: string]: any }
/**
Expand Down Expand Up @@ -2561,7 +2572,7 @@ declare namespace Cypress {
taskTimeout: number
/**
* Path to folder where application files will attempt to be served from
* @default root project folder
* @default "root project folder"
*/
fileServerFolder: string
/**
Expand All @@ -2572,6 +2583,7 @@ declare namespace Cypress {
/**
* Path to folder containing integration test files
* @default "cypress/integration"
* @deprecated use the testFiles glob in the e2e object
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @deprecated use the testFiles glob in the e2e object
* @deprecated use the testFiles glob in the e2e object instead

*/
integrationFolder: string
/**
Expand All @@ -2582,6 +2594,7 @@ declare namespace Cypress {
/**
* If set to `system`, Cypress will try to find a `node` executable on your path to use when executing your plugins. Otherwise, Cypress will use the Node version bundled with Cypress.
* @default "bundled"
* @deprecated nodeVersion will soon be fixed to "system" to avoid confusion
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this sufficiently explains the reasoning for the move and would rather avoid putting a short description that is not all encompassing of the reasons.

Suggested change
* @deprecated nodeVersion will soon be fixed to "system" to avoid confusion
* @deprecated nodeVersion will soon be fixed to "system"

*/
nodeVersion: 'system' | 'bundled'
/**
Expand Down Expand Up @@ -2716,6 +2729,7 @@ declare namespace Cypress {
blockHosts: null | string | string[]
/**
* Path to folder containing component test files.
* @deprecated use the testFiles pattern inside the component object instead
*/
componentFolder: false | string
/**
Expand All @@ -2724,6 +2738,7 @@ declare namespace Cypress {
projectId: null | string
/**
* Path to the support folder.
* @deprecated use supportFile instead
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this suggestion work for those still using the cypress.json if they see this deprecation warning?

*/
supportFolder: string
/**
Expand All @@ -2740,16 +2755,16 @@ declare namespace Cypress {
experimentalFetchPolyfill: boolean

/**
* Override default config options for Component Testing runner.
* Override default config options for E2E Testing runner.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Override default config options for E2E Testing runner.
* Override default config options when running e2e tests.

* @default {}
*/
component: Omit<ResolvedConfigOptions, TestingType>
e2e: TestingTypeConfig

/**
* Override default config options for E2E Testing runner.
* Override default config options for Component Testing runner.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Override default config options for Component Testing runner.
* Override default config options when running component tests.

* @default {}
*/
e2e: Omit<ResolvedConfigOptions, TestingType>
component: TestingTypeConfigComponent
}

/**
Expand Down Expand Up @@ -2827,16 +2842,27 @@ declare namespace Cypress {
xhrUrl: string
}

interface TestConfigOverrides extends Partial<Pick<ConfigOptions, 'animationDistanceThreshold' | 'baseUrl' | 'defaultCommandTimeout' | 'env' | 'execTimeout' | 'includeShadowDom' | 'requestTimeout' | 'responseTimeout' | 'retries' | 'scrollBehavior' | 'taskTimeout' | 'viewportHeight' | 'viewportWidth' | 'waitForAnimations'>> {
interface TestConfigOverrides extends Partial<Pick<ConfigOptionsMergedWithTestingTypes, 'animationDistanceThreshold' | 'baseUrl' | 'defaultCommandTimeout' | 'env' | 'execTimeout' | 'includeShadowDom' | 'requestTimeout' | 'responseTimeout' | 'retries' | 'scrollBehavior' | 'taskTimeout' | 'viewportHeight' | 'viewportWidth' | 'waitForAnimations'>> {
browser?: IsBrowserMatcher | IsBrowserMatcher[]
keystrokeDelay?: number
}

// here we need to use the `Function` type to type setup functions options properly
// if we don't, they will be typed as any
/* tslint:disable-next-line ban-types */
type DeepPartial<T> = T extends Function ? T : T extends object ? { [P in keyof T]?: DeepPartial<T[P]>; } : T

/**
* ConfigOptions after the current testingType has been merget into the root.
*/
type ConfigOptionsMergedWithTestingTypes = DeepPartial<ResolvedConfigOptions>

/**
* All configuration items are optional.
* Config model of cypress. To be used in `cypress.config.js`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Config model of cypress. To be used in `cypress.config.js`
* Configuration options for Cypress. To be used in `cypress.config.js`

*/
type CoreConfigOptions = Partial<Omit<ResolvedConfigOptions, TestingType>>
type ConfigOptions = CoreConfigOptions & {e2e?: CoreConfigOptions, component?: CoreConfigOptions }
type ConfigOptions = Omit<ConfigOptionsMergedWithTestingTypes, 'pluginsFile' | 'supportFile' | 'supportFolder'>
// make setupDevServer required in component
& {component?: {setupDevServer: TestingTypeConfigComponent['setupDevServer'] }}

interface PluginConfigOptions extends ResolvedConfigOptions {
/**
Expand Down Expand Up @@ -5252,7 +5278,7 @@ declare namespace Cypress {

interface BeforeRunDetails {
browser?: Browser
config: ConfigOptions
config: ConfigOptionsMergedWithTestingTypes
cypressVersion: string
group?: string
parallel?: boolean
Expand Down
29 changes: 29 additions & 0 deletions npm/angular/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { defineConfig } from 'cypress'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching the npm packages to use cypress.config.js file should be done in a separate PR since these changes are non breaking.

import { addMatchImageSnapshotPlugin } from 'cypress-image-snapshot/plugin'
import { startDevServer } from '@cypress/webpack-dev-server'
import webpackConfig from './cypress/plugins/webpack.config'

export default defineConfig({
experimentalFetchPolyfill: true,
fixturesFolder: false,
includeShadowDom: true,
fileServerFolder: 'src',
projectId: 'nf7zag',
component: {
componentFolder: 'src',
testFiles: '**/*cy-spec.ts',
setupDevServer (options) {
return startDevServer({
options,
webpackConfig,
})
},
setupNodeEvents (on, config) {
addMatchImageSnapshotPlugin(on, config)

require('@cypress/code-coverage/task')(on, config)

return config
},
},
})
11 changes: 0 additions & 11 deletions npm/angular/cypress.json

This file was deleted.

Loading