Permalink
Browse files

Hacking in test runner wrapper

  • Loading branch information...
1 parent ed26c0d commit 1958df495e1c988a9710f4e118cbc838d1acf6f2 @timrwood timrwood committed Jun 24, 2014
@@ -1,2 +0,0 @@
- moment.tz.add(window.momentTZData);
-}());
@@ -1,2 +0,0 @@
-(function(){
- window.momentTZData =
@@ -0,0 +1 @@
+}());
@@ -0,0 +1,6 @@
+(function(){
+ var module = {};
+ var require = function(str){
+ return str.indexOf('helper') > -1 ? module.exports : window.moment;
+ }
+ var exports = {};
View
@@ -6,13 +6,6 @@ module.exports = function(grunt) {
'libs/moment/min/langs.js',
'libs/moment-timezone/builds/moment-timezone-with-data.js'
],
- 'build/static/js/timezone-test.js' : [
- 'assets/js/test-start.js',
- 'libs/nodeunit/nodeunit.js',
- 'libs/moment-timezone/tests/**/*.js',
- 'assets/js/test.js',
- 'assets/js/test-end.js'
- ],
'build/static/js/core-test.js' : [
'assets/js/test-start.js',
'libs/nodeunit/nodeunit.js',
@@ -36,6 +29,29 @@ module.exports = function(grunt) {
}
});
+ grunt.config('concat.tz', {
+ options : {
+ process : function (src, filepath) {
+ if (filepath.indexOf('moment-timezone/tests') > -1) {
+ return '\n(function(){\n\n' + src + '\n\n}());\n';
+ }
+ return src;
+ }
+ },
+ files : {
+ 'build/static/js/timezone-test.js' : [
+ 'libs/moment-timezone/moment-timezone-utils.js',
+ 'assets/js/timezone-test-start.js',
+ 'libs/nodeunit/nodeunit.js',
+ 'libs/moment-timezone/tests/helpers/*.js',
+ 'libs/moment-timezone/tests/zones/**/*.js',
+ 'libs/moment-timezone/tests/moment-timezone/**/*.js',
+ 'assets/js/test.js',
+ 'assets/js/timezone-test-end.js'
+ ]
+ }
+ });
+
grunt.config('uglify.js', {
src: 'build/static/js/global.js',
dest: 'build/static/js/global.min.js'
@@ -68,5 +84,5 @@ module.exports = function(grunt) {
tasks: ['js']
});
- grunt.registerTask('js', ['concat:js', 'copy:js', 'uglify:js']);
+ grunt.registerTask('js', ['concat:js', 'concat:tz', 'copy:js', 'uglify:js']);
};

0 comments on commit 1958df4

Please sign in to comment.