﻿module.exports = function (grunt) {
	grunt.initConfig({
        concat: {
            feature: {
                src: [],
                dest: 'out/feature.feature'
            },
			
			step_definitions: {
                src: ["features/support/*.js", "features/step_definitions/*.js"],
                dest: 'out/step_definitions.js'
            },

            app: {
				src: ["app/*.js"],
                dest: 'out/app.js'
            },

            vendor: {
				src: ["vendor/*.js", "bower_components/elasticsearch/elasticsearch.js", "../../bower_components/chai/chai.js"],
                dest: 'out/vendor.js'
            }
        }
    });

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

    grunt.registerTask('build', function (extensionPath) {
        if (extensionPath) {
            var extFeaturesPath = extensionPath + '*.Extensions/**/*.feature';
            var extStepDefinitionsPath = extensionPath + '*.Extensions/**/integrationTests/**/step_definitions/*.js';
            var extTestHelpersPath = extensionPath + '*.Extensions/**/integrationTests/*.js';

            var stepDefinitionsArray = grunt.config.get('concat.step_definitions.src');
            stepDefinitionsArray.push(extStepDefinitionsPath);

            var appArray = grunt.config.get('concat.app.src');
            appArray.push(extTestHelpersPath);

            grunt.config.set('concat.feature.src', [extFeaturesPath]);
            grunt.config.set('concat.step_definitions.src', stepDefinitionsArray);
            grunt.config.set('concat.app.src', appArray);
        }

         var tasks = [
            'concat'
         ];

        grunt.task.run(tasks);
    });
};
@@ -836,33 +836,39 @@
 onPath + '*.
-Extension
+IntegrationTest
 s/**/*.featu
@@ -928,39 +928,25 @@
 onPath + '*.
-Extensions/**/i
+I
 ntegrationTe
@@ -1036,23 +1036,9 @@
  '*.
-Extensions/**/i
+I
 nteg
@@ -1050,16 +1050,19 @@
 nTests/*
+*/*
 .js';%0A%0A 

fix Gruntfile.js in integrationTests