Domanda

I have to run tests against a JavaScript file using grunt framework.

Just needed any simple example to do this, the target file (/test/filename.js) has dependencies on one more file.

È stato utile?

Soluzione

Basically you have to make use of grunt-execute command.

Here is the explaination:https://www.npmjs.org/package/grunt-execute

In simple words , this is what you should do for your specific requirement:

module.exports = function(grunt) {

   grunt.initConfig({

    execute: {
        simple_target: {
            // execute javascript files in a node child_process
            src: ['filename.js']
        }

    }
})


grunt.loadNpmTasks('grunt-execute');
grunt.registerTask('default', ['execute']);

}

And also,

"grunt": "~0.4.4",
 "grunt-execute": "~0.1.5" 

should be present in package.json, then just do npm install

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top