SitePen has released version 2.1 of Intern, its next generation JavaScript testing stack. The new release brings with it new HTML and JUnit reporters, grep and skip functions, and improved performance.
Intern is described by SitePen on the project's GitHub wiki as "a complete test stack for JavaScript" and says its purpose is to help developers "write and run consistent, high-quality test cases" for JavaScript libraries and applications.
Colin Snover, senior software engineer for SitePen, listed the improvements with Intern's latest release including:
- New HTML and JUnit reporters
- New test filtering with grep and skip
- Improved functional test performance
- Improved proxy performance and functionality
In the article "Intern 2.1 Released" Jason Cheatham, a software engineer with SitePen, describes the HTML and JUnit reporters:
The HTML reporter is a new default reporter for Intern’s browser client runner (client.html). It displays at the end of a test run, summarizing the test results and presenting them in an easy-to-read format.
The output of the JUnit reporter, on the other hand, is meant for machine consumption. It aggregates test results and outputs them in a report.xml file that follows generally accepted standards for JUnit-compatible XML. This makes it much easier to plug Intern into tools that accept JUnit reports, like Jenkins.
Using a continuous integration server, such as Jenkins, the new JUnit XML reporter enables test drill-down via the GUI.
The new Intern release also provides new command line arguments, functionalSuites and grep, and a new test skipping functionality.
While Cheatham says "the functionalSuites
argument works just like the existing suites
argument", the grep
argument allows the user filter test IDs using a regular expression.
Cheatham elaborates on this improvement, saying that when a test is filtered by grep, Intern skips it and reports it as skipped:
Test writers can also programmatically skip tests using the new skip function. A test can call this.skip(
) at any time to halt execution and move to the next test. The skip message will be reported by all built-in reporters, as well as any custom reporters that listen for the new /test/skip message.
Snover notes that by bypassing the unit test system entirely if there are only functional tests, the test function improves the performance of server-side app testing "and allows functional tests to be executed even when the instrumenting proxy is inaccessible."
Intern 2.1 also features some backwards-incompatible changes, these include an update to the remote.moveMouseTo
command. In version 2.0 this command was broken, moving the mouse globally instead of relative to the last found element. This regression has been fixed in the latest version, meaning that the function now works again in the same was as it previously did with Intern 1.x.
The Intern 2.1 announcement was received well by the JavaScript community, although the official announcement from SitePen drew little in the way of in depth comments on either Facebook or Twitter.
Intern is available under the terms of the New BSD License. It is an Open Source project and welcomes contributions from the community. More information on the content licence agreement can be found here.