Search code examples
javascriptlinuxgruntjsjasminegrunt-contrib-jasmine

Reduce size of grunt with packages on linux. File paths too long for Jenkins


I just recently downloaded grunt with 2 packages on my linux machine.

  1. Grunt-contrib-jasmine for command line jasmine unit testing.

Guide I followed: https://github.com/gruntjs/grunt-contrib-jasmine

  1. Grunt-template-jasmine-Istanbul for code coverage.

Guide I followed: https://github.com/maenu/grunt-template-jasmine-istanbul

I found my whole grunt folder to be quite massive and I was wondering if there was any way to slim it down. I have in my top level node_modules folder the packages: grunt, grunt-contrib-jasmine and grunt-template-jasmine-Istanbul. I've tried deleting files I thought were redundant but it seems that most libraries are needed even if repeated.

I'll post my GruntFile encase it will be of any help:

module.exports = function(grunt) {
  grunt.initConfig({
      jasmine: {
      coverage: {
          src: 'src/*.js',
          options: {
          specs: 'spec/*Spec.js',
          helpers: 'spec/*Helper.js',
          vendor: ['lib/jquery.js', 'lib/angular.js', 'lib/angular-touch.js', 'lib/angular-route.js', 'lib/angular-cookies.js', 
               'lib/ui-bootstrap.js', 'lib/jasmine-jquery.js', 'lib/angular-mocks.js'],

          template: require('grunt-template-jasmine-istanbul'),
          templateOptions: {
              coverage: 'coverage/coverage.json',
              report: {
              type: 'cobertura',
              options: {
                  dir: 'coverage/cobertura'
              }
              },
              thresholds: {
              lines: 50,
              statements: 50,
              branches: 50,
              functions: 50
              }
          }
          }
      }
      }
  });

  // Register tasks.
  grunt.loadNpmTasks('grunt-contrib-jasmine');

  // Default task.
  grunt.registerTask('default', 'jasmine');
};

Any help is appreciated.

EDIT: File path too long because of recurring node_modules doesn't allow jenkins to build.


Solution

  • The way that I solved this is by using npmd's --greedy flag instead of npm when installing packages.

    Npmd: https://github.com/dominictarr/npmd