question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cypress config files should support "extends" option

See original GitHub issue

Desired behavior:

TypeScript config files (tsconfig.json) allow the user to “extend” an existing file, e.g.:

tsconfig.json:

{
  "someOption": "value",
  "someOption2": "value2"
}

tsconfig.test.json:

{
  "extends": "./tsconfig.json",
  "someOption": "value3"
}

The end result is that the TypeScript compiler sees tsconfig.test.json as this:

{
  "someOption": "value3",
  "someOption2": "value2"
}

This allows the config files to remain DRY and avoid duplicating data, but still have multiple files for different scenarios.

Now that cypress has the --config-file option, I think cypress.json should support this too.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:15
  • Comments:19 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
Camo30commented, Mar 2, 2021

Unfortunately the plugin from @bahmutov doesn’t work in my environment. This should work out of the box

1reaction
ling1726commented, Apr 30, 2021

@bahmutov @jennifer-shehane An extra scenario where this would be useful: in Fluent UI we have a lerna monorepo. We would like each package to be responsible for its own cypress tests, but would like to have one place for test helpers and configurations. At the same time a package should be able to extend or override the base config.

It seems too heavy weight to create a completely new package in the monorepo just to share cypress utilities, if it’s possible to do path extension

packages/
├── scripts/ cypress
│   ├── fixtures
│   ├── plugins
│   ├── support
│   ├── cypress.json // base
├── menu/
│   ├── package.json
│   ├── Menu.spec.ts
|   ├── cypress.json // extends root
└── button/
    ├── package.json
    ├── Button.spec.ts
    ├── cypress.json // etends root
Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration - Cypress Documentation
This file is used to store any configuration specific to Cypress. Cypress additionally supports config files with .mjs or .cjs extensions. Using a...
Read more >
How to extend cypress.json config to other configuration files?
Cypress plugin that adds "extends" support to the configuration file. This allows the config files to remain DRY and avoid duplicating data, ...
Read more >
Configurations in Cypress and How to Disable Default ...
Firstly, Cypress has a configuration setup, which is called the Global Configuration, which provides a set of default values for various ...
Read more >
Specify Cypress configuration files - BrowserStack
You can use the cypress_config_file key in run_settings option to specify the Cypress configuration file that you want to use.
Read more >
Configure Cypress Tests to Run on Multiple Environments
Most importantly we need only baseUrl changes in newly created Cypress configuration files, the remaining configuration still we can use the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found