<commit_before>// Generated on 2014-04-17 using generator-angular 0.8.0
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt) {

  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  grunt.loadNpmTasks('grunt-bump');
  grunt.loadNpmTasks('grunt-version');

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    yeoman: {
      // configurable paths
      app: require('./bower.json').appPath || 'app',
      dist: 'dist'
    },

    version: {
      options: {
        pkg: 'package.json'
      },
      update: {
        options: {
          prefix: 'var version\\s+=\\s+[\'"]'
        },
        src: ['app/scripts/initializers/modules.js']
      },
    },

    bump: {
      options: {
        files: ['package.json'],
        updateConfigs: [],
        commit: true,
        push: true,
        commitMessage: 'Release v%VERSION%',
        commitFiles: ['package.json', 'app/scripts/initializers/modules.js'], // '-a' for all files
        createTag: true,
        tagName: 'v%VERSION%',
        tagMessage: 'Version %VERSION%',
        pushTo: 'origin'
        // gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d' // options to use with '$ git describe'
      }
    },

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['bowerInstall']
      },
      js: {
        files: ['<%= yeoman.app %>/scripts/{,**/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: true
        }
      },
      jsTest: {
        files: ['test/spec/{,**/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          base: [
            '.tmp',
            '<%= yeoman.app %>'
          ]
        }
      },
      test: {
        options: {
          port: 9001,
          base: [
            '.tmp',
            'test',
            '<%= yeoman.app %>'
          ]
        }
      },
      dist: {
        options: {
          base: '<%= yeoman.dist %>'
        }
      }
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: [
        'Gruntfile.js',
        '<%= yeoman.app %>/scripts/{,**/}*.js'
      ],
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/spec/{,**/}*.js']
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/*',
            '!<%= yeoman.dist %>/.git*'
          ]
        }]
      },
      server: '.tmp'
    },

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['last 1 version']
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the app
    bowerInstall: {
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath: '<%= yeoman.app %>/',
        exclude: [/cryptojs/, /bootstrap\-sass\-official/]
      },
      sass: {
        src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: '<%= yeoman.app %>/bower_components/'
      }
    },

    // Compiles Sass to CSS and generates necessary files if requested
    compass: {
      options: {
        sassDir: '<%= yeoman.app %>/styles',
        cssDir: '<%= yeoman.app %>/styles',//'.tmp/styles',
        generatedImagesDir: '.tmp/images/generated',
        imagesDir: '<%= yeoman.app %>/images',
        javascriptsDir: '<%= yeoman.app %>/scripts',
        fontsDir: '<%= yeoman.app %>/styles/fonts',
        importPath: '<%= yeoman.app %>/bower_components',
        httpImagesPath: '/images',
        httpGeneratedImagesPath: '/images/generated',
        httpFontsPath: '/styles/fonts',
        relativeAssets: false,
        assetCacheBuster: false,
        raw: 'Sass::Script::Number.precision = 10\n'
      },
      dist: {
        options: {
          generatedImagesDir: '<%= yeoman.dist %>/images/generated'
        }
      },
      server: {
        options: {
          debugInfo: true
        }
      }
    },

    // Renames files for browser caching purposes
    rev: {
      dist: {
        files: {
          src: [
            '<%= yeoman.dist %>/scripts/{,*/}*.js',
            '<%= yeoman.dist %>/styles/{,*/}*.css',
            '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
            '<%= yeoman.dist %>/styles/fonts/*'
          ]
        }
      }
    },

    // Reads HTML for usemin blocks to enable smart builds that automatically
    // concat, minify and revision files. Creates configurations in memory so
    // additional tasks can operate on them
    useminPrepare: {
      html: '<%= yeoman.app %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>',
        flow: {
          html: {
            steps: {
              js: ['concat', 'uglifyjs'],
              css: ['cssmin']
            },
            post: {}
          }
        }
      }
    },

    // Performs rewrites based on rev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        assetsDirs: ['<%= yeoman.dist %>']
      }
    },

    // The following *-min tasks produce minified files in the dist folder
    cssmin: {
      options: {
        root: '<%= yeoman.app %>'
      }
    },

    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          collapseWhitespace: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true,
          removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html', 'views/{,*/}*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // ngmin tries to make the code safe for minification automatically by
    // using the Angular long form for dependency injection. It doesn't work on
    // things like resolve or inject so those have to be done manually.
    ngmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/*.html']
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            '*.html',
            'views/{,**/}*.html',
            'scripts/directives/templates/{,**/}*.html',
            'images/{,**/}*.{webp}',
            'fonts/*',
	    'i18n/*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'compass:server'
      ],
      test: [
        'compass'
      ],
      dist: [
        'compass:dist',
        'imagemin',
        'svgmin'
      ]
    },

    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css',
    //         '<%= yeoman.app %>/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    // Test settings
    karma: {
      unit: {
        configFile: 'karma.conf.js',
        singleRun: true
      }
    }
  });

  grunt.registerTask('serve', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'connect:dist:keepalive']);
    }

    grunt.task.run([
      'clean:server',
      'bowerInstall',
      'concurrent:server',
      'autoprefixer',
      'connect:livereload',
      'watch'
    ]);
  });

  grunt.registerTask('server', function (target) {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve:' + target]);
  });

  grunt.registerTask('test', [
    'clean:server',
    'concurrent:test',
    'autoprefixer',
    'connect:test',
    'karma'
  ]);

  grunt.registerTask('patch', [
    'bump-only:patch',
    'version:update',
    'bump-commit'
  ]);

  grunt.registerTask('minor', [
    'bump-only:minor',
    'version:update',
    'bump-commit'
  ]);

  grunt.registerTask('major', [
    'bump-only:major',
    'version:update',
    'bump-commit'
  ]);

  grunt.registerTask('build', [
    'clean:dist',
    'bowerInstall',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngmin',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'rev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};
<commit_msg>chore(grunt): add all types to image to build<commit_after>// Generated on 2014-04-17 using generator-angular 0.8.0
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt) {

  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  grunt.loadNpmTasks('grunt-bump');
  grunt.loadNpmTasks('grunt-version');

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    yeoman: {
      // configurable paths
      app: require('./bower.json').appPath || 'app',
      dist: 'dist'
    },

    version: {
      options: {
        pkg: 'package.json'
      },
      update: {
        options: {
          prefix: 'var version\\s+=\\s+[\'"]'
        },
        src: ['app/scripts/initializers/modules.js']
      },
    },

    bump: {
      options: {
        files: ['package.json'],
        updateConfigs: [],
        commit: true,
        push: true,
        commitMessage: 'Release v%VERSION%',
        commitFiles: ['package.json', 'app/scripts/initializers/modules.js'], // '-a' for all files
        createTag: true,
        tagName: 'v%VERSION%',
        tagMessage: 'Version %VERSION%',
        pushTo: 'origin'
        // gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d' // options to use with '$ git describe'
      }
    },

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['bowerInstall']
      },
      js: {
        files: ['<%= yeoman.app %>/scripts/{,**/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: true
        }
      },
      jsTest: {
        files: ['test/spec/{,**/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          base: [
            '.tmp',
            '<%= yeoman.app %>'
          ]
        }
      },
      test: {
        options: {
          port: 9001,
          base: [
            '.tmp',
            'test',
            '<%= yeoman.app %>'
          ]
        }
      },
      dist: {
        options: {
          base: '<%= yeoman.dist %>'
        }
      }
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: [
        'Gruntfile.js',
        '<%= yeoman.app %>/scripts/{,**/}*.js'
      ],
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/spec/{,**/}*.js']
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/*',
            '!<%= yeoman.dist %>/.git*'
          ]
        }]
      },
      server: '.tmp'
    },

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['last 1 version']
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the app
    bowerInstall: {
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath: '<%= yeoman.app %>/',
        exclude: [/cryptojs/, /bootstrap\-sass\-official/]
      },
      sass: {
        src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: '<%= yeoman.app %>/bower_components/'
      }
    },

    // Compiles Sass to CSS and generates necessary files if requested
    compass: {
      options: {
        sassDir: '<%= yeoman.app %>/styles',
        cssDir: '<%= yeoman.app %>/styles',//'.tmp/styles',
        generatedImagesDir: '.tmp/images/generated',
        imagesDir: '<%= yeoman.app %>/images',
        javascriptsDir: '<%= yeoman.app %>/scripts',
        fontsDir: '<%= yeoman.app %>/styles/fonts',
        importPath: '<%= yeoman.app %>/bower_components',
        httpImagesPath: '/images',
        httpGeneratedImagesPath: '/images/generated',
        httpFontsPath: '/styles/fonts',
        relativeAssets: false,
        assetCacheBuster: false,
        raw: 'Sass::Script::Number.precision = 10\n'
      },
      dist: {
        options: {
          generatedImagesDir: '<%= yeoman.dist %>/images/generated'
        }
      },
      server: {
        options: {
          debugInfo: true
        }
      }
    },

    // Renames files for browser caching purposes
    rev: {
      dist: {
        files: {
          src: [
            '<%= yeoman.dist %>/scripts/{,*/}*.js',
            '<%= yeoman.dist %>/styles/{,*/}*.css',
            '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
            '<%= yeoman.dist %>/styles/fonts/*'
          ]
        }
      }
    },

    // Reads HTML for usemin blocks to enable smart builds that automatically
    // concat, minify and revision files. Creates configurations in memory so
    // additional tasks can operate on them
    useminPrepare: {
      html: '<%= yeoman.app %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>',
        flow: {
          html: {
            steps: {
              js: ['concat', 'uglifyjs'],
              css: ['cssmin']
            },
            post: {}
          }
        }
      }
    },

    // Performs rewrites based on rev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        assetsDirs: ['<%= yeoman.dist %>']
      }
    },

    // The following *-min tasks produce minified files in the dist folder
    cssmin: {
      options: {
        root: '<%= yeoman.app %>'
      }
    },

    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          collapseWhitespace: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true,
          removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html', 'views/{,*/}*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // ngmin tries to make the code safe for minification automatically by
    // using the Angular long form for dependency injection. It doesn't work on
    // things like resolve or inject so those have to be done manually.
    ngmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/*.html']
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            '*.html',
            'views/{,**/}*.html',
            'scripts/directives/templates/{,**/}*.html',
            'images/{,**/}*',
            'fonts/*',
	    'i18n/*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'compass:server'
      ],
      test: [
        'compass'
      ],
      dist: [
        'compass:dist',
        'imagemin',
        'svgmin'
      ]
    },

    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css',
    //         '<%= yeoman.app %>/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    // Test settings
    karma: {
      unit: {
        configFile: 'karma.conf.js',
        singleRun: true
      }
    }
  });

  grunt.registerTask('serve', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'connect:dist:keepalive']);
    }

    grunt.task.run([
      'clean:server',
      'bowerInstall',
      'concurrent:server',
      'autoprefixer',
      'connect:livereload',
      'watch'
    ]);
  });

  grunt.registerTask('server', function (target) {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve:' + target]);
  });

  grunt.registerTask('test', [
    'clean:server',
    'concurrent:test',
    'autoprefixer',
    'connect:test',
    'karma'
  ]);

  grunt.registerTask('patch', [
    'bump-only:patch',
    'version:update',
    'bump-commit'
  ]);

  grunt.registerTask('minor', [
    'bump-only:minor',
    'version:update',
    'bump-commit'
  ]);

  grunt.registerTask('major', [
    'bump-only:major',
    'version:update',
    'bump-commit'
  ]);

  grunt.registerTask('build', [
    'clean:dist',
    'bowerInstall',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngmin',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'rev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};
<|endoftext|>


<commit_before>/*******************************************************************************
 * Copyright 2013-2014 Aerospike, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/

// we want to test the built aerospike module
var aerospike = require('../build/Release/aerospike');
var options = require('./util/options');
var assert = require('assert');
var expect = require('expect.js');

var keygen = require('./generators/key');
var metagen = require('./generators/metadata');
var recgen = require('./generators/record');
var putgen = require('./generators/put');
var valgen = require('./generators/value');

var status = aerospike.status;
var policy = aerospike.policy;

describe('client.put()', function() {

    var client = aerospike.client({
        hosts: [
            { addr: options.host, port: options.port }
        ],
        log: {
            level: options.log,
			file:  options.log_file
        },
        policies: {
            timeout: options.timeout
        }
    });

    before(function(done) {
        client.connect(function(err){
            done();
        });
    });

    after(function(done) {
        client.close();
        client = null;
        done();
    });

    it('should write and validate 100 records', function(done) {

        // counters
        var total = 100;
        var count = 0;

        // generators
        var kgen = keygen.string(options.namespace, options.set, {prefix: "test/get/"});
        var mgen = metagen.constant({ttl: 1000});
        var rgen = recgen.record({i: valgen.integer(), s: valgen.string(), b: valgen.bytes()});

        function iteration() {

            // values
            var key     = kgen();
            var meta    = mgen(key);
            var record  = rgen(key, meta);

            // write the record then check
            client.put(key, record, meta, function(err, key) {
                client.get(key, function(err, _record, _metadata, _key) {

                    expect(err).to.be.ok();
                    expect(err.code).to.equal(status.AEROSPIKE_OK);
                    expect(_record).to.eql(record);
					client.remove(_key, function(err, key){});
                    count++;
                    if ( count >= total ) {
                        done();
                    }
                });
            });
        }

        for ( var i = 0; i < total; i++ ) {
            iteration();
        }
    });

    it('should write the record w/ string key', function(done) {

        // generators
        var kgen = keygen.string(options.namespace, options.set, {prefix: "test/get/"});
        var mgen = metagen.constant({ttl: 1000});
        var rgen = recgen.record({i: valgen.integer(), s: valgen.string()});

        // values
        var key     = kgen();
        var meta    = mgen(key);
        var record  = rgen(key, meta);

        // write the record then check
        client.put(key, record, meta, function(err, key) {
            client.get(key, function(err, record, metadata, key) {
                expect(err).to.be.ok();
                expect(err.code).to.equal(status.AEROSPIKE_OK);
				client.remove(key, function(err, key){});
                done();
            });
        });
    });

    it('should write the record w/ int key', function(done) {

        // generators
        var kgen = keygen.integer(options.namespace, options.set);
        var mgen = metagen.constant({ttl: 1000});
        var rgen = recgen.record({i: valgen.integer(), s: valgen.string()});

        // values
        var key     = kgen();
        var meta    = mgen(key);
        var record  = rgen(key, meta);

        // write the record then check
        client.put(key, record, meta, function(err, key) {
            client.get(key, function(err, record, metadata, key) {
                expect(err).to.be.ok();
                expect(err.code).to.equal(status.AEROSPIKE_OK);
				client.remove(key, function(err, key){});

                done();
            });
        });
    });

    it('should write the record w/ bytes key', function(done) {

        // generators
        var kgen = keygen.bytes(options.namespace, options.set);
        var mgen = metagen.constant({ttl: 1000});
        var rgen = recgen.record({i: valgen.integer(), s: valgen.string()});
        // values
        var key     = kgen();
        var meta    = mgen(key);
        var record  = rgen(key, meta);
        // write the record then check
        client.put(key, record, meta, function(err, key) {
            client.get(key, function(err, record, metadata, key) {
                expect(err).to.be.ok();
                expect(err.code).to.equal(status.AEROSPIKE_OK);
				client.remove(key, function(err, key){});
                done();
            });
        });
    });

    it('shoule write an array, map type of bin and read', function(done) {

        // generators
        var kgen = keygen.string(options.namespace, options.set, {prefix: "test/get/"});
        var mgen = metagen.constant({ttl: 1000});
        var rgen = recgen.record({list: valgen.array(), map: valgen.map()});

        //values
        var key     = kgen();
        var meta    = mgen(key);
        var record  = rgen(key, meta);

        //write the record and then check
        client.put(key, record, meta, function(err, key) {
            client.get(key, function(err, record1, metadata, key){
                expect(err).to.be.ok();
                expect(err.code).to.equal(status.AEROSPIKE_OK);
                expect(record1).to.eql(record);
				client.remove(key, function(err, key){});
                done();
            });
        });
    });

    it('should write an array of map and array, map of array and map, then read', function(done){

        //generators
        var kgen = keygen.string(options.namespace, options.set, {prefix: "test/get/"});
        var mgen = metagen.constant({ttl:1000});
        var rgen = recgen.record({list_of_list: valgen.array_of_array(), map_of_list: valgen.map_of_map()});

        //values
        var key = kgen();
        var meta = mgen(key);
        var record = rgen(key, meta);

        //write the record and then check
        client.put(key, record, meta, function(err, key) {
            client.get(key, function(err, record1, metadata, key){
                expect(err).to.be.ok();
                expect(err.code).to.equal(status.AEROSPIKE_OK);
                expect(record1).to.eql(record);
				client.remove(key, function(err, key){});
                done();
            });
        });

    });

    it('should write, read, write, and check gen', function(done) {

        // generators
        var kgen = keygen.string(options.namespace, options.set, {prefix: "test/get/"});
        var mgen = metagen.constant({ttl: 1000});
        var rgen = recgen.record({i: valgen.integer(), s: valgen.string()});

        // values
        var key     = kgen();
        var meta    = mgen(key);
        var record  = rgen(key, meta);

        // write the record then check
        client.put(key, record, meta, function(err, key1) {
            expect(err).to.be.ok();
            expect(err.code).to.equal(status.AEROSPIKE_OK);
            expect(key1).to.have.property('ns', key.ns);
            expect(key1).to.have.property('set', key.set);
            expect(key1).to.have.property('key', key.key);

            client.get(key1, function(err, record2, metadata2, key2) {
                expect(err).to.be.ok();
                expect(err.code).to.equal(status.AEROSPIKE_OK);
				expect(key2).to.have.property('ns', key.ns);
				expect(key2).to.have.property('set', key.set);
				expect(key2).to.have.property('key', key.key);
                expect(record2).to.eql(record);

                var key3 = key2;
                var record3 = record2;

                record3.i++;

                client.put(key3, record3, meta, function(err, key4) {
                    expect(err).to.be.ok();
                    expect(err.code).to.equal(status.AEROSPIKE_OK);
					expect(key4).to.have.property('ns', key.ns);
					expect(key4).to.have.property('set', key.set);
					expect(key4).to.have.property('key', key.key);

                    client.get(key4, function(err, record5, metadata5, key5) {
                        expect(err).to.be.ok();
                        expect(err.code).to.equal(status.AEROSPIKE_OK);
						expect(key5).to.have.property('ns', key.ns);
						expect(key5).to.have.property('set', key.set);
						expect(key5).to.have.property('key', key.key);
                        expect(record5).to.eql(record3);
                        expect(metadata5.gen).to.equal(metadata2.gen+1);
                        expect(record5.i).to.equal(record3.i);
						client.remove(key5, function(err, key){});
                        done();
                    });
                });
            });
        });
    });

    it('should write, read, remove, read, write, and check gen', function(done) {
        // generators
        var kgen = keygen.string(options.namespace, options.set, {prefix: "test/get/"});
        var mgen = metagen.constant({ttl: 1000});
        var rgen = recgen.record({i: valgen.integer(), s: valgen.string()});

        // values
        var key     = kgen();
        var meta    = mgen(key);
        var record  = rgen(key, meta);

        // write the record then check
        client.put(key, record, meta, function(err, key1) {
            expect(err).to.be.ok();
            expect(err.code).to.equal(status.AEROSPIKE_OK);
			expect(key1).to.have.property('ns', key.ns);
			expect(key1).to.have.property('set', key.set);
			expect(key1).to.have.property('key', key.key);

            client.get(key1, function(err, record2, metadata2, key2) {
                expect(err).to.be.ok();
                expect(err.code).to.equal(status.AEROSPIKE_OK);
				expect(key2).to.have.property('ns', key.ns);
				expect(key2).to.have.property('set', key.set);
				expect(key2).to.have.property('key', key.key);
                expect(record2).to.eql(record);

                client.remove(key2, function(err, key3) {
                    expect(err).to.be.ok();
                    expect(err.code).to.equal(status.AEROSPIKE_OK);
					expect(key3).to.have.property('ns', key.ns);
					expect(key3).to.have.property('set', key.set);
					expect(key3).to.have.property('key', key.key);

                    client.get(key3, function(err, record4, metadata4, key4) {
                        expect(err).to.be.ok();
						if(err.code != 602)
						{
							expect(err.code).to.equal(status.AEROSPIKE_ERR_RECORD_NOT_FOUND);
						}
						else
						{
							expect(err.code).to.equal(602);
						}

                        client.put(key, record, meta, function(err, key5) {
                            expect(err).to.be.ok();
                            expect(err.code).to.equal(status.AEROSPIKE_OK);
							expect(key5).to.have.property('ns', key.ns);
							expect(key5).to.have.property('set', key.set);
							expect(key5).to.have.property('key', key.key);

                            client.get(key5, function(err, record6, metadata6, key6) {
                                expect(err).to.be.ok();
                                expect(err.code).to.equal(status.AEROSPIKE_OK);
								expect(key6).to.have.property('ns', key.ns);
								expect(key6).to.have.property('set', key.set);
								expect(key6).to.have.property('key', key.key);
                                expect(record6).to.eql(record);
                                expect(metadata6.gen).to.equal(1);
								client.remove(key6, function(err, key){});
                                done();
                            });
                        });
                    });
                });
            });
        });
    });

    it('should write null for bins with empty list and map', function(done) {

        // generators
        var kgen = keygen.string(options.namespace, options.set, {prefix: "test/get/"});
        var mgen = metagen.constant({ttl: 1000});
        var rgen = recgen.record({
            l:  valgen.constant([1,2,3]),
            le: valgen.constant([]),
            m:  valgen.constant({a: 1, b: 2}),
            me: valgen.constant({})
        });

        // values
        var key     = kgen();
        var meta    = mgen(key);
        var record  = rgen(key, meta);

        // write the record then check
        client.put(key, record, meta, function(err, key1) {
            expect(err).to.be.ok();
            expect(err.code).to.equal(status.AEROSPIKE_OK);
            expect(key1).to.eql(key);

            client.get(key1, function(err, record2, metadata2, key2) {
                expect(err).to.be.ok();
                expect(err.code).to.equal(status.AEROSPIKE_OK);
                expect(key2).to.eql(key);
                expect(record2).to.eql(record);
                expect(record2.m).to.eql({a: 1, b: 2});
                expect(record2.me).to.be.eql({});
                expect(record2.l).to.eql([1,2,3]);
                expect(record2.le).to.be.eql([]);
                done();
            });
        });
    });
    it('should write a bin of type undefined and write should fail', function(done) {

        // generators
        var kgen = keygen.string(options.namespace, options.set, {prefix: "test/get/"});
        var mgen = metagen.constant({ttl: 1000});
        var rgen = recgen.record({
            l	  :  valgen.constant([1,2,3]),
            m	  :  valgen.constant({a: 1, b: 2}),
        });

        // values
        var key     = kgen();
        var meta    = mgen(key);
        var record  = rgen(key, meta);
		record.bin_un = undefined;
        // write the record then check
        client.put(key, record, meta, function(err, key1) {
            expect(err).to.be.ok();
            expect(err.code).to.equal(status.AEROSPIKE_ERR_PARAM);
            done();
        });
    });

});
<commit_msg>Test case fix to check the digest in the key.<commit_after>/*******************************************************************************
 * Copyright 2013-2014 Aerospike, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/

// we want to test the built aerospike module
var aerospike = require('../build/Release/aerospike');
var options = require('./util/options');
var assert = require('assert');
var expect = require('expect.js');

var keygen = require('./generators/key');
var metagen = require('./generators/metadata');
var recgen = require('./generators/record');
var putgen = require('./generators/put');
var valgen = require('./generators/value');

var status = aerospike.status;
var policy = aerospike.policy;

describe('client.put()', function() {

    var client = aerospike.client({
        hosts: [
            { addr: options.host, port: options.port }
        ],
        log: {
            level: options.log,
			file:  options.log_file
        },
        policies: {
            timeout: options.timeout
        }
    });

    before(function(done) {
        client.connect(function(err){
            done();
        });
    });

    after(function(done) {
        client.close();
        client = null;
        done();
    });

    it('should write and validate 100 records', function(done) {

        // counters
        var total = 100;
        var count = 0;

        // generators
        var kgen = keygen.string(options.namespace, options.set, {prefix: "test/get/"});
        var mgen = metagen.constant({ttl: 1000});
        var rgen = recgen.record({i: valgen.integer(), s: valgen.string(), b: valgen.bytes()});

        function iteration() {

            // values
            var key     = kgen();
            var meta    = mgen(key);
            var record  = rgen(key, meta);

            // write the record then check
            client.put(key, record, meta, function(err, key) {
                client.get(key, function(err, _record, _metadata, _key) {

                    expect(err).to.be.ok();
                    expect(err.code).to.equal(status.AEROSPIKE_OK);
                    expect(_record).to.eql(record);
					client.remove(_key, function(err, key){});
                    count++;
                    if ( count >= total ) {
                        done();
                    }
                });
            });
        }

        for ( var i = 0; i < total; i++ ) {
            iteration();
        }
    });

    it('should write the record w/ string key', function(done) {

        // generators
        var kgen = keygen.string(options.namespace, options.set, {prefix: "test/get/"});
        var mgen = metagen.constant({ttl: 1000});
        var rgen = recgen.record({i: valgen.integer(), s: valgen.string()});

        // values
        var key     = kgen();
        var meta    = mgen(key);
        var record  = rgen(key, meta);

        // write the record then check
        client.put(key, record, meta, function(err, key) {
            client.get(key, function(err, record, metadata, key) {
                expect(err).to.be.ok();
                expect(err.code).to.equal(status.AEROSPIKE_OK);
				client.remove(key, function(err, key){});
                done();
            });
        });
    });

    it('should write the record w/ int key', function(done) {

        // generators
        var kgen = keygen.integer(options.namespace, options.set);
        var mgen = metagen.constant({ttl: 1000});
        var rgen = recgen.record({i: valgen.integer(), s: valgen.string()});

        // values
        var key     = kgen();
        var meta    = mgen(key);
        var record  = rgen(key, meta);

        // write the record then check
        client.put(key, record, meta, function(err, key) {
            client.get(key, function(err, record, metadata, key) {
                expect(err).to.be.ok();
                expect(err.code).to.equal(status.AEROSPIKE_OK);
				client.remove(key, function(err, key){});

                done();
            });
        });
    });

    it('should write the record w/ bytes key', function(done) {

        // generators
        var kgen = keygen.bytes(options.namespace, options.set);
        var mgen = metagen.constant({ttl: 1000});
        var rgen = recgen.record({i: valgen.integer(), s: valgen.string()});
        // values
        var key     = kgen();
        var meta    = mgen(key);
        var record  = rgen(key, meta);
        // write the record then check
        client.put(key, record, meta, function(err, key) {
            client.get(key, function(err, record, metadata, key) {
                expect(err).to.be.ok();
                expect(err.code).to.equal(status.AEROSPIKE_OK);
				client.remove(key, function(err, key){});
                done();
            });
        });
    });

    it('shoule write an array, map type of bin and read', function(done) {

        // generators
        var kgen = keygen.string(options.namespace, options.set, {prefix: "test/get/"});
        var mgen = metagen.constant({ttl: 1000});
        var rgen = recgen.record({list: valgen.array(), map: valgen.map()});

        //values
        var key     = kgen();
        var meta    = mgen(key);
        var record  = rgen(key, meta);

        //write the record and then check
        client.put(key, record, meta, function(err, key) {
            client.get(key, function(err, record1, metadata, key){
                expect(err).to.be.ok();
                expect(err.code).to.equal(status.AEROSPIKE_OK);
                expect(record1).to.eql(record);
				client.remove(key, function(err, key){});
                done();
            });
        });
    });

    it('should write an array of map and array, map of array and map, then read', function(done){

        //generators
        var kgen = keygen.string(options.namespace, options.set, {prefix: "test/get/"});
        var mgen = metagen.constant({ttl:1000});
        var rgen = recgen.record({list_of_list: valgen.array_of_array(), map_of_list: valgen.map_of_map()});

        //values
        var key = kgen();
        var meta = mgen(key);
        var record = rgen(key, meta);

        //write the record and then check
        client.put(key, record, meta, function(err, key) {
            client.get(key, function(err, record1, metadata, key){
                expect(err).to.be.ok();
                expect(err.code).to.equal(status.AEROSPIKE_OK);
                expect(record1).to.eql(record);
				client.remove(key, function(err, key){});
                done();
            });
        });

    });

    it('should write, read, write, and check gen', function(done) {

        // generators
        var kgen = keygen.string(options.namespace, options.set, {prefix: "test/get/"});
        var mgen = metagen.constant({ttl: 1000});
        var rgen = recgen.record({i: valgen.integer(), s: valgen.string()});

        // values
        var key     = kgen();
        var meta    = mgen(key);
        var record  = rgen(key, meta);

        // write the record then check
        client.put(key, record, meta, function(err, key1) {
            expect(err).to.be.ok();
            expect(err.code).to.equal(status.AEROSPIKE_OK);
            expect(key1).to.have.property('ns', key.ns);
            expect(key1).to.have.property('set', key.set);
            expect(key1).to.have.property('key', key.key);

            client.get(key1, function(err, record2, metadata2, key2) {
                expect(err).to.be.ok();
                expect(err.code).to.equal(status.AEROSPIKE_OK);
				expect(key2).to.have.property('ns', key.ns);
				expect(key2).to.have.property('set', key.set);
				expect(key2).to.have.property('key', key.key);
                expect(record2).to.eql(record);

                var key3 = key2;
                var record3 = record2;

                record3.i++;

                client.put(key3, record3, meta, function(err, key4) {
                    expect(err).to.be.ok();
                    expect(err.code).to.equal(status.AEROSPIKE_OK);
					expect(key4).to.have.property('ns', key.ns);
					expect(key4).to.have.property('set', key.set);
					expect(key4).to.have.property('key', key.key);

                    client.get(key4, function(err, record5, metadata5, key5) {
                        expect(err).to.be.ok();
                        expect(err.code).to.equal(status.AEROSPIKE_OK);
						expect(key5).to.have.property('ns', key.ns);
						expect(key5).to.have.property('set', key.set);
						expect(key5).to.have.property('key', key.key);
                        expect(record5).to.eql(record3);
                        expect(metadata5.gen).to.equal(metadata2.gen+1);
                        expect(record5.i).to.equal(record3.i);
						client.remove(key5, function(err, key){});
                        done();
                    });
                });
            });
        });
    });

    it('should write, read, remove, read, write, and check gen', function(done) {
        // generators
        var kgen = keygen.string(options.namespace, options.set, {prefix: "test/get/"});
        var mgen = metagen.constant({ttl: 1000});
        var rgen = recgen.record({i: valgen.integer(), s: valgen.string()});

        // values
        var key     = kgen();
        var meta    = mgen(key);
        var record  = rgen(key, meta);

        // write the record then check
        client.put(key, record, meta, function(err, key1) {
            expect(err).to.be.ok();
            expect(err.code).to.equal(status.AEROSPIKE_OK);
			expect(key1).to.have.property('ns', key.ns);
			expect(key1).to.have.property('set', key.set);
			expect(key1).to.have.property('key', key.key);

            client.get(key1, function(err, record2, metadata2, key2) {
                expect(err).to.be.ok();
                expect(err.code).to.equal(status.AEROSPIKE_OK);
				expect(key2).to.have.property('ns', key.ns);
				expect(key2).to.have.property('set', key.set);
				expect(key2).to.have.property('key', key.key);
                expect(record2).to.eql(record);

                client.remove(key2, function(err, key3) {
                    expect(err).to.be.ok();
                    expect(err.code).to.equal(status.AEROSPIKE_OK);
					expect(key3).to.have.property('ns', key.ns);
					expect(key3).to.have.property('set', key.set);
					expect(key3).to.have.property('key', key.key);

                    client.get(key3, function(err, record4, metadata4, key4) {
                        expect(err).to.be.ok();
						if(err.code != 602)
						{
							expect(err.code).to.equal(status.AEROSPIKE_ERR_RECORD_NOT_FOUND);
						}
						else
						{
							expect(err.code).to.equal(602);
						}

                        client.put(key, record, meta, function(err, key5) {
                            expect(err).to.be.ok();
                            expect(err.code).to.equal(status.AEROSPIKE_OK);
							expect(key5).to.have.property('ns', key.ns);
							expect(key5).to.have.property('set', key.set);
							expect(key5).to.have.property('key', key.key);

                            client.get(key5, function(err, record6, metadata6, key6) {
                                expect(err).to.be.ok();
                                expect(err.code).to.equal(status.AEROSPIKE_OK);
								expect(key6).to.have.property('ns', key.ns);
								expect(key6).to.have.property('set', key.set);
								expect(key6).to.have.property('key', key.key);
                                expect(record6).to.eql(record);
                                expect(metadata6.gen).to.equal(1);
								client.remove(key6, function(err, key){});
                                done();
                            });
                        });
                    });
                });
            });
        });
    });

    it('should write null for bins with empty list and map', function(done) {

        // generators
        var kgen = keygen.string(options.namespace, options.set, {prefix: "test/get/"});
        var mgen = metagen.constant({ttl: 1000});
        var rgen = recgen.record({
            l:  valgen.constant([1,2,3]),
            le: valgen.constant([]),
            m:  valgen.constant({a: 1, b: 2}),
            me: valgen.constant({})
        });

        // values
        var key     = kgen();
        var meta    = mgen(key);
        var record  = rgen(key, meta);

        // write the record then check
        client.put(key, record, meta, function(err, key1) {
            expect(err).to.be.ok();
            expect(err.code).to.equal(status.AEROSPIKE_OK);

			expect(key1).to.have.property('ns', key.ns);
			expect(key1).to.have.property('set', key.set);
			expect(key1).to.have.property('key', key.key);

            client.get(key1, function(err, record2, metadata2, key2) {
                expect(err).to.be.ok();
                expect(err.code).to.equal(status.AEROSPIKE_OK);

				expect(key2).to.have.property('ns', key.ns);
				expect(key2).to.have.property('set', key.set);
				expect(key2).to.have.property('key', key.key);
                expect(record2).to.eql(record);
                expect(record2.m).to.eql({a: 1, b: 2});
                expect(record2.me).to.be.eql({});
                expect(record2.l).to.eql([1,2,3]);
                expect(record2.le).to.be.eql([]);
				client.remove(key, function(err, key) {});
                done();
            });
        });
    });
    it('should write a bin of type undefined and write should fail', function(done) {

        // generators
        var kgen = keygen.string(options.namespace, options.set, {prefix: "test/get/"});
        var mgen = metagen.constant({ttl: 1000});
        var rgen = recgen.record({
            l	  :  valgen.constant([1,2,3]),
            m	  :  valgen.constant({a: 1, b: 2}),
        });

        // values
        var key     = kgen();
        var meta    = mgen(key);
        var record  = rgen(key, meta);
		record.bin_un = undefined;
        // write the record then check
        client.put(key, record, meta, function(err, key1) {
            expect(err).to.be.ok();
            expect(err.code).to.equal(status.AEROSPIKE_ERR_PARAM);
            done();
        });
    });

});
<|endoftext|>


<commit_before>
module.exports = function(grunt) {

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        clean: {
            src: ['dist'],
            options: {
                force: true
            },
        },

        ts: {
            default: {
                src: [
                    './src/**/*.ts'
                ],
                outDir: 'dist',
                options: {
                    module: 'commonjs',
                    //target: 'es5',
                }
            },
        }
    });

    require('load-grunt-tasks')(grunt); // loads all grunt-* npm tasks

    grunt.registerTask('all', 'Performs a cleanup and a full build with all tasks', [
        'clean',
        'ts'
    ]);

};
<commit_msg>reenable es5 target on build<commit_after>
module.exports = function(grunt) {

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        clean: {
            src: ['dist'],
            options: {
                force: true
            },
        },

        ts: {
            default: {
                src: [
                    './src/**/*.ts'
                ],
                outDir: 'dist',
                options: {
                    module: 'commonjs',
                    target: 'es5',
                }
            },
        }
    });

    require('load-grunt-tasks')(grunt); // loads all grunt-* npm tasks

    grunt.registerTask('all', 'Performs a cleanup and a full build with all tasks', [
        'clean',
        'ts'
    ]);

};
<|endoftext|>


