testcafe-browser-provider-browserstack
testcafe-browser-provider-browserstack copied to clipboard
Error: Cannot find module 'browserstack-config.json'
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?
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.
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.
@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"
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.
@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?
Hi @nick-msm ,
Thank you for reminding. I put it in our TODO list.
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.