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

[Plugin] Cannot set property of undefined #7959

Closed
jmsansan opened this issue Jul 13, 2020 · 3 comments · Fixed by #7960
Closed

[Plugin] Cannot set property of undefined #7959

jmsansan opened this issue Jul 13, 2020 · 3 comments · Fixed by #7960
Assignees
Labels
topic: plugins ⚙️ type: unexpected behavior User expected result, but got another

Comments

@jmsansan
Copy link
Contributor

jmsansan commented Jul 13, 2020

Current behavior:

On cypress startup, it throws "Cannot set property [key] of undefined" error when modifying config from plugin.
This happens when setting a new object property to config on plugins.

Desired behavior:

Cypress startup properly and loads config on plugins.

Test code to reproduce

add code to /plugins/index.js file and start cypress

module.exports = (on, config) => {
  config.test = { foo: 'bar' }; // Fails
  config.test2 = "foobar"; // Pass
  config.test3 = { foo: {bar: "baz"} }; // Fails
  config.test4 = ["foo", "bar", "baz"]; // Pass
  return config;
};

Versions

Cypress: 4.10.0
OS: Manjaro/Arc linux

@jennifer-shehane
Copy link
Member

In terms of what 'fail' means here, the pluginsFile throws an error upon opening.

module.exports = (on, config) => {
  config.test = { foo: 'bar' }; // Fails
  return config;
};

Screen Shot 2020-07-14 at 1 11 25 PM

module.exports = (on, config) => {
  config.test.foo = 'bar'; // Fails
  return config;
};

Screen Shot 2020-07-14 at 1 11 43 PM

module.exports = (on, config) => {
  config.test3 = { foo: { bar: "baz" } }; // Fails
  return config;
};

Screen Shot 2020-07-14 at 1 12 13 PM

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jul 16, 2020

The code for this is done in cypress-io/cypress#7960, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot cypress-bot bot removed the stage: needs review The PR code is done & tested, needs review label Jul 16, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jul 21, 2020

Released in 4.11.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v4.11.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Jul 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic: plugins ⚙️ type: unexpected behavior User expected result, but got another
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants