Skip to content

3.0.0-rc.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@csnover csnover released this 09 Jun 17:10
· 892 commits to master since this release

Release overview

👾 Please report any bugs or regressions you encounter with this release! The final release (or next RC) is scheduled for June 16!

  • End of support for IE8 and earlier
  • New executors API
  • Configurable reporters
  • New QUnit-compatible interface
  • New TypeScript ambient declarations
  • Test timeout improvements
  • Test lifecycle improvements
  • Bug fixes

Special thanks to @andyearnshaw, @apsdehal, @jason0x43, @leohuber, @nicknisi, and @plumlee for their code contributions!

Additional thanks to @Arnavion, @bartoszkaczorek, @JamesMGreene, @kitsonk, @mambocab, @mgingras, @nwhite89, @pocesar, @samplesizeofone, @sholladay, @treasonx, @vladikoff, @williamrjribeiro, and @wkeese for submitting tickets that were addressed in this release!


Backwards-incompatible changes

Here are the most common changes that need to be made when upgrading to Intern 3:

  • The new basePath configuration option takes the place of the old loader.baseUrl property. Nominally, this means that you’ll simply move a path from loaderOptions.baseUrl to basePath. loaderOptions.baseUrl should be unset (or changed to whatever you want, now that it can be set independently!).

  • Built-in reporters should now be addressed using an upper-case first letter (e.g. 'Console' instead of 'console'). The test system will warn you about deprecated reporter naming.

  • The following configuration options have been renamed for clarity:

    • useLoaderloaders
    • loaderloaderOptions

    The test system will warn you about deprecated configuration option usage.

  • excludeInstrumentation paths are now normalized to always use forward-slashes regardless of OS. Windows users using backslashes with this configuration option should update to use forward-slashes.

  • For users upgrading from Geezer, calls to this.get('remote') need to change to this.remote. Any other calls to get test or suite properties also change similarly (from this.get('property') to simply this.property).

  • The paths to loaders in loaders are now relative to the basePath instead of relative to the default working directory, so these paths may need to be adjusted slightly.

Other backwards-incompatible changes that won’t affect most users:

  • The future is now, so IE8 and earlier are no longer officially supported as targets for unit testing. Intern 2 will continue to work if you need to run tests in these dead browsers, or you may engage SitePen to create intern-geezer 3.
  • Individual test timeouts are now inherited from their parent suites instead of from Test.prototype.timeout. If you were setting a global test timeout using Test.prototype.timeout, use defaultTimeout instead.
  • In order to allow Test runs to be repeatable, the skipped property of a test can no longer be set before calling test.run to prevent the test function from running.
  • Using the intern!object interface, a test named “timeout” is no longer allowed. (The timeout property has changed to define the timeout for all tests in a given test suite.)
  • beforeEach and afterEach are no longer executed when a test is skipped with grep. If you were relying on these functions being executed for skipped tests, please open a ticket.
  • Intern now uses a Promises/A+-compatible Promises implementation. If you were using Intern Promises directly and relied on the immediate invocation properties of resolved promises (this would be unusual), some of your code may execute in the wrong order. Promise callbacks are now guaranteed to execute on the next turn through the event loop.
  • The Deferred object created by this.async no longer has then, otherwise, or always methods; if you were using these methods, use dfd.promise.then, dfd.promise.catch, and dfd.promise.finally, respectively.
  • The Promise object created by this.async no longer has otherwise or always methods; if you were accessing these methods, use catch and finally, respectively. Note that the behaviour of finally is different from the behaviour of always: if the callback passed to finally does not throw or return a value other than undefined, the value will be passed through from the earlier promise. This matches more closely the way finally works in JavaScript itself.
  • The order of certain reporter events is now slightly different. For example, the tunnelStart event is not emitted until after the tunnel is successfully started, whereas in Intern 2 it was emitted before attempting to start the tunnel.
  • There is no longer a main suite called 'main'. Instead, there are one or more root suites whose names are null. Reporters that were using /suite/end and testing on suite.name to find the root suite can typically be switched to use the runEnd event instead and look at executor.suites for the list of root suites.
  • The name of the remote environment is now added to all test IDs when running the test runner (e.g. 'internet explorer 11 on WIN8.1').
  • The JUnit reporter outputs to stdout by default. Use { id: 'JUnit', filename: 'report.xml' } to restore the previous behaviour.
  • The following configuration options have been removed:
    • autoRun → return a Promise from a before function in the configuration file
  • suite.environmentType has been removed; use suite.remote.environmentType instead.
  • Various properties have been moved away from the intern/main object:
    • configexecutor.config
    • maxConcurrencyexecutor.config.maxConcurrency
    • suitesexecutor.suites
    • tunnelexecutor.tunnel
    • grepexecutor.config.grep
  • Any custom interface that registers suites directly with Intern needs to change to use intern.executor.register instead of intern.suites. Read the custom interfaces documentation for more information.

