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

Running cypress with no project: false actually runs cypress open #3675

Closed
Toxicable opened this issue Mar 8, 2019 · 3 comments
Closed

Running cypress with no project: false actually runs cypress open #3675

Toxicable opened this issue Mar 8, 2019 · 3 comments

Comments

@Toxicable
Copy link
Contributor

Toxicable commented Mar 8, 2019

Current behavior:

Running cypress.run({project: false}) opens cypress with cypress open instead.

Desired behavior:

To run cypress with no config file, instead using the config I specified when calling it.

Steps to reproduce: (app code and test code)

  const cypress = require('cypress');
  const runners =  cypress.run({
    spec: [], // putting in actual spec file paths here results in same behaviour
    project: false,
    record: false,
    config: {
      video: false,
      screenshots: false,
      chromeWebSecurity: false,
    },
  });

Versions

ubuntu 16.04
chrome 72
cypress 3.1.5

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Mar 10, 2019

project is always expecting a path value, so false is not valid. Honestly, I'm having a hard time even tracking in the code, by just looking, to figure out what it's doing to make it behave like cypress open instead.

Proposal: We should update cypress run to throw error when specifically passed an invalid project key like false, null, something that is not a valid path.


To more specifically address what you're really trying to do here

To run cypress with no config file, instead using the config I specified when calling it.

Passing config here should overwrite values from your configFile. You can see how the configuration is being resolved by running the Module API with cypress.open and seeing how it prints in the Test Runner as shown here.

What are you having trouble overriding using the config argument?

@cypress-bot cypress-bot bot added the stage: awaiting response Potential fix was proposed; awaiting response label Mar 10, 2019
@Toxicable
Copy link
Contributor Author

Toxicable commented Mar 10, 2019

Proposal: We should update cypress run to throw error when specifically passed an invalid project key like false, null, something that is not a valid path.

Sounds good to me!

However, that dosen't solve my issue.
To clarify; I'd like to run cypress without a configFile at all.
Currently not specifying a project results in cypress throwing an error

For example:

cypress.run({
    spec: specFiles,
    record: false,
    config: {
      video: false,
      screenshots: false,
      chromeWebSecurity: false,
    },
  });

Throws this error:

Could not find any tests to run.
We looked but did not find a cypress.json file in this folder: /private/var/tmp/_bazel_fabianwiles/c571a69fa4295dd5b9f7cd85a11a7fa1/execroot/myworkspace/bazel-out/darwin-fastbuild/bin/apps/projectname/e2e

Yet I specified what spec files to run in the above config

You may ask why not just make a cypress.json?
This is apart of a bigger integration into the Bazel build system: bazel-contrib/rules_nodejs#607 and running tests under bazel it's a lot easier to not have to write any config files, it's going to make it much easier if we can specify everything from a Nodejs program.

If we could solve this and those couple of other small issues it'll be very easy for downstream consumers of Bazel to use Cypress with their projects

@jennifer-shehane
Copy link
Member

Yeah, that is an open issue that has a PR in review: #1369

This is a great use case for allowing configFile: false. I would suggest following the issue above and closing this issue.

@jennifer-shehane jennifer-shehane removed the stage: awaiting response Potential fix was proposed; awaiting response label Jul 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants