Skip to content
This repository has been archived by the owner on Jan 13, 2018. It is now read-only.

Commit

Permalink
Merge pull request #454 from bem/feature/base-tech-tests
Browse files Browse the repository at this point in the history
Tests for base tech module API v2
  • Loading branch information
arikon committed Sep 12, 2013
2 parents aefd788 + 96bb278 commit 817b224
Show file tree
Hide file tree
Showing 7 changed files with 342 additions and 14 deletions.
6 changes: 3 additions & 3 deletions lib/tech/v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ var Q = require('q'),
readAllContent: function(prefix) {
var _this = this,
res = {};

return Q
.all(this.getCreateSuffixes().map(function(suffix) {
return _this.readContent(_this.getPath(prefix, suffix), suffix)
Expand Down Expand Up @@ -236,8 +236,8 @@ var Q = require('q'),
* Return build result chunk.
*
* @protected
* @param {String} relPath Relative path to source object.
* @param {String} path Path to source object.
* @param {String} relPath Path to source object, relative to output directory.
* @param {String} path Absolute path to source object.
* @param {String} suffix Suffix of source object.
* @returns {String} Build result chunk.
*/
Expand Down
2 changes: 1 addition & 1 deletion npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@
"chai": "~1.7.2",
"coverjs": ">= 0.0.7-alpha",
"jshint": "~2.1.4",
"sinon": "~1.7.3"
"sinon": "~1.7.3",
"chai-as-promised": "~3.3.1",
"require-mocked": "~0.2.1",
"mocha-as-promised": "~1.4.0"
},
"scripts": {
"test": "make test",
Expand Down
13 changes: 5 additions & 8 deletions test/bem-make.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,16 @@ describe('bem', function() {
.done();
});

it('creates proper artifacts', function(done) {
return BEM.util.exec(
it('creates proper artifacts', function() {
return assert.eventually.isNull(
BEM.util.exec(
UTIL.format(
'find %s -type f -exec diff -q {} %s/{} \\; 2>&1',
'.',
PATH.relative(referencePath, buildPath)),
{cwd: referencePath},
true)
.then(function(result) {
done(result && new Error(result));
})
.fail(done)
.done();
);
});

it('does not rebuild anything on next build with no changes made to the files', function(done) {
Expand Down Expand Up @@ -182,7 +179,7 @@ describe('bem', function() {
it('invalidates deps when bemdecl is modified', function(done) {
this.timeout(0);

return prepareProject()
prepareProject()
.then(function() {
BEM.api.make({root: buildPath, verbosity: 'error'})
.then(function() {
Expand Down
1 change: 1 addition & 0 deletions test/mocha.opts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--reporter spec
--require test/setup
--timeout 0
--growl
3 changes: 3 additions & 0 deletions test/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
require('mocha-as-promised')(require('mocha'));
require('chai').use(require('chai-as-promised'));

Loading

0 comments on commit 817b224

Please sign in to comment.