Mocha 1.4.0

This is another relatively small release but still has some goodies!

.only()

By appending .only() Mocha will generate an internal .grep() call for you. This is very useful if you have a regression and a test-case fails. Instead of moving the test-case and associated code out in order to debug you can simply invoke it.only(title, callback) (for the BDD UI) and Mocha will ignore all others. Here’s an example that will execute “bar” and its test-cases only:

describe('foo', function(){
  it('should foo', function(){

  })
})

describe.only('bar', function(){
  it('should bar', function(){

  })
})

.skip()

By appending .skip() you can tell Mocha to ignore these tests. This was previously called xdescribe(), xit() etc to match other frameworks (Jasmine I believe?) but we decided to go with .skip() which is more readable. The jasmine-style functions will remain for now but they will be removed in the future. This is effectively the same as commenting out cases, however they remain in a pending state so that you do not forget to re-enable them.

describe('foo', function(){
  it.skip('should foo', function(){

  })
})

describe('bar', function(){
  it('should bar', function(){

  })
})

Filtering HTML passes and failures

The “passes” and “failures” labels are now clickable links that will filter respectively.

Retina

The canvas progress reporter is now retina-enabled via the autoscale-canvas component. No more ugly pixelated progress!

Changelog

Here’s the full changelog between 1.3 and 1.4:

  • add mkdir -p to mocha init. Closes #539
  • add .only(). Closes #524
  • add .skip(). Closes #524
  • add passes/failures toggling to HTML reporter
  • add pending state to xit() and xdescribe() [Brian Moore]
  • add the @charset “UTF-8”; to fix #522 with FireFox. [Jonathan Creamer]
  • add border-bottom to #stats links
  • add check for runnable in Runner#uncaught(). Closes #494
  • add 0.4 and 0.6 back to travis.yml
  • add -E, --growl-errors to growl on failures only
  • add prefixes to debug() names. Closes #497
  • add Mocha#invert() to js api
  • change str.trim() to use utils.trim(). Closes #533
  • change dot reporter to use sexy unicode dots
  • fix HTML progress indicator retina display
  • fix url-encoding of click-to-grep HTML functionality
  • fix exports double-execution regression. Closes #531
  • fix error when clicking pending test in HTML reporter
  • fix make tm

Notes

  1. tjholowaychuk posted this