This repository was archived by the owner on Jun 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
fix build hang #56
Merged
Merged
fix build hang #56
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,48 @@ | ||
var assert = require( 'assert' ), | ||
path = require( 'path' ), | ||
sander = require( 'sander' ), | ||
|
||
sample = new RegExp( '^' + path.join( __dirname, 'sample' ) ), | ||
output = path.join( __dirname, 'output' ); | ||
gobble = require( '../tmp' ).default; | ||
sample = new RegExp( '^' + path.join( __dirname, 'sample' ) ); | ||
|
||
module.exports = function () { | ||
describe( 'node.build()', function () { | ||
beforeEach( function () { | ||
// Clean up output dir | ||
return sander.rimraf( 'output' ); | ||
return sander.rimraf( 'tmp' ).then( function () { | ||
return sander.copydir( 'sample' ).to( 'tmp' ); | ||
}); | ||
}); | ||
|
||
afterEach( function () { | ||
// Clear cache of sample build definitions | ||
Object.keys( require.cache ).forEach( function ( mod ) { | ||
if ( sample.test( mod ) ) { | ||
delete require.cache[ mod ]; | ||
} | ||
}); | ||
|
||
// Clean up output dir | ||
return sander.rimraf( 'output' ); | ||
return sander.rimraf( 'tmp' ); | ||
}); | ||
|
||
it( 'should return a promise that fulfils on completion of build', function () { | ||
return require( './sample/foo' ).build({ | ||
dest: output | ||
it( 'should return a promise that fulfills on completion of build', function () { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do'h! Sorry, I have spellcheck on in Sublime :). |
||
return gobble( 'tmp/foo' ).build({ | ||
dest: 'tmp/output' | ||
}).then( function () { | ||
return sander.readFile( output, 'foo.md' ).then( function ( data ) { | ||
return sander.readFile( 'tmp/output', 'foo.md' ).then( function ( data ) { | ||
assert.equal( data.toString().trim(), 'foo: this is some text' ); | ||
}); | ||
}); | ||
}); | ||
|
||
it( 'should stop completion of build', function () { | ||
var node = gobble( 'tmp/foo' ); | ||
var task = node.build({ | ||
dest: 'tmp/output' | ||
}); | ||
return task.then( function () { | ||
assert.equal(node.active(), false); | ||
|
||
return sander.readFile( 'tmp/output', 'foo.md' ).then( function ( data ) { | ||
assert.equal( data.toString().trim(), 'foo: this is some text' ); | ||
}); | ||
}); | ||
}); | ||
|
||
it( 'should throw an error if no `dest` is specified', function () { | ||
assert.throws( function () { | ||
require( './sample/foo' ).build(); | ||
gobble( 'tmp/foo' ).build(); | ||
}, function ( err ) { | ||
return err.code === 'MISSING_DEST_DIR'; | ||
}); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d'oh... I added the start, but didn't think to stop it. 👍