문제

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.

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top