Generate separate filer for testing in node so we don't overwrite dist/filer.js

This commit is contained in:
David Humphrey 2014-05-17 14:44:29 -04:00 committed by Kieran Sedgwick
parent 89c44f2f72
commit 9426a700b5
3 changed files with 31 additions and 4 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ node_modules
bower_components
.env
*~
dist/filer-test.js

View File

@ -15,7 +15,7 @@ module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: ['dist/'],
clean: ['dist/filer-test.js'],
uglify: {
options: {
@ -81,6 +81,30 @@ module.exports = function(grunt) {
}
}
}
},
test: {
options: {
paths: {
"src": "../src",
"build": "../build"
},
baseUrl: "lib",
name: "build/almond",
include: ["src/index"],
out: "dist/filer-test.js",
optimize: "none",
wrap: {
startFile: 'build/wrap.start',
endFile: 'build/wrap.end'
},
shim: {
// TextEncoder and TextDecoder shims. encoding-indexes must get loaded first,
// and we use a fake one for reduced size, since we only care about utf8.
"encoding": {
deps: ["encoding-indexes-shim"]
}
}
}
}
},
@ -168,7 +192,8 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-prompt');
grunt.loadNpmTasks('grunt-shell');
grunt.registerTask('develop', ['clean', 'requirejs']);
grunt.registerTask('develop', ['clean', 'requirejs:develop']);
grunt.registerTask('filer-test', ['clean', 'requirejs:test']);
grunt.registerTask('release', ['develop', 'uglify']);
grunt.registerTask('check', ['jshint']);
@ -201,7 +226,7 @@ module.exports = function(grunt) {
'npm-publish'
]);
});
grunt.registerTask('test', ['check', 'develop', 'shell:mocha']);
grunt.registerTask('test', ['check', 'filer-test', 'shell:mocha']);
grunt.registerTask('default', ['test']);
};

View File

@ -7,7 +7,8 @@ requirejs.config({
"spec": "../tests/spec",
"bugs": "../tests/bugs",
"util": "../tests/lib/test-utils",
"Filer": "../dist/filer"
// see gruntfile.js for how dist/filer-test.js gets built
"Filer": "../dist/filer-test"
},
baseUrl: "./lib",
optimize: "none",