Skip to content

Commit 05cccd4

Browse files
committed
Added test for copying staticDist
1 parent ee77b12 commit 05cccd4

File tree

2 files changed

+42
-20
lines changed

2 files changed

+42
-20
lines changed

build/build_test.js

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
require("./make_default_helpers_test");
22

3-
var getRenderer = require('./get_renderer'),
4-
getPartials = require('./get_partials'),
5-
build = require("./build"),
6-
assert = require('assert'),
7-
Q = require('q'),
8-
path = require('path'),
9-
rmdir = require('rimraf'),
10-
fs = require('fs');
3+
var getRenderer = require('./get_renderer');
4+
var getPartials = require('./get_partials');
5+
var build = require("./build");
6+
var assert = require('assert');
7+
var Q = require('q');
8+
var path = require('path');
9+
var rmdir = require('rimraf');
10+
var fs = require('fs');
11+
var read = Q.denodeify(fs.readFile);
1112

1213
describe("documentjs/lib/generators/html/build",function(){
1314

@@ -105,21 +106,39 @@ describe("documentjs/lib/generators/html/build",function(){
105106

106107
});
107108

108-
it("builds the static dist", function(done){
109+
it("builds the static dist", function(){
109110
this.timeout(120000);
110-
build.staticDist({
111+
return build.staticDist({
111112
forceBuild: true,
112-
html: {dependencies: {"can-component": "3.0.0-pre.9"}}
113-
}).then(function(result){
114-
fs.readFile(path.join(__dirname, "..", result.distFolder, "bundles","bit-docs-site","static.js"), function(err, res){
115-
if(err) {
116-
done(err);
117-
} else {
118-
assert.ok(/can-component/.test(res), "got static.js with component");
119-
done();
113+
html: {
114+
dependencies: {
115+
"can-component": "3.0.0-pre.9"
120116
}
121-
});
122-
}, done);
117+
}
118+
}).then(function(result){
119+
return read(path.join(__dirname, "..", result.distFolder, "bundles","bit-docs-site","static.js"));
120+
}).then(function(res){
121+
assert.ok(/can-component/.test(res), "got static.js with component");
122+
});
123+
});
124+
125+
it("copy staticDist files to static dist", function(){
126+
this.timeout(120000);
127+
return build.staticDist({
128+
forceBuild: true,
129+
html: {
130+
dependencies: {
131+
"can-component": "3.0.0-pre.9"
132+
},
133+
staticDist: [
134+
'test-static-dist'
135+
]
136+
},
137+
}).then(function(result){
138+
return read(path.join(__dirname, "..", result.distFolder, "test.css"));
139+
}).then(function(res){
140+
assert.ok(/#TestID/.test(res), "got static.js with component");
141+
});
123142
});
124143

125144
it("makes linked content",function(done){

test-static-dist/test.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#TestID {
2+
display: block;
3+
}

0 commit comments

Comments
 (0)