New features

  • Reporters have a new API and are now more testable and configurable. Custom reporters using the old style continue to be supported until 4.0, but are deprecated and should be updated to conform to the new API. (#141, #257)
  • Test “executors” have been introduced. These objects represent the entire Intern testing lifecycle. They can be loaded and called directly from other JavaScript programs, and are customisable so you can make Intern conform to your preferred testing workflow. (#373)
  • A new QUnit-compatible test interface has been introduced. Got a bunch of tests already written in QUnit? Just wrap them with define([ 'intern!qunit' ], function (QUnit) { /* tests go here */ }); and you’re done! (#383)
  • Intern is now bundled with TypeScript definitions for better integration with TypeScript. (Note: due to limitations in TypeScript not all APIs are currently modelled.) (#318)

Enhancements

  • Early test run failures are now reported visibly, so you don’t have to guess why your tests aren’t loading. (#230)
  • Reporters can now pause test execution by returning promises. This allows reporters to interact with the environment to collect any extra information that needs to be reported before/after tests, like screenshots. (#368)
  • Suite lifecycle methods beforeEach and afterEach are now passed a reference to the current Test object. (#342, #369, 0450494)
  • The loader’s baseUrl property is now separate from the test system’s basePath property, so you can specify the base path for your test environment independently from the loader’s baseUrl configuration. (#249)
  • Instrumented code is cached by the instrumenting proxy during test runs, improving test runner performance. (ab03be3)
  • The new defaultTimeout configuration property specifies the default timeout for all tests in a test run. (#350)
  • The new Test#restartTimeout method allows a timeout limit to be restarted on long-running asynchronous tests. (33555ad)
  • Timeouts can now be configured on a per-suite basis by setting this.timeout inside a suite function (using TDD/BDD interfaces), or by setting the timeout property on a suite object (Object interface). (#342, #350)
  • TypeScript ambient declarations are now bundled with Intern. (#318)
  • beforeEach and afterEach are no longer executed when a test is skipped with grep. (#298)
  • Cancelling a test run with SIGINT (ctrl+c) now cleans everything up before quitting.
  • The test system will automatically terminate after a test run has completed, even if there are outstanding open sockets/timeouts created by defective code, instead of hanging forever waiting for the sockets/timeouts to finish.
  • excludeInstrumentation paths are now normalized to always use forward-slashes regardless of OS. (ab776f5)
  • Chai is updated to 3.0.0. (#387, #400)
  • NODE_ENV can now be passed from a Grunt file. (#343)
  • Code instrumentation can be completely disabled by setting excludeInstrumentation to true. (1dc4b55)
  • excludeInstrumentation paths are now normalized to always use forward-slashes regardless of OS. Windows users using backslashes with this configuration option should update to use forward-slashes. (#360, #378)
  • Remote environments can now be left open only when a test fails by setting leaveRemoteOpen to fail. (#398)
  • The test runner will now automatically retry creating a remote session if it fails the first time. The number of retry attempts is configurable with the environmentRetries configuration option. (e67cc6b)
  • All configuration options can now be specified from the command-line. (#338)
  • The code coverage global variable can now be configured using the coverageVariable option. (#329)
  • The Runner reporter has been enhanced with more colour and more output during testing. (6e80e01)
  • Leadfoot feature detection can be disabled by adding fixSessionCapabilities: false to environment capabilities. This is needed when running tests on native apps, which don’t support JavaScript execution used by the feature detection code. (leadfoot-1.3.0)
  • Local files are now transparently uploaded and used when typing a path to a local file using the type command. (leadfoot-1.5.0)
  • Stack traces for functional test commands are now a more sane length. (leadfoot-1.5.0)

Bug fixes

  • The list of suites from the configuration file are no longer passed to browsers in the query string during remote test runs. (#379)
  • Non-cancellable Promises can now be used with test timeouts. (#337)
  • Source map line numbers should now be more correct (1) on Windows, (2) for source maps that are referenced inside subdirectories, (3) on stack frames with anonymous functions. (#332, #339)
  • The JUnit reporter no longer duplicates test results. (#312, #365)
  • dfd.rejectOnError and dfd.callback now correctly return the value from the underlying callback. (#331, db4c82f)
  • Specifying a default star loader map no longer breaks the test system. (#348, #351)
  • Exotic error objects no longer crash the system when retrieving the error message. (#399)
  • The Pretty reporter will no longer hang when a fatal error occurs. (#319)
  • The Grunt task will no longer duplicate error output from the test system on failure. (#260)
  • Boolean arguments are now passed correctly from Grunt to Intern. (1d1d536)
  • Sauce Labs and TestingBot tunnels now start correctly on Node 0.12. (digdug-1.3.0, digdug-1.3.1)

Install from npm

cd /my/project/root
npm install intern@beta --save-dev

Download source