When I run a unit test using intern, it writes console.log to the standard output, which is useful when developing the tests.
However, functional tests apparently suppress output - writing to console.log does not do anything, and I can not find any way to output text to the console. Which means when something goes wrong, it is very difficult to find out why.
Where console.log
outputs text depends on what environment the tests are running in. When you run intern-client
, which only runs unit tests, the test code always runs in the Node.js environment and console.log
writes to stdout in the terminal.
When you run intern-runner
, unit tests run in the browser while functional tests run in Node.js. This means that console.log
statements in the unit tests (those specified in the suites
property of the intern config) will not print to stdout in the terminal, but instead will be output in the browser's console. Log statements in functional tests (those specified in functionalSuites
) will be output to the terminal's stdout. The exception is log statements in execute
or executeAsync
blocks, which will be output to the browser's console since code in those blocks will actually be executed in the browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With