How to output debugging information from static function tests?

When I run unit test using intern, it writes console.log to standard output, which is useful when developing tests.

However, functional tests seem to suppress the output - writing to console.log does nothing, and I cannot find a way to output the text to the console. This means that when something goes wrong, it is very difficult to figure out why.

+6
source share
1 answer

Where console.log text output depends on the environment in which the tests are run. When you run the intern-client , which runs only unit tests, the test code is always executed in the Node.js environment and console.log writes to the standard output in the terminal.

When you run intern-runner , unit tests run in the browser, and function tests run in Node.js. This means that the console.log statements in unit tests (those specified in the suites property for the intern configuration) will not print to stdout in the terminal, but will be displayed in the browser console. Log statements in functional tests (those specified in functionalSuites ) will be displayed on the stdout terminal. The exception is the logical operators in the execute or executeAsync , which will be displayed in the browser console, since the code in these blocks will actually be executed in the browser.

+2
source

Source: https://habr.com/ru/post/989006/


All Articles