mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-24 12:07:10 -04:00
Refactor test runner
This commit is contained in:
parent
df76ca0807
commit
c8bffa006b
4 changed files with 55 additions and 37 deletions
|
@ -3,7 +3,7 @@ html
|
|||
head
|
||||
meta( charset="utf-8" )
|
||||
meta( http-equiv="x-ua-compatible", content="ie=edge" )
|
||||
title h5ai #{pkg.version} test suite
|
||||
title h5ai test suite - v#{pkg.version}
|
||||
meta( name="viewport", content="width=device-width, initial-scale=1" )
|
||||
link( rel="stylesheet", href="h5ai-styles.css" )
|
||||
link( rel="stylesheet", href="styles.css" )
|
||||
|
@ -11,8 +11,4 @@ html
|
|||
script( src="scripts.js" )
|
||||
|
||||
body
|
||||
div#mocha-custom
|
||||
a( href="index.html" ) h5ai #{pkg.version}
|
||||
div.stats
|
||||
div.progress
|
||||
div#mocha
|
||||
|
|
|
@ -1,42 +1,35 @@
|
|||
// @include "lib/*.js"
|
||||
// @include "util/*.js"
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
$(function () {
|
||||
'use strict';
|
||||
|
||||
modulejs.define('config', util.uniqObj());
|
||||
_.each(modulejs._private.instances, function (val, key) {
|
||||
delete modulejs._private.instances[key];
|
||||
util.mockConfigModule();
|
||||
util.clearModulejs();
|
||||
util.setupMocha();
|
||||
|
||||
describe('all tests', function () {
|
||||
|
||||
// @include "tests/premisses.js"
|
||||
|
||||
describe('unit tests', function () {
|
||||
|
||||
// @include "tests/unit/modulejs.js"
|
||||
// @include "tests/unit/libs.js"
|
||||
// @include "tests/unit/boot.js"
|
||||
// @include "tests/unit/config.js"
|
||||
|
||||
// @include "tests/unit/*/*.js"
|
||||
});
|
||||
|
||||
describe('integration tests', function () {
|
||||
|
||||
// @include "tests/integration/first.js"
|
||||
|
||||
// @include "tests/integration/*/*.js"
|
||||
});
|
||||
});
|
||||
|
||||
util.pinHtml();
|
||||
util.runMocha();
|
||||
});
|
||||
|
||||
util.setupMocha();
|
||||
|
||||
describe('all tests', function () {
|
||||
|
||||
// @include "tests/premisses.js"
|
||||
|
||||
describe('unit tests', function () {
|
||||
|
||||
// @include "tests/unit/modulejs.js"
|
||||
// @include "tests/unit/libs.js"
|
||||
// @include "tests/unit/boot.js"
|
||||
// @include "tests/unit/config.js"
|
||||
|
||||
// @include "tests/unit/*/*.js"
|
||||
});
|
||||
|
||||
describe('integration tests', function () {
|
||||
|
||||
// @include "tests/integration/first.js"
|
||||
|
||||
// @include "tests/integration/*/*.js"
|
||||
});
|
||||
});
|
||||
|
||||
}());
|
||||
|
|
|
@ -2,6 +2,13 @@
|
|||
'use strict';
|
||||
|
||||
var showOnlyFailures = false;
|
||||
var template =
|
||||
'<div id="mocha-custom">' +
|
||||
'<a href="index.html"/>' +
|
||||
'<div class="stats"/>' +
|
||||
'<div class="progress"/>' +
|
||||
'</div>';
|
||||
|
||||
|
||||
function toggleFailureFilter(ev) {
|
||||
|
||||
|
@ -84,6 +91,7 @@ function setupMocha() {
|
|||
|
||||
function runMocha() {
|
||||
|
||||
$(template).appendTo('#mocha').find('a').text(document.title);
|
||||
mocha.run().on('test', onTest).on('end', onEnd);
|
||||
}
|
||||
|
||||
|
|
21
test/util/modulejs.js
Normal file
21
test/util/modulejs.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
|
||||
function clearModulejs() {
|
||||
|
||||
_.each(modulejs._private.instances, function (val, key) {
|
||||
delete modulejs._private.instances[key];
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function mockConfigModule() {
|
||||
|
||||
modulejs.define('config', util.uniqObj());
|
||||
}
|
||||
|
||||
window.util = window.util || {};
|
||||
window.util.clearModulejs = clearModulejs;
|
||||
window.util.mockConfigModule = mockConfigModule;
|
||||
|
||||
}());
|
Loading…
Add table
Add a link
Reference in a new issue