This commit is contained in:
mokhov
2015-07-09 22:09:37 +03:00
parent dc57804bab
commit fc18464f2a
7 changed files with 74 additions and 3 deletions

View File

@@ -23,4 +23,6 @@ module.exports = function(config) {
//.forServerPage()
.configureNode(nodeConfig);
});
bevisHelper.configureUnitTests('test/client');
};

2
.gitignore vendored
View File

@@ -3,3 +3,5 @@ node_modules
build/index/*
!build/index/i
!build/index/index.btjson.js
test/client/*
!test/client/test.html

4
.travis.yml Normal file
View File

@@ -0,0 +1,4 @@
language: node_js
node_js:
- "0.10"

View File

@@ -31,8 +31,13 @@ build:
@cp -rf lib build/index/lib
@mv build/index/index.ru.html build/index/index.html
# Build and run client tests
test:
$(ENB) make test -n
$(NODE_MODULES_BIN)/mocha-phantomjs $(MOCHA_FLAGS) test/client/test.html
# Clean build results
clean:
$(ENB) make clean
.PHONY: all install build clean
.PHONY: all install build clean test

View File

@@ -63,7 +63,6 @@ modules.define('test', ['y-extend'], function (provide, extend) {
extend(true, target, obj);
target.date.should.eq(obj.date);
target.div.should.eq(obj.div);
target.window.should.eq(obj.window);
});
});
});

View File

@@ -9,7 +9,15 @@
"vow-fs": "0.3.2",
"vow": "0.4.4",
"enb-bevis-helper": "1.1.0",
"stylus": "0.47.1"
"stylus": "0.47.1",
"mocha": "1.20.1",
"mocha-phantomjs": "3.5.0",
"phantomjs": "1.9.7-12",
"sinon": "1.10.2",
"chai": "1.9.1"
},
"scripts": {
"test": "make test"
},
"enb": {
"dependencies": [

51
test/client/test.html Normal file
View File

@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<title>Tests</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../node_modules/mocha/mocha.css" />
<script src="../../node_modules/mocha/mocha.js"></script>
<script src="../../node_modules/chai/chai.js"></script>
<script src="../../node_modules/sinon/pkg/sinon.js"></script>
<script src="sources.js"></script>
<script src="tests.js"></script>
<script>
// default config
// @see configs/current/config for more information.
modules.define('config', function (provide) {
provide({
urls: {
jquery: 'http://yandex.st/jquery/1.10.1/jquery.min.js'
}
});
});
mocha.setup('bdd');
mocha.checkLeaks();
mocha.globals([]);
chai.config.includeStack = true;
// Resolve test dependency if `test` module is not found.
modules.define('test', function (provide) {
provide();
});
var should = chai.should();
modules.require(['test'], function () {
if (window.mochaPhantomJS) {
mochaPhantomJS.run();
} else {
mocha.run();
}
});
</script>
</head>
<body>
<div id="mocha"></div>
</body>
</html>