Comparing version 1.0.0-beta.3 to 1.0.0-beta.4
# master | ||
# 1.0.0-beta.4 | ||
* Improve test suite | ||
# 1.0.0-beta.3 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "broccoli", | ||
"description": "Fast client-side asset builder", | ||
"version": "1.0.0-beta.3", | ||
"version": "1.0.0-beta.4", | ||
"author": "Jo Liss <joliss42@gmail.com>", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
@@ -6,4 +6,4 @@ 'use strict' | ||
var path = require('path') | ||
var rimraf = require('rimraf') | ||
var RSVP = require('rsvp') | ||
var tmp = require('tmp') | ||
var broccoli = require('..') | ||
@@ -22,2 +22,4 @@ var makePlugins = require('./plugins') | ||
// Clean up left-over temporary directories on uncaught exception. | ||
tmp.setGracefulCleanup() | ||
@@ -283,9 +285,15 @@ | ||
describe('temporary directories', function() { | ||
var tmpdir, tmpRemoveCallback | ||
beforeEach(function() { | ||
rimraf.sync('test/tmp') | ||
fs.mkdirSync('test/tmp') | ||
var tmpObj = tmp.dirSync({ prefix: 'broccoli_builder_test-', unsafeCleanup: true }) | ||
tmpdir = tmpObj.name | ||
tmpRemoveCallback = tmpObj.removeCallback | ||
}) | ||
after(function() { | ||
rimraf.sync('test/tmp') | ||
afterEach(function() { | ||
if (builder) { | ||
builder.cleanup() | ||
builder = null | ||
} | ||
tmpRemoveCallback() | ||
}) | ||
@@ -311,12 +319,12 @@ | ||
it('creates temporary directory in directory given by tmpdir options', function() { | ||
builder = new Builder(new plugins.VeggiesPlugin, { tmpdir: 'test/tmp' }) | ||
expect(hasBroccoliTmpDir('test/tmp')).to.be.true | ||
builder = new Builder(new plugins.VeggiesPlugin, { tmpdir: tmpdir }) | ||
expect(hasBroccoliTmpDir(tmpdir)).to.be.true | ||
}) | ||
it('removes temporary directory when .cleanup() is called', function() { | ||
builder = new Builder(new plugins.VeggiesPlugin, { tmpdir: 'test/tmp' }) | ||
expect(hasBroccoliTmpDir('test/tmp')).to.be.true | ||
builder = new Builder(new plugins.VeggiesPlugin, { tmpdir: tmpdir }) | ||
expect(hasBroccoliTmpDir(tmpdir)).to.be.true | ||
builder.cleanup() | ||
builder = null | ||
expect(hasBroccoliTmpDir('test/tmp')).to.be.false | ||
expect(hasBroccoliTmpDir(tmpdir)).to.be.false | ||
}) | ||
@@ -340,5 +348,5 @@ | ||
expect(function() { | ||
new Builder(node, { tmpdir: 'test/tmp' }) | ||
new Builder(node, { tmpdir: tmpdir}) | ||
}).to.throw(Builder.NodeSetupError, /foo error\s+at FailingSetupPlugin\n-~- created here: -~-/) | ||
expect(hasBroccoliTmpDir('test/tmp')).to.be.false | ||
expect(hasBroccoliTmpDir(tmpdir)).to.be.false | ||
}) | ||
@@ -349,5 +357,5 @@ | ||
expect(function() { | ||
new Builder(node, { tmpdir: 'test/tmp' }) | ||
new Builder(node, { tmpdir: tmpdir}) | ||
}).to.throw(Builder.NodeSetupError, /bar error\s+at FailingSetupPlugin\n-~- created here: -~-/) | ||
expect(hasBroccoliTmpDir('test/tmp')).to.be.false | ||
expect(hasBroccoliTmpDir(tmpdir)).to.be.false | ||
}) | ||
@@ -354,0 +362,0 @@ }) |
'use strict' | ||
var fs = require('fs') | ||
var rimraf = require('rimraf') | ||
var RSVP = require('rsvp') | ||
var tmp = require('tmp') | ||
var sinon = require('sinon') | ||
@@ -16,2 +16,4 @@ var chai = require('chai'), expect = chai.expect | ||
// Clean up left-over temporary directories on uncaught exception. | ||
tmp.setGracefulCleanup() | ||
@@ -30,5 +32,3 @@ // Parameters: | ||
module.exports = function(Watcher, Builder, sleepDuration, tmpBaseDir) { | ||
var tmpDir = tmpBaseDir + '/watcher_test.tmp' | ||
module.exports = function(Watcher, Builder, sleepDuration) { | ||
function sleep() { | ||
@@ -52,7 +52,2 @@ return new RSVP.Promise(function(resolve, reject) { | ||
beforeEach(function() { | ||
rimraf.sync(tmpDir) | ||
fs.mkdirSync(tmpDir) | ||
}) | ||
afterEach(function() { | ||
@@ -72,6 +67,16 @@ return RSVP.resolve() | ||
buildSpy = null | ||
rimraf.sync(tmpDir) | ||
}) | ||
}) | ||
var tmpDir, tmpRemoveCallback | ||
beforeEach(function() { | ||
var tmpObj = tmp.dirSync({ prefix: 'broccoli_watcher_test-', unsafeCleanup: true }) | ||
tmpDir = tmpObj.name | ||
tmpRemoveCallback = tmpObj.removeCallback | ||
}) | ||
afterEach(function() { | ||
tmpRemoveCallback() | ||
}) | ||
function makeNodeWithTwoWatchedDirectories() { | ||
@@ -78,0 +83,0 @@ fs.mkdirSync(tmpDir + '/1') |
@@ -13,2 +13,2 @@ 'use strict' | ||
require('./watcher_test_suite')(FastWatcher, Builder, 15, 'test') | ||
require('./watcher_test_suite')(FastWatcher, Builder, 15) |
Sorry, the diff of this file is not supported yet
117044
1737