<commit_before>var HTML5 = require('html5/parser').HTML5;

p = new HTML5.Parser("<title>Hello!</title>
Hi!

Testing
");

var sys = require('sys');

sys.puts(sys.inspect(p.tree, false, null));
<commit_msg>- start using a battery of tests<commit_after>var HTML5 = require('html5/parser').HTML5;
var assert = require('assert');
var sys = require('sys');

var data = {
	trivial: "<title>Hello!</title>
Hi!

Testing
",
	attr: "<title>Hello!</title>",
	minimal: "
Hi!
",
};

function basic_parser_checks(p) {
	assert.ok(p);
	assert.ok(p.tree);
	assert.ok(p.tree.document);
}

for(i in data) {
	p = new HTML5.Parser(data[i]);
	basic_parser_checks(p);
	sys.puts(sys.inspect(p.tree.document, false, null));
}
<|endoftext|>


<commit_before>var gruntRequireConfig = require('./src/dev/requireConfig').gruntConfig;
var gruntWrapperRequireConfig = require('./src/dev/requireConfig').gruntWrapperConfig;
var gruntDebugConfig = require('./src/dev/requireConfig').gruntDebugConfig;
module.exports = function (grunt) {
    grunt.initConfig({
        requirejs: {
            core: {
                options: gruntRequireConfig
            },
            wrapper: {
                options: gruntWrapperRequireConfig
            },
            debug: {
                options: gruntDebugConfig
            }
        },
        concat: {
            css: {
                src: 'build/tmp/*.css',
                dest: 'build/tmp/razorflow.core.theme.css'
            }
        },
        jst: {
            compile: {
                options: {
                    prettify: true,
                    processName: function (filePath) {
                        var parts = filePath.split('/');
                        var fileName = parts[parts.length - 1];
                        return fileName.split('.')[0];
                    },
                    amd: true,
                    global: false,
                    requires: {
                        'vendor/lodash' : '_'
                    }
                },
                files: {
                    "src/js/generated/templates.js": ["src/templates/*.html"]
                }
            }
        },
        less: {
            development: {
                options: {
                    paths: ['src/less']
                },
                files: {
                    "build/tmp/razorflow.css": "src/less/razorflow.less",
                    "build/tmp/rftheme.default.css": "build/tmp/less/rftheme.default.less"
                }
            }
        },
        jshint: {
            options: {
                jshintrc: 'src/js/.jshintrc'
            },
            files: [
                "src/js/**/*.js",
                "!src/js/vendor/**/*.js",
                "!src/js/generated/templates.js"
            ]
        },
        karma: {
            dev: {
                configFile: './karma.conf.js',
                singleRun: true
            }
        },
        lodash: {
            build: {
                dest: 'src/vendor/js/lodash.rf.js',
                options: {
                    include: ['extend', 'pluck', 'map', 'each', 'isNumber', 'isString', 'isNaN', 'isArray', 'isObject', 'find', 'defer', 'delay', 'max', 'min', 'sortBy', 'flatten', 'clone', 'cloneDeep', 'values', 'pick', 'reduce', 'filter', 'indexOf', 'keys', 'debounce'],
                }
            }
        },
        cssmin: {
            minify: {
                expand: true,
                cwd: 'build/tmp/',
                src: ['razorflow.core.theme.css'],
                dest: 'build/assets/css',
                ext: '.min.css'
            }
        },
        // Need to copy products.json
        copy: {
            localToWebRF: {
                files: [
                    {src: ["build/js/razorflow.min.js"], dest: '../webrf/backend/static/transfer/', flatten:true},
                    {src: ["build/css/razorflow.min.css"], dest: '../webrf/backend/static/transfer/', flatten:true},
                    {src: ["build/js/templates.js"], dest: '../webrf/backend/static/transfer/', flatten:true},
                    {src: ["build/js/rfDemos.js"], dest: '../webrf/backend/static/transfer/', flatten:true},
                    {src: ["build/img/exampleImgs/*.png"], dest: '../webrf/backend/static/transfer/',flatten: true },
                ]
            }
        },
        copyto: {
            srcToBuild: {
                files: [
                    {cwd: 'src/vendor/js/', src: ['jquery.min.js'], dest: 'build/assets/js/'},
                ]
            },
            packageToBuild: {
                files: [
                    {cwd: 'src/package/', src: ['**/*'], dest: 'build/package/'},
                ],
            },
            assetsToPackage: {
                files: [
                    {cwd: 'build/assets/', src: ["js/**", "css/**", "img/**"], dest: 'build/package/files/'},
                    {cwd: 'build/assets/', src: ["js/**", "css/**", "img/**"], dest: 'build/package/dashboard_quickstart/'},
                ],
            },
            packageToRelease: {
                files: [
                    {cwd: 'src/package/', src: ['**'], dest: '../package/rf/javascript/'}
                ]
            },
            razorcharts: {
                files: [
                    {cwd: '../razorcharts/src/js', src:['**'], dest: 'src/js/'}
                ]
            },
            sprite: {
                files: [
                    {cwd: 'src/img/', src:['**'], dest: 'build/img/'},
                    {cwd: 'src/img/', src:['**'], dest: 'build/assets/img/'}
                ]
            },
            themebuilder: {
                files: [
                    {cwd: 'src/less/', src: ["theme.less", "mixins.less", "theme/variables.less"], dest: 'build/tmp/themebuilder/'},
                    {cwd: 'src/js/themebuilder/config/', src: ["defaulttheme.json"], dest: 'build/tmp/themebuilder/'}
                ]
            },
            connectors: {
                files: [
                    {cwd: '../cloudconnect/src/', src:['**'], dest: 'extras/connectors/'}
                ]
            }
        },
        replace: {
            removeAMD: {
                src: "build/assets/js/razorflow.min.js",
                overwrite: true,
                replacements: [
                    {from: /\bdefine\b/g, to: "_dfn"},
                    {from: /\brequire\b/g, to: "_rqr"}
                ]
            }
        },
        clean: {
            build: ["build"]
        },
        featuregen: {
            getFeature: {
                options: {
                    files: "src/js/**/*.js",
                    out: "build/out.html",
                    extension: ".js"
                }
            }
        },
        themegen: {
            defaultTheme: {
                options: {
                    themeJSON: "src/js/themebuilder/config/defaulttheme.json",
                    out: "build/tmp/less/rftheme.default.less"
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-requirejs');
    // grunt.loadNpmTasks('grunt-contrib-jst');
    grunt.loadTasks("../grunt-contrib-jst/tasks");
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-karma');
    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-lodash');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-text-replace');
    grunt.loadNpmTasks('grunt-copy-to');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadTasks("./tools/src/grunt-tasks");

    grunt.registerTask('compile', ['themegen', 'less:development', 'jst:compile', 'copyto:sprite', 'copyto:themebuilder']);
    grunt.registerTask('test', ['compile', 'karma:dev', 'shell:coverageReport']);

    grunt.registerTask('build', ["clean:build", "copyto:razorcharts", "compile", "less", "jst:compile", 'requirejs:core', 'requirejs:wrapper', 'requirejs:debug', "replace:removeAMD", 'concat:css', 'cssmin:minify', "copyto:srcToBuild"])
    grunt.registerTask('package', ['build', 'copyto:packageToBuild', 'copyto:assetsToPackage'])
    // grunt.registerTask('websiteRelease', ['build', 'cssmin:minify', 'squashdemos', "screenshotGen:examples", 'copy:localToWebRF'])
}<commit_msg>fixed some lints and also use new logger technique for standalone builder and wrapper<commit_after>var gruntRequireConfig = require('./src/dev/requireConfig').gruntConfig;
var gruntWrapperRequireConfig = require('./src/dev/requireConfig').gruntWrapperConfig;
var gruntDebugConfig = require('./src/dev/requireConfig').gruntDebugConfig;
module.exports = function (grunt) {
    grunt.initConfig({
        requirejs: {
            core: {
                options: gruntRequireConfig
            },
            wrapper: {
                options: gruntWrapperRequireConfig
            },
            debug: {
                options: gruntDebugConfig
            }
        },
        concat: {
            css: {
                src: 'build/tmp/*.css',
                dest: 'build/tmp/razorflow.core.theme.css'
            }
        },
        jst: {
            compile: {
                options: {
                    prettify: true,
                    processName: function (filePath) {
                        var parts = filePath.split('/');
                        var fileName = parts[parts.length - 1];
                        return fileName.split('.')[0];
                    },
                    amd: true,
                    global: false,
                    requires: {
                        'vendor/lodash' : '_'
                    }
                },
                files: {
                    "src/js/generated/templates.js": ["src/templates/*.html"]
                }
            }
        },
        less: {
            development: {
                options: {
                    paths: ['src/less']
                },
                files: {
                    "build/tmp/razorflow.css": "src/less/razorflow.less",
                    "build/tmp/rftheme.default.css": "build/tmp/less/rftheme.default.less"
                }
            }
        },
        jshint: {
            options: {
                jshintrc: 'src/js/.jshintrc'
            },
            files: [
                "src/js/**/*.js",
                "!src/js/vendor/**/*.js",
                "!src/js/generated/templates.js",
                "!src/js/buildutils/**/*.js"
            ]
        },
        karma: {
            dev: {
                configFile: './karma.conf.js',
                singleRun: true
            }
        },
        lodash: {
            build: {
                dest: 'src/vendor/js/lodash.rf.js',
                options: {
                    include: ['extend', 'pluck', 'map', 'each', 'isNumber', 'isString', 'isNaN', 'isArray', 'isObject', 'find', 'defer', 'delay', 'max', 'min', 'sortBy', 'flatten', 'clone', 'cloneDeep', 'values', 'pick', 'reduce', 'filter', 'indexOf', 'keys', 'debounce'],
                }
            }
        },
        cssmin: {
            minify: {
                expand: true,
                cwd: 'build/tmp/',
                src: ['razorflow.core.theme.css'],
                dest: 'build/assets/css',
                ext: '.min.css'
            }
        },
        // Need to copy products.json
        copy: {
            localToWebRF: {
                files: [
                    {src: ["build/js/razorflow.min.js"], dest: '../webrf/backend/static/transfer/', flatten:true},
                    {src: ["build/css/razorflow.min.css"], dest: '../webrf/backend/static/transfer/', flatten:true},
                    {src: ["build/js/templates.js"], dest: '../webrf/backend/static/transfer/', flatten:true},
                    {src: ["build/js/rfDemos.js"], dest: '../webrf/backend/static/transfer/', flatten:true},
                    {src: ["build/img/exampleImgs/*.png"], dest: '../webrf/backend/static/transfer/',flatten: true },
                ]
            }
        },
        copyto: {
            srcToBuild: {
                files: [
                    {cwd: 'src/vendor/js/', src: ['jquery.min.js'], dest: 'build/assets/js/'},
                ]
            },
            packageToBuild: {
                files: [
                    {cwd: 'src/package/', src: ['**/*'], dest: 'build/package/'},
                ],
            },
            assetsToPackage: {
                files: [
                    {cwd: 'build/assets/', src: ["js/**", "css/**", "img/**"], dest: 'build/package/files/'},
                    {cwd: 'build/assets/', src: ["js/**", "css/**", "img/**"], dest: 'build/package/dashboard_quickstart/'},
                ],
            },
            packageToRelease: {
                files: [
                    {cwd: 'src/package/', src: ['**'], dest: '../package/rf/javascript/'}
                ]
            },
            razorcharts: {
                files: [
                    {cwd: '../razorcharts/src/js', src:['**'], dest: 'src/js/'}
                ]
            },
            sprite: {
                files: [
                    {cwd: 'src/img/', src:['**'], dest: 'build/img/'},
                    {cwd: 'src/img/', src:['**'], dest: 'build/assets/img/'}
                ]
            },
            themebuilder: {
                files: [
                    {cwd: 'src/less/', src: ["theme.less", "mixins.less", "theme/variables.less"], dest: 'build/tmp/themebuilder/'},
                    {cwd: 'src/js/themebuilder/config/', src: ["defaulttheme.json"], dest: 'build/tmp/themebuilder/'}
                ]
            },
            connectors: {
                files: [
                    {cwd: '../cloudconnect/src/', src:['**'], dest: 'extras/connectors/'}
                ]
            }
        },
        replace: {
            removeAMD: {
                src: "build/assets/js/razorflow.min.js",
                overwrite: true,
                replacements: [
                    {from: /\bdefine\b/g, to: "_dfn"},
                    {from: /\brequire\b/g, to: "_rqr"}
                ]
            }
        },
        clean: {
            build: ["build"]
        },
        featuregen: {
            getFeature: {
                options: {
                    files: "src/js/**/*.js",
                    out: "build/out.html",
                    extension: ".js"
                }
            }
        },
        themegen: {
            defaultTheme: {
                options: {
                    themeJSON: "src/js/themebuilder/config/defaulttheme.json",
                    out: "build/tmp/less/rftheme.default.less"
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-requirejs');
    // grunt.loadNpmTasks('grunt-contrib-jst');
    grunt.loadTasks("../grunt-contrib-jst/tasks");
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-karma');
    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-lodash');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-text-replace');
    grunt.loadNpmTasks('grunt-copy-to');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadTasks("./tools/src/grunt-tasks");

    grunt.registerTask('compile', ['themegen', 'less:development', 'jst:compile', 'copyto:sprite', 'copyto:themebuilder']);
    grunt.registerTask('test', ['compile', 'karma:dev', 'shell:coverageReport']);

    grunt.registerTask('build', ["clean:build", "copyto:razorcharts", "compile", "less", "jst:compile", 'requirejs:core', 'requirejs:wrapper', 'requirejs:debug', "replace:removeAMD", 'concat:css', 'cssmin:minify', "copyto:srcToBuild"])
    grunt.registerTask('package', ['build', 'copyto:packageToBuild', 'copyto:assetsToPackage'])
    // grunt.registerTask('websiteRelease', ['build', 'cssmin:minify', 'squashdemos', "screenshotGen:examples", 'copy:localToWebRF'])
}<|endoftext|>


<commit_before>module.exports = function( grunt ) {
	"use strict";

	function readOptionalJSON( filepath ) {
		var stripJSONComments = require( "strip-json-comments" ),
			data = {};
		try {
			data = JSON.parse( stripJSONComments(
				fs.readFileSync( filepath, { encoding: "utf8" } )
			) );
		} catch ( e ) {}
		return data;
	}

	var fs = require( "fs" ),
		gzip = require( "gzip-js" ),
		srcHintOptions = readOptionalJSON( "src/.jshintrc" ),

		// Skip jsdom-related tests in Node.js 0.10 & 0.12
		runJsdomTests = !/^v0/.test( process.version );

	if ( !grunt.option( "filename" ) ) {
		grunt.option( "filename", "jquery.js" );
	}

	grunt.initConfig( {
		pkg: grunt.file.readJSON( "package.json" ),
		dst: readOptionalJSON( "dist/.destination.json" ),
		"compare_size": {
			files: [ "dist/jquery.js", "dist/jquery.min.js" ],
			options: {
				compress: {
					gz: function( contents ) {
						return gzip.zip( contents, {} ).length;
					}
				},
				cache: "build/.sizecache.json"
			}
		},
		babel: {
			options: {
				sourceMap: "inline",
				retainLines: true
			},
			nodeSmokeTests: {
				files: {
					"test/node_smoke_tests/lib/ensure_iterability.js":
						"test/node_smoke_tests/lib/ensure_iterability_es6.js"
				}
			}
		},
		build: {
			all: {
				dest: "dist/jquery.js",
				minimum: [
					"core",
					"selector"
				],

				// Exclude specified modules if the module matching the key is removed
				removeWith: {
					ajax: [ "manipulation/_evalUrl", "event/ajax" ],
					callbacks: [ "deferred" ],
					css: [ "effects", "dimensions", "offset" ],
					"css/showHide": [ "effects" ],
					deferred: {
						remove: [ "ajax", "effects", "queue", "core/ready" ],
						include: [ "core/ready-no-deferred" ]
					},
					sizzle: [ "css/hiddenVisibleSelectors", "effects/animatedSelector" ]
				}
			}
		},
		npmcopy: {
			all: {
				options: {
					destPrefix: "external"
				},
				files: {
					"sizzle/dist": "sizzle/dist",
					"sizzle/LICENSE.txt": "sizzle/LICENSE.txt",

					"npo/npo.js": "native-promise-only/npo.js",

					"qunit/qunit.js": "qunitjs/qunit/qunit.js",
					"qunit/qunit.css": "qunitjs/qunit/qunit.css",
					"qunit/LICENSE.txt": "qunitjs/LICENSE.txt",

					"qunit-assert-step/qunit-assert-step.js":
					"qunit-assert-step/qunit-assert-step.js",
					"qunit-assert-step/MIT-LICENSE.txt":
					"qunit-assert-step/MIT-LICENSE.txt",

					"requirejs/require.js": "requirejs/require.js",

					"sinon/sinon.js": "sinon/pkg/sinon.js",
					"sinon/LICENSE.txt": "sinon/LICENSE"
				}
			}
		},
		jsonlint: {
			pkg: {
				src: [ "package.json" ]
			}
		},
		jshint: {
			all: {
				src: [
					"src/**/*.js", "Gruntfile.js", "test/**/*.js", "build/**/*.js"
				],
				options: {
					jshintrc: true
				}
			},
			dist: {
				src: "dist/jquery.js",
				options: srcHintOptions
			}
		},
		jscs: {
			src: "src",
			gruntfile: "Gruntfile.js",

			// Check parts of tests that pass
			test: [
				"test/data/testrunner.js",
				"test/unit/animation.js",
				"test/unit/basic.js",
				"test/unit/support.js",
				"test/unit/tween.js",
				"test/unit/wrap.js"
			],
			build: "build"
		},
		testswarm: {
			tests: [

				// A special module with basic tests, meant for
				// not fully supported environments like Android 2.3,
				// jsdom or PhantomJS. We run it everywhere, though,
				// to make sure tests are not broken.
				"basic",

				"ajax",
				"animation",
				"attributes",
				"callbacks",
				"core",
				"css",
				"data",
				"deferred",
				"deprecated",
				"dimensions",
				"effects",
				"event",
				"manipulation",
				"offset",
				"queue",
				"selector",
				"serialize",
				"support",
				"traversing",
				"tween"
			]
		},
		watch: {
			files: [ "<%= jshint.all.src %>" ],
			tasks: [ "dev" ]
		},
		uglify: {
			all: {
				files: {
					"dist/<%= grunt.option('filename').replace('.js', '.min.js') %>":
						"dist/<%= grunt.option('filename') %>"
				},
				options: {
					preserveComments: false,
					sourceMap: true,
					ASCIIOnly: true,
					sourceMapName:
						"dist/<%= grunt.option('filename').replace('.js', '.min.map') %>",
					report: "min",
					beautify: {
						"ascii_only": true
					},
					banner: "/*! jQuery v<%= pkg.version %> | " +
						"(c) jQuery Foundation | jquery.org/license */",
					compress: {
						"hoist_funs": false,
						loops: false,
						unused: false
					}
				}
			}
		}
	} );

	// Load grunt tasks from NPM packages
	require( "load-grunt-tasks" )( grunt );

	// Integrate jQuery specific tasks
	grunt.loadTasks( "build/tasks" );

	grunt.registerTask( "lint", [ "jsonlint", "jshint", "jscs" ] );

	// Don't run Node-related tests in Node.js < 1.0.0 as they require an old
	// jsdom version that needs compiling, making it harder for people to compile
	// jQuery on Windows. (see gh-2519)
	grunt.registerTask( "test_fast", runJsdomTests ? [ "node_smoke_tests" ] : [] );

	grunt.registerTask( "test", [ "test_fast" ].concat(
		runJsdomTests ? [ "promises_aplus_tests" ] : []
	) );

	// Short list as a high frequency watch task
	grunt.registerTask( "dev", [ "build:*:*", "lint", "uglify", "remove_map_comment", "dist:*" ] );

	grunt.registerTask( "default", [ "dev", "test_fast", "compare_size" ] );

	grunt.registerTask( "precommit_lint", [ "newer:jsonlint", "newer:jshint", "newer:jscs" ] );
};
<commit_msg>Build: Don't lint the built file in the husky precommit hook<commit_after>module.exports = function( grunt ) {
	"use strict";

	function readOptionalJSON( filepath ) {
		var stripJSONComments = require( "strip-json-comments" ),
			data = {};
		try {
			data = JSON.parse( stripJSONComments(
				fs.readFileSync( filepath, { encoding: "utf8" } )
			) );
		} catch ( e ) {}
		return data;
	}

	var fs = require( "fs" ),
		gzip = require( "gzip-js" ),
		srcHintOptions = readOptionalJSON( "src/.jshintrc" ),

		// Skip jsdom-related tests in Node.js 0.10 & 0.12
		runJsdomTests = !/^v0/.test( process.version );

	if ( !grunt.option( "filename" ) ) {
		grunt.option( "filename", "jquery.js" );
	}

	grunt.initConfig( {
		pkg: grunt.file.readJSON( "package.json" ),
		dst: readOptionalJSON( "dist/.destination.json" ),
		"compare_size": {
			files: [ "dist/jquery.js", "dist/jquery.min.js" ],
			options: {
				compress: {
					gz: function( contents ) {
						return gzip.zip( contents, {} ).length;
					}
				},
				cache: "build/.sizecache.json"
			}
		},
		babel: {
			options: {
				sourceMap: "inline",
				retainLines: true
			},
			nodeSmokeTests: {
				files: {
					"test/node_smoke_tests/lib/ensure_iterability.js":
						"test/node_smoke_tests/lib/ensure_iterability_es6.js"
				}
			}
		},
		build: {
			all: {
				dest: "dist/jquery.js",
				minimum: [
					"core",
					"selector"
				],

				// Exclude specified modules if the module matching the key is removed
				removeWith: {
					ajax: [ "manipulation/_evalUrl", "event/ajax" ],
					callbacks: [ "deferred" ],
					css: [ "effects", "dimensions", "offset" ],
					"css/showHide": [ "effects" ],
					deferred: {
						remove: [ "ajax", "effects", "queue", "core/ready" ],
						include: [ "core/ready-no-deferred" ]
					},
					sizzle: [ "css/hiddenVisibleSelectors", "effects/animatedSelector" ]
				}
			}
		},
		npmcopy: {
			all: {
				options: {
					destPrefix: "external"
				},
				files: {
					"sizzle/dist": "sizzle/dist",
					"sizzle/LICENSE.txt": "sizzle/LICENSE.txt",

					"npo/npo.js": "native-promise-only/npo.js",

					"qunit/qunit.js": "qunitjs/qunit/qunit.js",
					"qunit/qunit.css": "qunitjs/qunit/qunit.css",
					"qunit/LICENSE.txt": "qunitjs/LICENSE.txt",

					"qunit-assert-step/qunit-assert-step.js":
					"qunit-assert-step/qunit-assert-step.js",
					"qunit-assert-step/MIT-LICENSE.txt":
					"qunit-assert-step/MIT-LICENSE.txt",

					"requirejs/require.js": "requirejs/require.js",

					"sinon/sinon.js": "sinon/pkg/sinon.js",
					"sinon/LICENSE.txt": "sinon/LICENSE"
				}
			}
		},
		jsonlint: {
			pkg: {
				src: [ "package.json" ]
			}
		},
		jshint: {
			all: {
				src: [
					"src/**/*.js", "Gruntfile.js", "test/**/*.js", "build/**/*.js"
				],
				options: {
					jshintrc: true
				}
			},
			dist: {
				src: "dist/jquery.js",
				options: srcHintOptions
			}
		},
		jscs: {
			src: "src",
			gruntfile: "Gruntfile.js",

			// Check parts of tests that pass
			test: [
				"test/data/testrunner.js",
				"test/unit/animation.js",
				"test/unit/basic.js",
				"test/unit/support.js",
				"test/unit/tween.js",
				"test/unit/wrap.js"
			],
			build: "build"
		},
		testswarm: {
			tests: [

				// A special module with basic tests, meant for
				// not fully supported environments like Android 2.3,
				// jsdom or PhantomJS. We run it everywhere, though,
				// to make sure tests are not broken.
				"basic",

				"ajax",
				"animation",
				"attributes",
				"callbacks",
				"core",
				"css",
				"data",
				"deferred",
				"deprecated",
				"dimensions",
				"effects",
				"event",
				"manipulation",
				"offset",
				"queue",
				"selector",
				"serialize",
				"support",
				"traversing",
				"tween"
			]
		},
		watch: {
			files: [ "<%= jshint.all.src %>" ],
			tasks: [ "dev" ]
		},
		uglify: {
			all: {
				files: {
					"dist/<%= grunt.option('filename').replace('.js', '.min.js') %>":
						"dist/<%= grunt.option('filename') %>"
				},
				options: {
					preserveComments: false,
					sourceMap: true,
					ASCIIOnly: true,
					sourceMapName:
						"dist/<%= grunt.option('filename').replace('.js', '.min.map') %>",
					report: "min",
					beautify: {
						"ascii_only": true
					},
					banner: "/*! jQuery v<%= pkg.version %> | " +
						"(c) jQuery Foundation | jquery.org/license */",
					compress: {
						"hoist_funs": false,
						loops: false,
						unused: false
					}
				}
			}
		}
	} );

	// Load grunt tasks from NPM packages
	require( "load-grunt-tasks" )( grunt );

	// Integrate jQuery specific tasks
	grunt.loadTasks( "build/tasks" );

	grunt.registerTask( "lint", [ "jsonlint", "jshint", "jscs" ] );

	// Don't run Node-related tests in Node.js < 1.0.0 as they require an old
	// jsdom version that needs compiling, making it harder for people to compile
	// jQuery on Windows. (see gh-2519)
	grunt.registerTask( "test_fast", runJsdomTests ? [ "node_smoke_tests" ] : [] );

	grunt.registerTask( "test", [ "test_fast" ].concat(
		runJsdomTests ? [ "promises_aplus_tests" ] : []
	) );

	// Short list as a high frequency watch task
	grunt.registerTask( "dev", [ "build:*:*", "lint", "uglify", "remove_map_comment", "dist:*" ] );

	grunt.registerTask( "default", [ "dev", "test_fast", "compare_size" ] );

	grunt.registerTask( "precommit_lint", [ "newer:jsonlint", "newer:jshint:all", "newer:jscs" ] );
};
<|endoftext|>


<commit_before>var path = require('path');
var chalk = require('chalk');
var Nightmare = require('nightmare');

var nightmare = Nightmare({ show: false });

var tests = [];
var test;
var errored;

nightmare.on('console', function(method, message) {
  var args = [].slice.call(arguments, 2);

  switch (message) {
    case 'start':
      test = { title: args[0] };
      tests.push(test);
      break;

    case 'skip':
      test = { title: args[0], skipped: true };
      tests.push(test);
      break;

    case 'error':
      test.errored = true;
      test.errorMessage = args.join(' ');
      break;

    case 'end':
      if (test.errored) {
        console.log(chalk.red('❌ ' + test.title));
        console.log('  ⤷ ' + test.errorMessage);
        errored = true;
      } else if (test.skipped) {
        console.log(chalk.yellow('⬚ ' + test.title + ' (skipped)'));
      } else {
        console.log(chalk.green('✔ ' + test.title));
      }
      break;
  }
});

console.log('running tests...');

var timeout = setTimeout(() => {
  console.log('timed out!');
  process.exit(1);
}, 10000);

nightmare
  .goto('file://' + path.resolve(__dirname, 'index.html'))
  .run(() => {
    console.log('...tests completed');
    process.exit(errored ? 1 : 0);
  });
<commit_msg>Increase test timeout to 1 minute<commit_after>var path = require('path');
var chalk = require('chalk');
var Nightmare = require('nightmare');

var nightmare = Nightmare({ show: false });

var tests = [];
var test;
var errored;

nightmare.on('console', function(method, message) {
  var args = [].slice.call(arguments, 2);

  switch (message) {
    case 'start':
      test = { title: args[0] };
      tests.push(test);
      break;

    case 'skip':
      test = { title: args[0], skipped: true };
      tests.push(test);
      break;

    case 'error':
      test.errored = true;
      test.errorMessage = args.join(' ');
      break;

    case 'end':
      if (test.errored) {
        console.log(chalk.red('❌ ' + test.title));
        console.log('  ⤷ ' + test.errorMessage);
        errored = true;
      } else if (test.skipped) {
        console.log(chalk.yellow('⬚ ' + test.title + ' (skipped)'));
      } else {
        console.log(chalk.green('✔ ' + test.title));
      }
      break;
  }
});

console.log('running tests...');

var timeout = setTimeout(() => {
  console.log('timed out!');
  process.exit(1);
}, 60000);

nightmare
  .goto('file://' + path.resolve(__dirname, 'index.html'))
  .run(() => {
    console.log('...tests completed');
    process.exit(errored ? 1 : 0);
  });
<|endoftext|>


<commit_before>'use strict';

module.exports = function(grunt) {
    var path = require('path');

    function compressPath(p) {
        var src = 'src/encoded/static/';
        p = path.relative(__dirname, p);
        if (p.slice(0, src.length) == src) {
            return '../' + p.slice(src.length);
        }
        return '../../' + p;
    }

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        browserify: {
            brace: {
                dest: './src/encoded/static/build/brace.js',
                require: [
                    'brace',
                    'brace/mode/json',
                    'brace/theme/solarized_light',
                ],
                plugin: [
                    ['minifyify', {
                        map: 'brace.js.map',
                        output: './src/encoded/static/build/brace.js.map',
                        compressPath: compressPath,
                        uglify: {mangle: process.env.NODE_ENV == 'production'},
                    }],
                ],
            },
            dagre: {
                dest: './src/encoded/static/build/dagre.js',
                require: [
                    'dagre-d3',
                    'd3',
                ],
                options: {
                    debug: true,
                },
                plugin: [
                    ['minifyify', {
                        map: 'dagre.js.map',
                        output: './src/encoded/static/build/dagre.js.map',
                        compressPath: compressPath,
                        uglify: {mangle: process.env.NODE_ENV == 'production'},
                    }],
                ],
            },
            inline: {
                dest: './src/encoded/static/build/inline.js',
                src: [
                    './src/encoded/static/inline.js',
                ],
                require: [
                    'scriptjs',
                    'google-analytics',
                ],
                transform: [
                    'brfs',
                    'envify',
                ],
                plugin: [
                    ['minifyify', {
                        map: '/static/build/inline.js.map',
                        output: './src/encoded/static/build/inline.js.map',
                        compressPath: compressPath,
                        uglify: {mangle: process.env.NODE_ENV == 'production'},
                    }],
                ],
            },
            browser: {
                dest: './src/encoded/static/build/bundle.js',
                src: [
                    'es5-shim',
                    'es5-shim/es5-sham',
                    'babel-core/polyfill',
                    'html5shiv/dist/html5shiv',
                    './src/encoded/static/libs/compat.js', // The shims should execute first
                    './src/encoded/static/libs/sticky_header.js',
                    './src/encoded/static/libs/respond.js',
                    './src/encoded/static/browser.js',
                ],
                external: [
                    'brace',
                    'brace/mode/json',
                    'brace/theme/solarized_light',
                    'dagre-d3',
                    'd3',
                    'scriptjs',
                    'google-analytics',
                ],
                transform: [
                    [{sourceMap: true, loose: "all", optional: ["spec.protoToAssign"]}, 'babelify'],
                    'brfs',
                    'envify',
                ],
                plugin: [
                    ['minifyify', {
                        map: 'bundle.js.map',
                        output: './src/encoded/static/build/bundle.js.map',
                        compressPath: compressPath,
                        uglify: {mangle: process.env.NODE_ENV == 'production'},
                    }],
                ],
            },
            server: {
                dest: './src/encoded/static/build/renderer.js',
                src: ['./src/encoded/static/server.js'],
                options: {
                    builtins: false,
                    detectGlobals: false,
                },
                transform: [
                    [{sourceMap: true}, 'babelify'],
                    'brfs',
                    'envify',
                ],
                plugin: [
                    ['minifyify', {map:
                        'renderer.js.map',
                        output: './src/encoded/static/build/renderer.js.map',
                        compressPath: compressPath,
                        uglify: {mangle: process.env.NODE_ENV == 'production'},
                    }],
                ],
                external: [
                    'assert',
                    'brace',
                    'brace/mode/json',
                    'brace/theme/solarized_light',
                    'dagre-d3',
                    'd3',
                    'source-map-support',
                ],
                ignore: [
                    'jquery',
                    'scriptjs',
                    'google-analytics',
                    'ckeditor',
                ],
            },
        },
        copy: {
            ckeditor: {
                expand: true,
                cwd: 'node_modules/node-ckeditor',
                src: 'ckeditor/**',
                dest: 'src/encoded/static/build/',
            }
        },
    });

    grunt.registerMultiTask('browserify', function (watch) {
        var browserify = require('browserify');
        var watchify = require('watchify');
        var _ = grunt.util._;
        var path = require('path');
        var fs = require('fs');
        var data = this.data;
        var options = _.extend({
            debug: true,
            cache: {},
            packageCache: {},
            fullPaths: watch
        }, data.options);

        var b = browserify(options);
        if (watch) {
            b = watchify(b);
        }

        var i;
        var reqs = [];
        (data.src || []).forEach(function (src) {
            reqs.push.apply(reqs, grunt.file.expand({filter: 'isFile'}, src).map(function (f) {
                return [path.resolve(f), {entry: true}];
            }));
        });
        (data.require || []).forEach(function (req) {
            if (typeof req === 'string') req = [req];
            reqs.push(req);
        });

        for (i = 0; i < reqs.length; i++) {
            b.require.apply(b, reqs[i]);
        }

        var external = data.external || [];
        for (i = 0; i < external.length; i++) {
            b.external(external[i]);
        }

        options.filter = function (id) {
            return external.indexOf(id) < 0;
        };

        var ignore = data.ignore || [];
        for (i = 0; i < ignore.length; i++) {
            b.ignore(ignore[i]);
        }

        (data.transform || []).forEach(function (args) {
            if (typeof args === 'string') args = [args];
            b.transform.apply(b, args);
        });

        (data.plugin || []).forEach(function (args) {
            if (typeof args === 'string') args = [args];
            b.plugin.apply(b, args);
        });

        var dest = data.dest;
        grunt.file.mkdir(path.dirname(dest));

        var bundle = function(done) {
            var out = fs.createWriteStream(dest);
            b.bundle().pipe(out);
            out.on('close', function() {
                grunt.log.write('Wrote ' + dest + '\n');
                if (done !== undefined) done();
            });
        };
        b.on('update', function() { bundle(); });
        var done = this.async();
        bundle(done);
    });

    grunt.registerTask('wait', function() {
        grunt.log.write('Waiting for changes...\n');
        this.async();
    });

    grunt.loadNpmTasks('grunt-contrib-copy');

    grunt.registerTask('default', ['browserify', 'copy']);
    grunt.registerTask('watch', ['browserify:*:watch', 'wait']);
};
<commit_msg>update Gruntfile not to call watchify unless watching.<commit_after>'use strict';

module.exports = function(grunt) {
    var path = require('path');

    function compressPath(p) {
        var src = 'src/encoded/static/';
        p = path.relative(__dirname, p);
        if (p.slice(0, src.length) == src) {
            return '../' + p.slice(src.length);
        }
        return '../../' + p;
    }

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        browserify: {
            brace: {
                dest: './src/encoded/static/build/brace.js',
                require: [
                    'brace',
                    'brace/mode/json',
                    'brace/theme/solarized_light',
                ],
                plugin: [
                    ['minifyify', {
                        map: 'brace.js.map',
                        output: './src/encoded/static/build/brace.js.map',
                        compressPath: compressPath,
                        uglify: {mangle: process.env.NODE_ENV == 'production'},
                    }],
                ],
            },
            dagre: {
                dest: './src/encoded/static/build/dagre.js',
                require: [
                    'dagre-d3',
                    'd3',
                ],
                options: {
                    debug: true,
                },
                plugin: [
                    ['minifyify', {
                        map: 'dagre.js.map',
                        output: './src/encoded/static/build/dagre.js.map',
                        compressPath: compressPath,
                        uglify: {mangle: process.env.NODE_ENV == 'production'},
                    }],
                ],
            },
            inline: {
                dest: './src/encoded/static/build/inline.js',
                src: [
                    './src/encoded/static/inline.js',
                ],
                require: [
                    'scriptjs',
                    'google-analytics',
                ],
                transform: [
                    'brfs',
                    'envify',
                ],
                plugin: [
                    ['minifyify', {
                        map: '/static/build/inline.js.map',
                        output: './src/encoded/static/build/inline.js.map',
                        compressPath: compressPath,
                        uglify: {mangle: process.env.NODE_ENV == 'production'},
                    }],
                ],
            },
            browser: {
                dest: './src/encoded/static/build/bundle.js',
                src: [
                    'es5-shim',
                    'es5-shim/es5-sham',
                    'babel-core/polyfill',
                    'html5shiv/dist/html5shiv',
                    './src/encoded/static/libs/compat.js', // The shims should execute first
                    './src/encoded/static/libs/sticky_header.js',
                    './src/encoded/static/libs/respond.js',
                    './src/encoded/static/browser.js',
                ],
                external: [
                    'brace',
                    'brace/mode/json',
                    'brace/theme/solarized_light',
                    'dagre-d3',
                    'd3',
                    'scriptjs',
                    'google-analytics',
                ],
                transform: [
                    [{sourceMap: true, loose: "all", optional: ["spec.protoToAssign"]}, 'babelify'],
                    'brfs',
                    'envify',
                ],
                plugin: [
                    ['minifyify', {
                        map: 'bundle.js.map',
                        output: './src/encoded/static/build/bundle.js.map',
                        compressPath: compressPath,
                        uglify: {mangle: process.env.NODE_ENV == 'production'},
                    }],
                ],
            },
            server: {
                dest: './src/encoded/static/build/renderer.js',
                src: ['./src/encoded/static/server.js'],
                options: {
                    builtins: false,
                    detectGlobals: false,
                },
                transform: [
                    [{sourceMap: true}, 'babelify'],
                    'brfs',
                    'envify',
                ],
                plugin: [
                    ['minifyify', {map:
                        'renderer.js.map',
                        output: './src/encoded/static/build/renderer.js.map',
                        compressPath: compressPath,
                        uglify: {mangle: process.env.NODE_ENV == 'production'},
                    }],
                ],
                external: [
                    'assert',
                    'brace',
                    'brace/mode/json',
                    'brace/theme/solarized_light',
                    'dagre-d3',
                    'd3',
                    'source-map-support',
                ],
                ignore: [
                    'jquery',
                    'scriptjs',
                    'google-analytics',
                    'ckeditor',
                ],
            },
        },
        copy: {
            ckeditor: {
                expand: true,
                cwd: 'node_modules/node-ckeditor',
                src: 'ckeditor/**',
                dest: 'src/encoded/static/build/',
            }
        },
    });

    grunt.registerMultiTask('browserify', function (watch) {
        var browserify = require('browserify');
        var _ = grunt.util._;
        var path = require('path');
        var fs = require('fs');
        var data = this.data;
        var options = _.extend({
            debug: true,
            cache: {},
            packageCache: {},
            fullPaths: watch
        }, data.options);

        var b = browserify(options);
        if (watch) {
            b = require('watchify')(b);
        }

        var i;
        var reqs = [];
        (data.src || []).forEach(function (src) {
            reqs.push.apply(reqs, grunt.file.expand({filter: 'isFile'}, src).map(function (f) {
                return [path.resolve(f), {entry: true}];
            }));
        });
        (data.require || []).forEach(function (req) {
            if (typeof req === 'string') req = [req];
            reqs.push(req);
        });

        for (i = 0; i < reqs.length; i++) {
            b.require.apply(b, reqs[i]);
        }

        var external = data.external || [];
        for (i = 0; i < external.length; i++) {
            b.external(external[i]);
        }

        options.filter = function (id) {
            return external.indexOf(id) < 0;
        };

        var ignore = data.ignore || [];
        for (i = 0; i < ignore.length; i++) {
            b.ignore(ignore[i]);
        }

        (data.transform || []).forEach(function (args) {
            if (typeof args === 'string') args = [args];
            b.transform.apply(b, args);
        });

        (data.plugin || []).forEach(function (args) {
            if (typeof args === 'string') args = [args];
            b.plugin.apply(b, args);
        });

        var dest = data.dest;
        grunt.file.mkdir(path.dirname(dest));

        var bundle = function(done) {
            var out = fs.createWriteStream(dest);
            b.bundle().pipe(out);
            out.on('close', function() {
                grunt.log.write('Wrote ' + dest + '\n');
                if (done !== undefined) done();
            });
        };
        b.on('update', function() { bundle(); });
        var done = this.async();
        bundle(done);
    });

    grunt.registerTask('wait', function() {
        grunt.log.write('Waiting for changes...\n');
        this.async();
    });

    grunt.loadNpmTasks('grunt-contrib-copy');

    grunt.registerTask('default', ['browserify', 'copy']);
    grunt.registerTask('watch', ['browserify:*:watch', 'wait']);
};
<|endoftext|>