allowing options to be passed to getRelativeFileList
This commit is contained in:
parent
ce4a167521
commit
3bde360e05
11
Gruntfile.js
11
Gruntfile.js
@ -28,7 +28,7 @@ module.exports = function(grunt) {
|
||||
junit: {
|
||||
path: 'junit'
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
phantom_polyfills: {
|
||||
src: 'test/fixtures/phantom-polyfills/src/**/*.js',
|
||||
@ -50,9 +50,18 @@ module.exports = function(grunt) {
|
||||
deepOutfile: {
|
||||
src: 'test/fixtures/pivotal/src/**/*.js',
|
||||
options: {
|
||||
specs: 'test/fixtures/pivotal/spec/*Spec.js',
|
||||
helpers: 'test/fixtures/pivotal/spec/*Helper.js',
|
||||
outfile: 'tmp/spec.html'
|
||||
}
|
||||
},
|
||||
externalVendor: {
|
||||
src: 'test/fixtures/externalVendor/src/**/*.js',
|
||||
options: {
|
||||
specs: 'test/fixtures/externalVendor/spec/**/*.js',
|
||||
vendor: 'http://code.jquery.com/jquery-1.10.1.min.js'
|
||||
}
|
||||
},
|
||||
customTemplate: {
|
||||
src: 'test/fixtures/pivotal/src/**/*.js',
|
||||
options: {
|
||||
|
23
README.md
23
README.md
@ -34,24 +34,20 @@ of jasmine through grunt which served as motivation for all the future work.
|
||||
|
||||
Run your tests on your local filesystem or via a server task like [grunt-contrib-connect][].
|
||||
|
||||
#### AMD Support
|
||||
|
||||
Supports AMD tests via the [grunt-template-jasmine-requirejs](https://github.com/jsoverson/grunt-template-jasmine-requirejs) module
|
||||
|
||||
#### Customize your SpecRunner with your own template
|
||||
#### Customize your SpecRunner with templates
|
||||
|
||||
Supply your templates that will be used to automatically build the SpecRunner.
|
||||
|
||||
#### Third party templates
|
||||
##### AMD Support
|
||||
|
||||
Supports AMD tests via the [grunt-template-jasmine-requirejs](https://github.com/jsoverson/grunt-template-jasmine-requirejs) module
|
||||
|
||||
##### Third party templates
|
||||
|
||||
- [RequireJS](https://github.com/jsoverson/grunt-template-jasmine-requirejs)
|
||||
- [Code coverage output with Istanbul](https://github.com/maenu/grunt-template-jasmine-istanbul)
|
||||
- [StealJS](https://github.com/jaredstehler/grunt-template-jasmine-steal)
|
||||
|
||||
#### Example application usage
|
||||
|
||||
- [Pivotal Labs' sample application](https://github.com/jsoverson/grunt-contrib-jasmine-example)
|
||||
|
||||
[grunt-contrib-connect]: https://github.com/gruntjs/grunt-contrib-connect
|
||||
|
||||
|
||||
@ -172,6 +168,11 @@ watch: {
|
||||
}
|
||||
```
|
||||
|
||||
#### Example application usage
|
||||
|
||||
- [Pivotal Labs' sample application](https://github.com/jsoverson/grunt-contrib-jasmine-example)
|
||||
|
||||
|
||||
#### Basic Use
|
||||
|
||||
Sample configuration to run Pivotal Labs' example Jasmine application.
|
||||
@ -253,4 +254,4 @@ for more information on the RequireJS template.
|
||||
|
||||
Task submitted by [Jarrod Overson](http://jarrodoverson.com)
|
||||
|
||||
*This file was generated on Sat Jun 15 2013 09:12:10.*
|
||||
*This file was generated on Sat Jun 15 2013 11:00:01.*
|
||||
|
@ -1,3 +1,8 @@
|
||||
## Example application usage
|
||||
|
||||
- [Pivotal Labs' sample application](https://github.com/jsoverson/grunt-contrib-jasmine-example)
|
||||
|
||||
|
||||
## Basic Use
|
||||
|
||||
Sample configuration to run Pivotal Labs' example Jasmine application.
|
||||
|
@ -7,23 +7,19 @@ of jasmine through grunt which served as motivation for all the future work.
|
||||
|
||||
Run your tests on your local filesystem or via a server task like [grunt-contrib-connect][].
|
||||
|
||||
## AMD Support
|
||||
|
||||
Supports AMD tests via the [grunt-template-jasmine-requirejs](https://github.com/jsoverson/grunt-template-jasmine-requirejs) module
|
||||
|
||||
## Customize your SpecRunner with your own template
|
||||
## Customize your SpecRunner with templates
|
||||
|
||||
Supply your templates that will be used to automatically build the SpecRunner.
|
||||
|
||||
## Third party templates
|
||||
### AMD Support
|
||||
|
||||
Supports AMD tests via the [grunt-template-jasmine-requirejs](https://github.com/jsoverson/grunt-template-jasmine-requirejs) module
|
||||
|
||||
### Third party templates
|
||||
|
||||
- [RequireJS](https://github.com/jsoverson/grunt-template-jasmine-requirejs)
|
||||
- [Code coverage output with Istanbul](https://github.com/maenu/grunt-template-jasmine-istanbul)
|
||||
- [StealJS](https://github.com/jaredstehler/grunt-template-jasmine-steal)
|
||||
|
||||
## Example application usage
|
||||
|
||||
- [Pivotal Labs' sample application](https://github.com/jsoverson/grunt-contrib-jasmine-example)
|
||||
|
||||
[grunt-contrib-connect]: https://github.com/gruntjs/grunt-contrib-connect
|
||||
|
||||
|
@ -65,14 +65,14 @@ exports.init = function(grunt, phantomjs) {
|
||||
|
||||
var context = {
|
||||
temp : tempDir,
|
||||
css : exports.getRelativeFileList(outdir, jasmineCss),
|
||||
css : exports.getRelativeFileList(outdir, jasmineCss, { nonull : true }),
|
||||
scripts : {
|
||||
polyfills : exports.getRelativeFileList(outdir, polyfills),
|
||||
jasmine : exports.getRelativeFileList(outdir, jasmineCore),
|
||||
helpers : exports.getRelativeFileList(outdir, options.helpers),
|
||||
helpers : exports.getRelativeFileList(outdir, options.helpers, { nonull : true }),
|
||||
specs : exports.getRelativeFileList(outdir, options.specs),
|
||||
src : exports.getRelativeFileList(outdir, src),
|
||||
vendor : exports.getRelativeFileList(outdir, options.vendor),
|
||||
src : exports.getRelativeFileList(outdir, src, { nonull : true }),
|
||||
vendor : exports.getRelativeFileList(outdir, options.vendor, { nonull : true }),
|
||||
reporters : exports.getRelativeFileList(outdir, reporters),
|
||||
start : exports.getRelativeFileList(outdir, jasmineHelper)
|
||||
},
|
||||
@ -99,14 +99,12 @@ exports.init = function(grunt, phantomjs) {
|
||||
return source;
|
||||
};
|
||||
|
||||
exports.getRelativeFileList = function (/* args... */) {
|
||||
|
||||
var list = Array.prototype.slice.call(arguments),
|
||||
outdir = list.shift();
|
||||
var base = path.resolve(baseDir);
|
||||
exports.getRelativeFileList = function (outdir, patterns, options) {
|
||||
var files = [];
|
||||
list.forEach(function(listItem){
|
||||
if (listItem) files = files.concat(grunt.file.expand({nonull: true},listItem));
|
||||
patterns = patterns instanceof Array ? patterns : [ patterns ];
|
||||
options = options || {};
|
||||
patterns.forEach(function(listItem){
|
||||
if (listItem) files = files.concat(grunt.file.expand(options, listItem));
|
||||
});
|
||||
|
||||
files = grunt.util._(files).map(function(file){
|
||||
|
7
test/fixtures/externalVendor/spec/test-spec.js
vendored
Normal file
7
test/fixtures/externalVendor/spec/test-spec.js
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
describe("external vendor test", function() {
|
||||
|
||||
it("should have pulled in jQuery", function() {
|
||||
expect($.fn.jquery).toBeTruthy();
|
||||
});
|
||||
|
||||
});
|
5
test/fixtures/externalVendor/src/test.js
vendored
Normal file
5
test/fixtures/externalVendor/src/test.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
|
||||
// arbitrary usage of jquery that will break if jquery wasn't pulled in
|
||||
|
||||
$('body').toggle();
|
Loading…
Reference in New Issue
Block a user