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

Update Jest-related docs #355

Merged
merged 3 commits into from
Oct 25, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions detox/local-cli/detox-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ const program = require('commander');
const path = require('path');
const cp = require('child_process');
program
.option('-r, --runner [runner]', 'Test runner (currently supports mocha)')
.option('-r, --runner [runner]', 'Test runner (supports mocha and jest)')
.option('-o, --runner-config [config]', 'Test runner config file', 'mocha.opts')
.option('-l, --loglevel [value]', 'info, debug, verbose, silly, wss')
.option('-c, --configuration [device configuration]', 'Select a device configuration from your defined configurations,'
+ 'if not supplied, and there\'s only one configuration, detox will default to it')
.option('-r, --reuse', 'Reuse existing installed app (do not delete and re-install) for a faster run.', false)
.option('-u, --cleanup', 'shutdown simulator when test is over, useful for CI scripts, to make sure detox exists cleanly with no residue', false)
.option('-u, --cleanup', 'Shutdown simulator when test is over, useful for CI scripts, to make sure detox exists cleanly with no residue', false)
.option('-d, --debug-synchronization [value]',
'When an action/expectation takes a significant amount of time use this option to print device synchronization status. '
+ 'The status will be printed if the action takes more than [value]ms to complete')
Expand Down Expand Up @@ -62,14 +62,13 @@ function runJest() {

cp.execSync(command, {
stdio: 'inherit',
env: Object.assign({},
process.env,{
configuration: program.configuration,
loglevel: program.loglevel,
cleanup: program.cleanup,
reuse: program.reuse,
debugSynchronization: program.debugSynchronization,
artifactsLocation: program.artifactsLocation
})
env: Object.assign({}, process.env, {
configuration: program.configuration,
loglevel: program.loglevel,
cleanup: program.cleanup,
reuse: program.reuse,
debugSynchronization: program.debugSynchronization,
artifactsLocation: program.artifactsLocation
})
});
}
}
8 changes: 4 additions & 4 deletions docs/APIRef.DetoxCLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ Initiating your test suite
| Option| Description |
| --- | --- |
| -h, --help | output usage information |
| -r, --runner [runner] | Test runner (currently supports mocha) |
| -r, --runner [runner] | Test runner (supports mocha and jest) |
| -o, --runner-config \<config\> | Test runner config file |
| -l, --loglevel [value] | info, debug, verbose, silly, wss |
| -c, -configuration \<device config\> | Select a device configuration from your defined figurations,if not supplied, and there's only one configuration, detox will default to it |
| -r, --reuse | Reuse existing installed app (do not delete and re-tall) for a faster run. |
| -u, --cleanup | shutdown simulator when test is over, useful for CI ipts, to make sure detox exists cleanly with no residue |
| -u, --cleanup | Shutdown simulator when test is over, useful for CI ipts, to make sure detox exists cleanly with no residue |
| -d, --debug-synchronization \<value\> | When an action/expectation takes a significant amount time use this option to print device synchronization status. The status will be printed if the ion takes more than [value]ms to complete |
| -a, --artifacts-location \<path\> | Artifacts destination path (currently contains only logs). For more details, please check the [Artifacts doc](APIRef.Artifacts.md#artifacts) |
|&#8195;&#8195;&#8195;&#8195;&#8195;&#8195;&#8195;&#8195;&#8195;&#8195;&#8195;&#8195;&#8195;&#8195;&#8195;&#8195;&#8195;&#8195;||



### build
Run a command defined in 'configuration.build'
Expand Down
8 changes: 5 additions & 3 deletions docs/Guide.Jest.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ Add this part to your `package.json`:
"setupTestFrameworkScriptFile": "./e2e/init.js"
},
"scripts": {
"test:e2e": "detox test",
"test:e2e": "detox test -c ios.sim.debug -a e2e",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-a sets artifacts output location, what did you mean by that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for some reason, if you don't specify anything, _getAbsolutePath tries to create artifacts folder under undefined/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s a different issue then, but we certainly don’t want them in our e2e tests library (or anywhere for that matter, it’s unrelated to this part of the docs). Let’s open an issue to fix that ASAP

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is related to process.cwd() in child process. I'll follow up on this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rotemmiz ok, it seems to happen only if I use xcode config (to debug using xcode), because binaryPath is not specified. Should I make an exception here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I follow why _getAbsolutePath is needed in that case, but I'll take a look in the code later.
I still think the issue you're trying to debug is out of the scope of this PR, so we can change the docs, and open a new issue with that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for miscommunication. process.cwd() has nothing to do with the issue. Yeah, I can remove artifacts part as far as it is only related to xcode debug configuration. I'll follow up on this in separated issue

"test:e2e:build": "detox build"
},
"detox": {
"runner": "jest",
...
}
```

In the `detox` part of your `package.json`, add `"runner": "jest"` to tell detox that you want to use jest runner instead of mocha.

### Writing Tests

There are some things you should notice:
Expand Down