Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to output debugging information from intern functional tests?

Tags:

intern

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.

like image 650
Benubird Avatar asked Jun 12 '15 12:06

Benubird


1 Answers

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.

like image 89
jason0x43 Avatar answered Oct 28 '22 21:10

jason0x43