use the fabulous screencast-reporter

This commit is contained in:
Spencer Alger
2014-09-23 09:55:17 -07:00
parent 03a776daf1
commit 230578d4bc
5 changed files with 18 additions and 36 deletions

View File

@ -64,6 +64,7 @@
"load-grunt-tasks": "~0.2.0",
"mocha": "~1.21.4",
"mocha-lcov-reporter": "0.0.1",
"mocha-screencast-reporter": "~0.1.4",
"moment": "~2.4.0",
"nock": "~0.28.3",
"open": "0.0.4",

View File

@ -4,16 +4,16 @@
<meta charset="utf-8">
<title>Mocha Tests</title>
<link rel="stylesheet" href="mocha.css" />
<link rel="stylesheet" href="screencast-reporter.css" />
</head>
<body>
<div id="mocha"></div>
<script src="expect.js"></script>
<script src="mocha.js"></script>
<script src="screencast-reporter.js"></script>
<script>
mocha.setup('bdd');
// sauce labs & selenium inject global variables that break this
// mocha.checkLeaks();
// mocha.globals(['mochaRunner', 'angular']);
mocha.reporter(ScreencastReporter);
</script>
<!-- libs -->
<script src="jquery.js"></script>

View File

@ -4,47 +4,22 @@
<meta charset="utf-8">
<title>Mocha Tests</title>
<link rel="stylesheet" href="mocha.css" />
<link rel="stylesheet" href="screencast-reporter.css" />
</head>
<body>
<div id="mocha"></div>
<script src="expect.js"></script>
<script src="mocha.js"></script>
<script src="screencast-reporter.js"></script>
<script>
mocha.setup('bdd');
// sauce labs & selenium inject global variables that break this
// mocha.checkLeaks();
// mocha.globals(['mochaRunner', 'angular']);
mocha.reporter(ScreencastReporter);
</script>
<script src="unit_tests.js"></script>
<script>
(function (root) {
var failedTests = [];
var flattenTitles = function (test) {
var titles = [];
while (test && test.parent && test.parent.title) {
titles.unshift(test.parent.title);
test = test.parent
}
return titles;
};
var runner = root.mochaRunner = mocha.run()
.on('end', function(){
window.mochaResults = runner.stats;
window.mochaResults.reports = failedTests;
})
.on('fail', function logFailure(test, err){
failedTests.push({
name: test.title,
result: false,
message: err.message,
stack: err.stack,
titles: flattenTitles(test)
});
});
}(window));
mochaRunner = mocha.run().on('end', function(){
window.mochaResults = this.stats;
});
</script>
</body>
</html>

View File

@ -101,7 +101,9 @@ describe('Angular esFactory', function () {
return $http(config);
});
return client.ping();
return client.ping({
requestTimeout: 1000
});
});
});
@ -135,7 +137,9 @@ describe('Angular esFactory', function () {
});
});
var prom = client.ping();
var prom = client.ping({
requestTimeout: 1000
});
return prom.then(function () {
expect($httpParams).to.have.property('headers');
expect($httpParams.headers).to.have.property('Authorization', authHeader);

View File

@ -91,6 +91,8 @@ app
.get('/expect.js', sendFile(root + '/node_modules/expect.js/expect.js'))
.get('/mocha.css', sendFile(root + '/node_modules/mocha/mocha.css'))
.get('/mocha.js', sendFile(root + '/node_modules/mocha/mocha.js'))
.get('/screencast-reporter.css', sendFile(root + '/node_modules/mocha-screencast-reporter/screencast-reporter.css'))
.get('/screencast-reporter.js', sendFile(root + '/node_modules/mocha-screencast-reporter/screencast-reporter.js'))
// libs
.get('/angular.js', sendFile(root + '/bower_components/angular/angular.js'))