-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
mocha: Detox interfers with .mocharc's "spec" property when Detox "specs" is not defined #3076
Comments
@ShivamJoker hello bro, i watched your youtube video and setup detox in react-native android in windows 10, only difference is i used jest instead of mocha, but getting following errors and i found you here LOL, now you have to help me....here is the issue link |
@rutvikER1999 you need to generate a test build for android with all the dependencies and detox is not supported on Windows officially Also please don't comment randomly on issues. |
The integration with Mocha is not actively developed, but you're welcome to contribute a fix to this behavior. |
I would love to if you can point me to where to look for this (files or codes in the detox) |
I'm sorry but you'll have to use
This can be handled only as a breaking change. @d4vidi |
If I just add empty array it doesn't work either
And specifying files in the array doesn't work either
|
Please provide full logs from your terminal. And .mocharc content as well. |
Logs $ detox test --configuration ios.debug
detox[92491] INFO: [test.js] mocha --config e2e/.mocharc.json --configuration ios.debug --grep :android: --invert --use-custom-logger true e2e/init.js,e2e/1_runCommand.js
Error: No test files found: "e2e/init.js,e2e/1_runCommand.js"
detox[92491] ERROR: [cli.js] Command failed: mocha --config e2e/.mocharc.json --configuration ios.debug --grep :android: --invert --use-custom-logger true e2e/init.js,e2e/1_runCommand.js .mocharc {
"bail": false,
"timeout": 180000
} the mocha cli params doesn't accept comma separated values, which detox is converting probably with |
Okay so I was trying to figure out where the issue is coming from so if we change the It also works fine if we completely remove the specs option instead of mentioning the directory which is overriding mocha return {
testRunner,
runnerConfig: customRunnerConfig || defaultRunnerConfig,
specs: globalConfig.specs.join(' ') || 'e2e',
skipLegacyWorkersInjection: Boolean(globalConfig.skipLegacyWorkersInjection),
}; Also I was wondering if we can have an option to specify test directory with an additional config to avoid adding test directory everywhere ? |
@ShivamJoker , wait-wait, initially your issue was about:
and then you tell me your
😕 My suggestion was about how to remove the conflict between Detox config and your
And again, I told you earlier this won't happen until the next major release (v20): return {
testRunner,
runnerConfig: customRunnerConfig || defaultRunnerConfig,
- specs: globalConfig.specs.join(' ') || 'e2e',
+ specs: globalConfig.specs.join(' '),
skipLegacyWorkersInjection: Boolean(globalConfig.skipLegacyWorkersInjection),
}; You have to decide either you handle it via On my local environment (I patched one of demo projects), I verified that this suggestion works: diff --git a/examples/demo-react-native/detox.config.js b/examples/demo-react-native/detox.config.js
index 52d5fc9f..c046c48b 100644
--- a/examples/demo-react-native/detox.config.js
+++ b/examples/demo-react-native/detox.config.js
@@ -1,7 +1,7 @@
module.exports = {
"test-runner": "mocha",
"runner-config": "e2e/.mocharc.json",
- "specs": process.env.DETOX_EXPOSE_GLOBALS === '0' ? 'e2eExplicitRequire' : 'e2e',
+ "specs": [],
"behavior": {
"init": {
"exposeGlobals": process.env.DETOX_EXPOSE_GLOBALS === '0' ? false : true,
diff --git a/examples/demo-react-native/e2e/.mocharc.json b/examples/demo-react-native/e2e/.mocharc.json
index 27397bf6..9e1329f0 100644
--- a/examples/demo-react-native/e2e/.mocharc.json
+++ b/examples/demo-react-native/e2e/.mocharc.json
@@ -4,5 +4,6 @@
"timeout": 300000,
"bail": true,
"file": "e2e/init.ts",
+ "spec": ["e2e/example.spec.ts"],
"extension": ["ts"] Mocha will be handling your spec list. |
I am sorry if I didn't clear things up but I tried again and it seems to be working fine thanks. |
@ShivamJoker yes, that's exactly what I did for the first time. 😊 |
@noomorph could you please guide in which file you have made the changes? Please help I'm facing the exact same issue but cannot find the way out. |
@Usama11a , it is likely to be located at |
Thanks for the response @noomorph. This is how my .mocharc file look like, but still I'm facing the same issue. { My current hierarchy looks like this:
|
|
Thanks so much @noomorph !! DetoxRuntimeError: The test APK could not be found at path: 'C:\Users\uyounas\androidTest\AndroidCalculator\AndroidCalculator-androidTest.apk' |
@Usama11a please read the docs properly you'll need two apk files one test and one debug for detox to work. And Windows might not work properly. |
@ShivamJoker could you please close the issue if everything is proper? 🙏🏻 |
@Usama11a please reiterate the getting-start guide or jump right into the android config guide. |
@d4vidi do we have a fix in latest release for specs? |
Thanks for the support guys!!! |
@ShivamJoker I was under the impression that you've managed to sort things out and that this was about a typo, ultimately. LMK if the situation is different, otherwise. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions! For more information on bots in this reporsitory, read this discussion. |
The issue has been closed for inactivity. |
Is your feature request related to a problem? Please describe.
It's a bug(gy feature) of Detox.
If I specify the spec or files option in
.mocharc.json
and I don't configure
specs
in the Detox config, relying on defaults:Actual result:
The
spec
option clearly doesn't work, because Detox overrides it with the defaulte2e
value.Describe the solution you'd like
Detox should not override
...specs
with the defaulte2e
value.Describe alternatives you've considered
If I use the detox
specs
option in.detoxrc.json
like this it worksBut suppose if you have 10-20 test files, this wont be ideal to specify it in a string
File tree:
The text was updated successfully, but these errors were encountered: