diff --git a/docs/debugging.md b/docs/debugging.md index 7fc1515..d4ed37c 100644 --- a/docs/debugging.md +++ b/docs/debugging.md @@ -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 @@ -69,7 +70,7 @@ chimpy --debugCucumber chimpy --debugCucumber= ``` -To debug mode and break on start: +To turn on debug mode and break on start: ```shell chimpy --debugBrkCucumber @@ -77,6 +78,23 @@ chimpy --debugBrkCucumber chimpy --debugBrkCucumber= ``` +### In Node >= 8.0 +You can use these command line switched to do that: + +```shell +chimpy --inspectCucumber +# or +chimpy --inspectCucumber= +``` + +To turn on inspect mode and break on start: + +```shell +chimpy --inspectBrkCucumber +# or +chimpy --inspectBrkCucumber= +``` + You can then connect your favorite debugger and enjoy! # Debug Mocha (Your Specs) @@ -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 @@ -104,6 +123,23 @@ chimpy --debugBrkMocha chimpy --debugBrkMocha= ``` +### In Node >= 8.0 +You can use these command line switched to do that: + +```shell +chimpy --inspectMocha +# or +chimpy --inspectMocha= +``` + +To turn on inspect mode and break on start: + +```shell +chimpy --inspectBrkMocha +# or +chimpy --inspectBrkMocha= +``` + #### *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. \ No newline at end of file diff --git a/src/lib/cucumberjs/cucumber.js b/src/lib/cucumberjs/cucumber.js index a62362a..fdfdefe 100644 --- a/src/lib/cucumberjs/cucumber.js +++ b/src/lib/cucumberjs/cucumber.js @@ -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)) {