Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Reagan Thomas
committed
Mar 2, 2015
1 parent
28b5c85
commit e178e6c
Showing
6 changed files
with
98 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
'use strict'; | ||
|
||
var assert = require('assert'); | ||
var gulp = require('gulp'); | ||
|
||
var taskLoader = '../build/index.js'; | ||
|
||
describe('gulp-simple-task-loader', function() { | ||
beforeEach(function() { | ||
delete require.cache[require.resolve(taskLoader)]; | ||
}); | ||
|
||
describe('edge cases', function() { | ||
describe('task directory errors', function() { | ||
it('should error when directory does not exist', function(done) { | ||
assert.throws(function() { | ||
require(taskLoader)(); | ||
}, Error); | ||
done(); | ||
}); | ||
|
||
it('should error when directory is not a directory', function(done) { | ||
assert.throws(function() { | ||
require(taskLoader)({ taskDirectory: 'index.js' }); | ||
}, Error); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('options', function() { | ||
it('overwrites default options', function(done) { | ||
require(taskLoader)({ | ||
taskDirectory: 'test/test-tasks', | ||
plugins: { derp: 'herp' }, | ||
filenameDelimiter: '-', | ||
taskDelimiter: ':' | ||
}); | ||
|
||
var config = gulp.tasks['config'].fn(); | ||
assert.equal(config.taskDirectory.slice(-15), 'test/test-tasks'); | ||
assert.deepEqual(config.plugins, { derp: 'herp' }); | ||
assert.equal(config.filenameDelimiter, '-'); | ||
assert.equal(config.taskDelimiter, ':'); | ||
done(); | ||
}); | ||
|
||
it('adds new options', function(done) { | ||
require(taskLoader)({ | ||
taskDirectory: 'test/test-tasks', | ||
herp: 'derp' | ||
}); | ||
|
||
var config = gulp.tasks['config'].fn(); | ||
assert.equal(config.herp, 'derp'); | ||
done(); | ||
}); | ||
}); | ||
}); |
This file contains 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict'; | ||
|
||
module.exports = function(gulp, config, plugins) { | ||
return function() { | ||
return config; | ||
}; | ||
}; |