From 9426a700b51f01ef1afad66b2d64882065106e65 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 3af4620..7fd5ccb 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules bower_components .env *~ +dist/filer-test.js diff --git a/gruntfile.js b/gruntfile.js index 5d911fa..a92b69f 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -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']); }; 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",