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

Error: Could not find Cypress test run results #16

Open
kmanaseryan opened this issue Dec 1, 2020 · 3 comments
Open

Error: Could not find Cypress test run results #16

kmanaseryan opened this issue Dec 1, 2020 · 3 comments

Comments

@kmanaseryan
Copy link

kmanaseryan commented Dec 1, 2020

Following the instruction in the docs to can't run the specs.

When I run node test.js I get the following error:

The support file is missing or invalid.

Your `supportFile` is set to `/var/folders/lp/m1rj3k112s1bvqgxsy9ysm840000gp/T/ckan-uat-TBzyzH/support/index.js/index.js`, but either the file is missing or it's invalid. The `supportFile` must be a `.js` or `.coffee` file or, if you're using a preprocessor plugin, it must be supported by that plugin.

Correct your `cypress.json`, create the appropriate file, or set `supportFile` to `false` if a support file is not necessary for your project.

Or you might have renamed the extension of your `supportFile` to `.ts`. If that's the case, restart the test runner.

Learn more at https://on.cypress.io/support-file-missing-or-invalid
{ failures: 1, message: 'Could not find Cypress test run results' }

I have Cypress installed and setup with it's default folder structure.

//test.js
import cypress from "cypress";
import { CKANIntegrationTests } from "ckan-integration-tests/index.js";

const assets = new CKANIntegrationTests();
assets.addAllSpecs();

cypress
  .run(assets.options)
  .then(console.log)
  .catch(console.error)
  .finally(() => assets.cleanUp());

package.json

{
  "name": "test-int-tests",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "type": "module",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "ckan-integration-tests": "git+https://github.com/datopian/ckan-integration-tests.git",
    "ckanClient": "git+https://github.com/datopian/ckan-client-js.git#bfa869866c3bf50ada2bbc30376e0191c9c263c7",
    "cypress": "4.9.0",
    "frictionless": "git+https://github.com/frictionlessdata/frictionless-js.git#1e48a2d0c545e4294107197fa6100308ab8488e1"
  }
}

cypress.json

{
  "chromeWebSecurity": false,
  "baseUrl": "https://ckan.myserver.org/",
  "pageLoadTimeout": 120000,
  "env": {
    "FRONTEND_URL": "https://ckan.myserver.org/",
    "API_KEY": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "CKAN_USERNAME": "joanne.doe",
    "CKAN_PASSWORD": "joannes-very-secret-password",
    "ORG_NAME_SUFFIX": "_organization_test",
    "DATASET_NAME_SUFFIX": "_dataset_test"
  }
}

Environment

Cypress: 4.9.0
Node: v14.15.1
OS: Mac 11.0.1
Tried also with Cypress v6.0.0 but didn't work.

@cuducos
Copy link
Contributor

cuducos commented Dec 1, 2020

By this file path /var/folders/lp/m1rj3k112s1bvqgxsy9ysm840000gp/T/ckan-uat-TBzyzH/support/index.js/index.js I would say it might be a bug in creating the supportFile path — wouldn't it make sense to be /var/folders/lp/m1rj3k112s1bvqgxsy9ysm840000gp/T/ckan-uat-TBzyzH/support/index.js instead?

Maybe we can review the code that handles this to check whether the functions and methods have changed behavior in recent versions:

// The strategy for dynamically loading custom commands is to (a) write a
// custom `index.js` at a temporary location and, therem, import both
// `support/command.js` files (one from this package, and the other from the
// third-party one). Next, (b) we pass the path of this temporary file as the
// `supportFile` option to Cypress's run command.
const createSupportFile = (tmp, roots) => {
const file = path.join(tmp, "support", "index.js");
const contents = roots
.map((dir) => path.join(dir, "cypress", "support", "commands.js"))
.map((pth) => path.resolve(pth))
.map((pth) => `import '${pth}';`)
.join("\n");
if (!fs.existsSync(path.dirname(file))) {
fs.mkdirSync(path.dirname(file));
}
fs.writeFileSync(file, contents);
return file;
};

It's really unexpected, for me, to have const file = path.join(tmp, "support", "index.js"); resulting in whatever/index.js/index.js

@kmanaseryan
Copy link
Author

@cuducos great catch! I also noticed that and it's really weird. On line 52 if I change "index.js" to lets say "index1.js" then output in the error will be: watever/index1.js/index1.js I think this might be OS level issue, as @cotts tried at his end he didn't have this error.

I use Mac OS, version 11.0.1

@cuducos
Copy link
Contributor

cuducos commented Dec 1, 2020

I think this might be OS level issue

Makes sense. As far as I can remember, @cotts and I are running on Linux, so if you're on macOS, there is a chance that this behavior is OS-related…

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