Intern 2.2 released

By on December 5, 2014 12:24 pm

Today we’re pleased to announce the release of Intern 2.2. Along with improvements to existing functionality and a few bug fixes, this release includes a new console-mode reporter that provides a more detailed view of the testing process and improved rendering of differences between objects. Full details are in the release notes; read on for some of the highlights!

Console pretty reporter

The most visible change in this release is the addition of a “pretty” reporter that shows progress indicators in the console for each environment under test.

The reporter displays the status of each test in a progress meter, with “✓”, “×”, and “~” symbols indicating passing, failing, and skipped tests, respectively. A separate progress bar is shown for each environment under test, making it easy to see which platforms are having problems.

Similar to the console reporter, full results are displayed when the tests have all completed, but the pretty reporter groups them by pass/fail/skip status to make it easier to find and review the most important test results. Results are colorized for both the progress indicator and final results; passing tests are green while failing tests are red.

The pretty reporter can be used with both intern-client and intern-runner by specifying the “pretty” reporter on the command line or in the intern test configuration file. For example:

$ ./node_modules/.bin/intern-client config=tests/intern reporters=pretty

This reporter will become the default reporter in a future version of Intern.

Object differencing

Intern 2.2 also includes new functionality that makes it easier to see the difference between two objects when an assertion failure occurs:

AssertionError: expected [ Array(17) ] to deeply equal [ Array(16) ]

  [
E   0: 0,
A   0: 1,
    1: 1,
    2: 2,
    3: 3,
    4: 4,
[...]
    11: 11,
    12: 12,
    13: 13,
    14: 14,
E   15: 15,
E   length: 16
A   15: 32,
A   16: 33,
A   length: 17
  ]

Lines marked with E indicate expected results, while lines marked with A are the actual results.

Object diffs in Intern correctly show properties with undefined and function value types, as well as non-numeric properties set on arrays, unlike test systems like Mocha which only show properties that can be serialised by JSON.stringify. They are also displayed in the console reporter in browsers.

General improvements

As always, this release includes a number of other improvements to Intern’s existing functionality:

  • Reporters are now loaded earlier in the testing process, allowing errors that occur when loading test modules to be reported.
  • The HTML reporter now now displays a default message for tests that were explicitly skipped but where no message was provided.
  • intern-runner now correctly handles errors that occur when starting a tunnel or loading functional test modules.
  • The TeamCity reporter has been updated to provide TeamCity-compatible ISO-8601 date strings.
  • Empty values can now be provided for suites and functionalSuites on the command line.
  • Intern’s source map resolution now properly handles relative source map paths.
  • A race condition caused by downloading tunnel software on a fast connection has been fixed.
  • The deepEqual assertion check in the Geezer edition has been updated to match the behavior of newer versions of Chai.

Conclusion

For more information on Intern’s features, usage examples, and documentation, please visit the Intern Web site. If you’re not sure where to start with Intern, or you need some help making your code more testable, SitePen can help! Contact us for a free 30-minute consultation.