もちろん失敗することがわかっているテストの完全な JS 例外スタックを見たくないことを除いて、問題なく動作しています。代わりに、(より便利な) 例外の先頭だけを見たいと思います。些細なことのように思えるかもしれませんが、BDD は、この種のツールからの迅速なフィードバックによって達成されるのが最善であると私は信じています。例として、モジュールから欠落している基本的なメソッドからの完全なスタック トレースを次に示します。
TypeError: Object #<Object> has no method 'delete'
at World.<anonymous> ($HOME/features/step_definitions/delete-item.steps.js:20:21)
at Object.invoke ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/support_code/step_definition.js:84:14)
at Object.execute ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/ast/step.js:157:22)
at Object.acceptVisitor ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/ast/step.js:149:12)
at Object.executeStep ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:178:12)
at Object.processStep ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:173:14)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:66:16
at callUserFunctionAndBroadcastAfterEvent ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:90:9)
at iterate ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:14:11)
at Object.forEach ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:23:7)
at broadcastToListeners ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:117:19)
at onRuntimeListenersComplete ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:113:9)
at iterate ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:14:11)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:20:11
at hear ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener.js:8:9)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener/summary_formatter.js:16:7
at Object.hear ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener.js:8:9)
at Object.hear ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener/summary_formatter.js:15:18)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:118:51
at processItem ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:19:9)
at iterate ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:12:11)
at Object.forEach ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:23:7)
at broadcastToListeners ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:117:19)
at Object.broadcastEvent ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:109:7)
at Object.broadcastBeforeEvent ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:100:12)
at Object.broadcastEventAroundUserFunction ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:84:12)
at Object.visitStep ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:63:12)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/ast/scenario.js:95:17
at processItem ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:19:9)
at iterate ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:12:11)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:20:11
at iterate ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:14:11)
at Object.forEach ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:23:7)
at broadcastToListeners ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:117:19)
at onRuntimeListenersComplete ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:113:9)
at iterate ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:14:11)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:20:11
at hear ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener.js:8:9)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener/summary_formatter.js:16:7
at Object.hear ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener.js:8:9)
at Object.hear ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener/summary_formatter.js:15:18)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:118:51
at processItem ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:19:9)
at iterate ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:12:11)
at Object.forEach ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:23:7)
at broadcastToListeners ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:117:19)
at Object.broadcastEvent ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:109:7)
at Object.broadcastAfterEvent ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:105:12)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:95:32
at iterate ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:14:11)
at Object.forEach ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:23:7)
at broadcastToListeners ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:117:19)
at onRuntimeListenersComplete ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:113:9)
at iterate ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:14:11)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:20:11
at handleStepResult ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener/summary_formatter.js:27:5)
at hear ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener.js:6:9)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener/summary_formatter.js:16:7
at handleStepResult ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener/stats_journal.js:39:5)
at Object.hear ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener.js:6:9)
at Object.hear ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener/summary_formatter.js:15:18)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:118:51
at processItem ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:19:9)
at iterate ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:12:11)
at Object.forEach ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:23:7)
at broadcastToListeners ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:117:19)
at Object.broadcastEvent ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:109:7)
at Object.visitStepResult ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:79:12)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/ast/step.js:150:17
at codeCallback ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/support_code/step_definition.js:61:11)
at World.<anonymous> ($HOME/features/step_definitions/delete-item.steps.js:16:3)
at Object.invoke ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/support_code/step_definition.js:84:14)
at Object.execute ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/ast/step.js:157:22)
at Object.acceptVisitor ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/ast/step.js:149:12)
at Object.executeStep ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:178:12)
at Object.processStep ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:173:14)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:66:16
at callUserFunctionAndBroadcastAfterEvent ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:90:9)
at iterate ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:14:11)
at Object.forEach ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:23:7)
at broadcastToListeners ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:117:19)
at onRuntimeListenersComplete ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:113:9)
at iterate ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:14:11)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:20:11
at hear ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener.js:8:9)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener/summary_formatter.js:16:7
at Object.hear ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener.js:8:9)
at Object.hear ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener/summary_formatter.js:15:18)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:118:51
at processItem ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:19:9)
at iterate ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:12:11)
at Object.forEach ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:23:7)
at broadcastToListeners ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:117:19)
at Object.broadcastEvent ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:109:7)
at Object.broadcastBeforeEvent ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:100:12)
at Object.broadcastEventAroundUserFunction ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:84:12)
at Object.visitStep ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:63:12)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/ast/scenario.js:95:17
at processItem ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:19:9)
at iterate ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:12:11)
at Object.forEach ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:23:7)
at Object.instructVisitorToVisitSteps ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/ast/scenario.js:94:13)
at Object.instructVisitorToVisitScenarioSteps ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/ast/scenario.js:90:12)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/ast/scenario.js:75:14
at Object.instructVisitorToVisitBackgroundSteps ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/ast/scenario.js:85:9)
at Object.acceptVisitor ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/ast/scenario.js:74:12)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:48:41
at callUserFunction ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/support_code/library/hooker.js:41:11)
at iterate ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:14:11)
at Object.forEach ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:23:7)
at Object.triggerBeforeHooks ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/support_code/library/hooker.js:63:19)
at callBeforeHooks ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/support_code/library/hooker.js:37:16)
at iterate ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:14:11)
at Object.forEach ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:23:7)
at hookedUpFunction ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/support_code/library/hooker.js:27:21)
at callUserFunctionAndBroadcastAfterEvent ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:90:9)
at iterate ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:14:11)
at Object.forEach ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:23:7)
at broadcastToListeners ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:117:19)
at onRuntimeListenersComplete ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:113:9)
at iterate ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:14:11)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:20:11
at hear ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener.js:8:9)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener/summary_formatter.js:16:7
at handleBeforeScenarioEvent ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener/stats_journal.js:24:5)
at Object.hear ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener.js:6:9)
at Object.hear ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/listener/summary_formatter.js:15:18)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:118:51
at processItem ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:19:9)
at iterate ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:12:11)
at Object.forEach ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/type/collection.js:23:7)
at broadcastToListeners ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:117:19)
at Object.broadcastEvent ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:109:7)
at Object.broadcastBeforeEvent ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:100:12)
at Object.broadcastEventAroundUserFunction ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:84:12)
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/runtime/ast_tree_walker.js:52:14
at $HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/support_code/library.js:71:11
at process._tickCallback (node.js:419:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:906:3
これに続いて、より便利ですが、まだ明示的ではありません。
Failing scenarios:
$HOME/features/delete-item.feature:6 # Scenario: Item removed from portfolio
$HOME/features/delete-item.feature:11 # Scenario: Item not accessible from portfolio
4 scenarios (2 failed, 2 passed)
12 steps (2 failed, 2 skipped, 8 passed)
実際、ほとんどの場合、私が気にかけているのは最初の 4 行だけです。
TypeError: Object #<Object> has no method 'delete'
at World.<anonymous> ($HOME/features/step_definitions/delete-item.steps.js:20:21)
at Object.invoke ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/support_code/step_definition.js:84:14)
at Object.execute ($HOME/node_modules/grunt-cucumber/node_modules/cucumber/lib/cucumber/ast/step.js:157:22)
何か案は?