HTML Diff
0 added 0 removed
Original 2026-01-01
Modified 2026-02-21
1 <p>Conventional asserts have a powerful alternative:<a>power-assert</a>. This library adds a little magic to a familiar tool.</p>
1 <p>Conventional asserts have a powerful alternative:<a>power-assert</a>. This library adds a little magic to a familiar tool.</p>
2 <p>Here's an example of a check using the standard<em>assert</em>module:</p>
2 <p>Here's an example of a check using the standard<em>assert</em>module:</p>
3 <p>The output shows the statement itself and the result of the test. But it isn't clear what the user object is and what structure it has. To get this information, you'll have to get involved in debugging. But you can instead use the<em>power-assert</em>library:</p>
3 <p>The output shows the statement itself and the result of the test. But it isn't clear what the user object is and what structure it has. To get this information, you'll have to get involved in debugging. But you can instead use the<em>power-assert</em>library:</p>
4 <p>And look at the output:</p>
4 <p>And look at the output:</p>
5 <p>Try to stop and examine this conclusion carefully. What is shown here?<em>power-assert</em>makes debugging as easy as physically possible. It shows the value of each object and the result of each operation included in the expression passed to the<em>assert</em>function. In addition, at the end it compares the lines and says exactly what the difference was between them.</p>
5 <p>Try to stop and examine this conclusion carefully. What is shown here?<em>power-assert</em>makes debugging as easy as physically possible. It shows the value of each object and the result of each operation included in the expression passed to the<em>assert</em>function. In addition, at the end it compares the lines and says exactly what the difference was between them.</p>
6 <p>Here's another interesting example from the documentation:</p>
6 <p>Here's another interesting example from the documentation:</p>
7 <p>Impressed? Most modern frameworks don't produce an output as convenient as what<em>power-assert</em>does. It can be integrated with anything, but you will need additional tools to get this mapping, such as Babel / Webpack or other libraries listed in the<a>documentation</a>.</p>
7 <p>Impressed? Most modern frameworks don't produce an output as convenient as what<em>power-assert</em>does. It can be integrated with anything, but you will need additional tools to get this mapping, such as Babel / Webpack or other libraries listed in the<a>documentation</a>.</p>
8 <p>An example of using power-assert with Babel:</p>
8 <p>An example of using power-assert with Babel:</p>