Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for diff output for failed tests
- Loading branch information
Andreas Krummsdorf
committed
Feb 19, 2016
1 parent
87136f5
commit ee73dfa
Showing
8 changed files
with
331 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,73 @@ | |||
module.exports = function (config) { | |||
config.set({ | |||
// base path, that will be used to resolve files and exclude | |||
basePath: '../', | |||
|
|||
frameworks: ['mocha', 'chai'], | |||
|
|||
// list of files / patterns to load in the browser | |||
files: [ | |||
'demo/mocha.spec.js' | |||
], | |||
|
|||
mochaReporter: { | |||
showDiff: true | |||
}, | |||
|
|||
// use dots reporter, as travis terminal does not support escaping sequences | |||
// possible values: 'dots', 'progress' | |||
// CLI --reporters progress | |||
reporters: ['mocha'], | |||
|
|||
// web server port | |||
// CLI --port 9876 | |||
port: 9876, | |||
|
|||
// enable / disable colors in the output (reporters and logs) | |||
// CLI --colors --no-colors | |||
colors: true, | |||
|
|||
// level of logging | |||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | |||
// CLI --log-level debug | |||
logLevel: config.LOG_INFO, | |||
|
|||
// enable / disable watching file and executing tests whenever any file changes | |||
// CLI --auto-watch --no-auto-watch | |||
autoWatch: false, | |||
|
|||
// Start these browsers, currently available: | |||
// - Chrome | |||
// - ChromeCanary | |||
// - Firefox | |||
// - Opera | |||
// - Safari (only Mac) | |||
// - PhantomJS | |||
// - IE (only Windows) | |||
// CLI --browsers Chrome,Firefox,Safari | |||
browsers: [process.env.TRAVIS ? 'Firefox' : 'Chrome'], | |||
|
|||
// If browser does not capture in given timeout [ms], kill it | |||
// CLI --capture-timeout 5000 | |||
captureTimeout: 20000, | |||
|
|||
// Auto run tests on start (when browsers are captured) and exit | |||
// CLI --single-run --no-single-run | |||
singleRun: true, | |||
|
|||
// report which specs are slower than 500ms | |||
// CLI --report-slower-than 500 | |||
reportSlowerThan: 500, | |||
|
|||
plugins: [ | |||
'karma-mocha', | |||
'karma-mocha-reporter', | |||
'karma-chrome-launcher', | |||
'karma-firefox-launcher', | |||
'karma-ie-launcher', | |||
'karma-safari-launcher', | |||
'karma-phantomjs-launcher', | |||
'karma-chai' | |||
] | |||
}); | |||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,47 @@ | |||
'use strict'; | |||
|
|||
describe('A mocha test suite', function () { | |||
|
|||
it('should work', function () { | |||
var expected = 'foo'; | |||
var actual = 'foo'; | |||
expect(actual).to.equal(expected); | |||
}); | |||
|
|||
it('should show a string diff', function () { | |||
var expected = 'foo'; | |||
var actual = 'foo bar'; | |||
expect(actual).to.equal(expected); | |||
}); | |||
|
|||
it('should show an array diff', function () { | |||
var expected = [ | |||
'foo', | |||
'bar' | |||
]; | |||
var actual = [ | |||
'bar', | |||
'baz' | |||
]; | |||
expect(actual).to.deep.equal(expected); | |||
}); | |||
|
|||
it('should show an object diff', function () { | |||
var expected = { | |||
foo: 42, | |||
bar: 1764, | |||
baz: { | |||
qux: 'bleep', | |||
norf: 'bloop' | |||
} | |||
}; | |||
var actual = { | |||
bar: 1764, | |||
baz: { | |||
norf: 'bloop' | |||
}, | |||
random: true | |||
}; | |||
expect(actual).to.deep.equal(expected); | |||
}); | |||
}); |
Oops, something went wrong.