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: Cannot find module 'browserstack-config.json' #152

Open
rushby opened this issue Jun 18, 2021 · 7 comments
Open

Error: Cannot find module 'browserstack-config.json' #152

rushby opened this issue Jun 18, 2021 · 7 comments

Comments

@rushby
Copy link

rushby commented Jun 18, 2021

I have a .env file:

BROWSERSTACK_CAPABILITIES_CONFIG_PATH="./browserstack-config.json"

the browserstack-config.json is in the top level directory in the project, when I run the tests with this environment variable the following error is thrown:

Error: Cannot find module './browserstack-config.json'

Removing the environment variable successfully runs the tests, am I missing something?

@AlexKamaev
Copy link
Contributor

TestCafe doesn't provide support for .env files out of the box, so I assume that you use some custom module like dotenv for parsing .env files. There should not be any error here, however, it's difficult to recommend anything without an example that demonstrates the issue.
Please share a basic project with your .env file and dotenv (or a similar module you use) which will allow us to reproduce the issue on our side.
Please also share the command that you use to run TestCafe in terminal.

@no-response
Copy link

no-response bot commented Jul 1, 2021

This issue was automatically closed because there was no response to our request for more information from the original author. Currently, we don't have enough information to take action. Please reach out to us if you find the necessary information and are able to share it. We are also eager to know if you resolved the issue on your own and can share your findings with everyone.

@no-response no-response bot closed this as completed Jul 1, 2021
@AdrienLemaire
Copy link

@AlexKamaev I had the same issue, and it doesn't seem related to dotenv.

When the config path is required, it seems to be doing it relative to the directory node_modules/testcafe-browser-provider-browserstack/lib/.

The docs imply that the browserstack-config.json file can be set in the root dir of the project and exported as export BROWSERSTACK_CAPABILITIES_CONFIG_PATH="./browserstack-config.json", but I was only able to get the file imported by setting a path relative to the node_modules package dir.

$ export BROWSERSTACK_CAPABILITIES_CONFIG_PATH="../../../browserstack-config.json"

@alexfi1in
Copy link

Hi @AdrienLemaire

We will update our documentation and mention that a search for the BROWSERSTACK_CAPABILITIES_CONFIG_PATH file is run using the require function mechanism.

@nick-msm
Copy link

@alexphilin I don't believe the documentation was updated, I've just spent quite a bit of time debugging this issue as well. Can you commit to updating the docs please?

@Aleksey28
Copy link
Contributor

Hi @nick-msm ,

Thank you for reminding. I put it in our TODO list.

@github-actions
Copy link

This issue was automatically closed because there was no response to our request for more information from the original author. Currently, we don't have enough information to take action. Please reach out to us if you find the necessary information and are able to share it. We are also eager to know if you resolved the issue on your own and can share your findings with everyone.

@Aleksey28 Aleksey28 reopened this Jun 29, 2022
patrickathompson added a commit to patrickathompson/testcafe-browser-provider-browserstack that referenced this issue Aug 5, 2024
patrickathompson added a commit to patrickathompson/testcafe-browser-provider-browserstack that referenced this issue Aug 5, 2024
patrickathompson added a commit to patrickathompson/testcafe-browser-provider-browserstack that referenced this issue Aug 5, 2024
patrickathompson added a commit to patrickathompson/testcafe-browser-provider-browserstack that referenced this issue Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants