-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtutorial-14-debugging-suman.html
executable file
·94 lines (79 loc) · 7.26 KB
/
tutorial-14-debugging-suman.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Tutorial: How to debug Suman tests</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Tutorial: How to debug Suman tests</h1>
<section>
<header>
<h2>How to debug Suman tests</h2>
</header>
<article>
<h1>Debugging Suman tests and via the Suman runner</h1><h2>Debugging using logs (stdout/stderr)</h2><p>If you see an exception/error with a test that was executed via the Suman runner, that does not occur when running the test in a single-process, your best bet is to use
logging facilities to debug, unless you are currently expert in debugging child_processes. Note that if the same problem occurs for a particular test with the runner and running the test directly, debug it first directly using node
or suman without the --runner flag.</p>
<p>debugging tips - "use strict", verbose flags, log files, SUMAN_DEBUG</p>
<p>When using the Suman runner, stdout and stderr for every test file will be logged to
suman/runner-stdout.log and suman/runner-stderr.log respectively.</p>
<p>When developing Suman tests, we recommend tailing these log files:</p>
<h2>Debugging via debugging tools</h2><ol>
<li>With node debug</li>
</ol>
<p>node debug is the "native" node way of debugging node applications</p>
<p><span style="background-color:#FF8C00"> <code>$ node debug a.test.js</code></span></p>
<ol>
<li>With Node inspector</li>
</ol>
<p>first make sure you have node-inspector installed for command line use (installed globally):</p>
<p><span style="background-color:#FF8C00"> <code>$ npm install -g node-inspector</code></span></p>
<p> if we want to debug a test directly</p>
<p><span style="background-color:#FF8C00"> <code>$ node-debug a.test.js</code></span></p>
<p> or using the suman executable and the command line options that come with it:</p>
<p><code>$ node-debug suman a.test.js --timeout=500000</code> //everything in single-process</p>
<p><code>$ node-debug suman a.test.js --timeout=500000 --runner</code> /// we want a challenge, will debug via the runner</p>
<pre class="prettyprint source"><code>/usr/local/bin/node --debug-brk=63823 --expose_debug_as=v8debug
/Users/t_millal/WebstormProjects/oresoftware/poolio/test/test-src/poolio-w-suman.test.js</code></pre><ol>
<li>With Webstorm</li>
</ol>
<p>Webstorm has a fantastic in-IDE debugging tool.</p>
<h1>Debugging the Suman runner</h1><p>If a test is failing using the runner, here are the steps you should take to debug:</p>
<ol>
<li><p>Try running that test file in isolation, using <code>node x.test.js</code> or <code>suman x.test.js</code></p>
</li>
<li><p>If the error doesn't show up in Step 1, then try running this: <code>suman test.js --runner</code>, this will tell Suman to use the runner even
though you are only running one test file. Suman is designed to make debugging easier, so the runner is not used by default when
you are only running one test file, which means you can avoid debugging child processes. During this step, check the runner logs at
<code><suman-helper-dir-root>/logs/runner-debug.log</code>. The value for <code><suman-helper-dir-root></code> is defined by the <code>sumanHelpersDir</code> property in your
suman.conf.js file.</p>
</li>
<li><p>If the original error still doesn't show up, then perhaps there is some interaction in your tests happening - perhaps they are both accessing
the same external resource. What you should do is run Suman with the <code>--concurrency=1</code> option,
so that only 1 test runs at a time with the runner.</p>
</li>
<li><p>TBD</p>
</li>
</ol>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Tutorials</h3><ul><li><a href="tutorial-00-about.html">About Suman</a></li><li><a href="tutorial-01-getting-started.html">Getting Started with Suman</a></li><li><a href="tutorial-02-simple-examples.html">Simple Examples</a></li><li><a href="tutorial-03-high-level-overview.html">Higher Level Overview</a></li><li><a href="tutorial-04-command-line-options.html">Command line options</a></li><li><a href="tutorial-05-advanced-use.html">Advanced Use</a></li><li><a href="tutorial-06-suman-config-file.html">06-suman-config-file</a></li><li><a href="tutorial-07-suman-patterns-and-recipes.html">Suman Patterns and Recipes</a></li><li><a href="tutorial-08-suman-anti-patterns.html">Suman Anti-Patterns</a></li><li><a href="tutorial-09-suman-reporters.html">Suman reporters and creating custom reporters</a></li><li><a href="tutorial-10-dependency-injection.html">10-dependency-injection</a></li><li><a href="tutorial-11-advanced-installation.html">Advanced installation of Suman</a></li><li><a href="tutorial-12-using-suman-with-babel.html">Using Suman with Babel</a></li><li><a href="tutorial-13-test-dir-organization.html">How to organize your test directory</a></li><li><a href="tutorial-14-debugging-suman.html">How to debug Suman tests</a></li><li><a href="tutorial-15-testing-child-processes-with-suman.html">Testing and debugging processes that spawn child processes</a></li><li><a href="tutorial-16-using-spies-with-suman.html">Using test spies with Suman</a></li><li><a href="tutorial-17-suman-server-and-web-reporter.html">About Suman server and built-in web reporter</a></li><li><a href="tutorial-18-tips-and-tricks.html">Tips and tricks</a></li><li><a href="tutorial-19-converting-from-mocha.html">Converting from Mocha to Suman</a></li><li><a href="tutorial-21-running-suman-against-shell-scripts.html">21-running-suman-against-shell-scripts</a></li><li><a href="tutorial-22-case-studies.html">22-case-studies</a></li><li><a href="tutorial-22-programmatic-usage-and-macros.html">22-programmatic-usage-and-macros</a></li><li><a href="tutorial-27-suman-best-practices.html">Best practices with Suman</a></li><li><a href="tutorial-30-anatomy-of-suman-suite.html">Anatomy of Suman Test Suites</a></li><li><a href="tutorial-31-workflows-with-suman.html">Workflows with Suman => Watchers and transpilation</a></li><li><a href="tutorial-40-integrating-with-ci-cd.html">Integrating with CI/CD</a></li><li><a href="tutorial-41-suman-exit-codes.html">List of Suman exit codes</a></li><li><a href="tutorial-42-hidden-secret-features.html">Some secret / hidden features of Suman</a></li><li><a href="tutorial-50-suman-parallelism.html">Complete explanation of Suman parallelism</a></li><li><a href="tutorial-70-usage-with-code-coverage-tools.html">Usage with code coverage tools (namely Istanbul)</a></li><li><a href="tutorial-90-roadmap.html">Suman roadmap and upcoming efforts</a></li><li><a href="tutorial-99-faq.html">FAQ</a></li><li><a href="tutorial-advanced-parallelization-2.html">advanced-parallelization-2</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Wed Feb 08 2017 22:39:23 GMT-0800 (PST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>