From 3aa670dd9086ad70e79a068d551cd52680020e30 Mon Sep 17 00:00:00 2001 From: David Humphrey Date: Sat, 17 May 2014 14:44:29 -0400 Subject: [PATCH] Generate separate filer for testing in node so we don't overwrite dist/filer.js --- .gitignore | 1 + gruntfile.js | 31 ++++++++++++++++++++++++++++--- tests/node-runner.js | 3 ++- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index c794f4b..8bc5f99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules bower_components *~ +dist/filer-test.js diff --git a/gruntfile.js b/gruntfile.js index 4c55196..2ea65c1 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -4,7 +4,7 @@ module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), - clean: ['dist/'], + clean: ['dist/filer-test.js'], uglify: { options: { @@ -79,6 +79,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"] + } + } + } } } }); @@ -89,10 +113,11 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-jshint'); 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']); - grunt.registerTask('test', ['check', 'develop', 'shell:mocha']); + grunt.registerTask('test', ['check', 'filer-test', 'shell:mocha']); grunt.registerTask('default', ['test']); }; diff --git a/tests/node-runner.js b/tests/node-runner.js index ecaeb4b..260f152 100644 --- a/tests/node-runner.js +++ b/tests/node-runner.js @@ -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",