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

Adding inspect mode for Node >= 8.0 #161

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
38 changes: 37 additions & 1 deletion docs/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Use the `debugger;` statement in your code to create a breakpoints. You can plac

## 2. Tell Chimpy to start Cucumber in debug mode

### In Node < 8.0
You can use these command line switched to do that:

```shell
Expand All @@ -69,14 +70,31 @@ chimpy --debugCucumber
chimpy --debugCucumber=<port>
```

To debug mode and break on start:
To turn on debug mode and break on start:

```shell
chimpy --debugBrkCucumber
# or
chimpy --debugBrkCucumber=<port>
```

### In Node >= 8.0
You can use these command line switched to do that:

```shell
chimpy --inspectCucumber
# or
chimpy --inspectCucumber=<port>
```

To turn on inspect mode and break on start:

```shell
chimpy --inspectBrkCucumber
# or
chimpy --inspectBrkCucumber=<port>
```

You can then connect your favorite debugger and enjoy!

# Debug Mocha (Your Specs)
Expand All @@ -88,6 +106,7 @@ Use the `debugger;` statement in your code to create a breakpoints. You can plac

## 2. Tell Chimpy to start Mocha in debug mode

### In Node < 8.0
You can use these command line switched to do that:

```shell
Expand All @@ -104,6 +123,23 @@ chimpy --debugBrkMocha
chimpy --debugBrkMocha=<port>
```

### In Node >= 8.0
You can use these command line switched to do that:

```shell
chimpy --inspectMocha
# or
chimpy --inspectMocha=<port>
```

To turn on inspect mode and break on start:

```shell
chimpy --inspectBrkMocha
# or
chimpy --inspectBrkMocha=<port>
```

#### *Want to become a testing Ninja?*

Checkout Xolv.io's new [Quality Faster](https://www.qualityfaster.com/?utm_source=XolvOSS&utm_medium=OSSDocs&utm_content=ChimpyRM-Home&utm_campaign=QFLaunch) guide where you can learn how to can bake quality in across the full stack using React, Node.JS, Jest, Meteor and more.
20 changes: 20 additions & 0 deletions src/lib/cucumberjs/cucumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,26 @@ class Cucumber {
}
}

if (this.options.inspectCucumber) {
port = parseInt(this.options.inspectCucumber);

if (port > 1) {
opts.execArgv = ['--inspect=' + port];
} else {
opts.execArgv = ['--inspect'];
}
}

if (this.options.inspectCucumberBrk) {
port = parseInt(this.options.inspectBrkCucumber);

if (port > 1) {
opts.execArgv = ['--inspect-brk=' + port];
} else {
opts.execArgv = ['--inspect-brk'];
}
}

this.cucumberChild = cp.fork(path.join(__dirname, 'cucumber-wrapper.js'), args, opts);

if (booleanHelper.isTruthy(this.options.conditionOutput)) {
Expand Down