1

この Grunt ファイルを使用して、Jasmine 仕様をセットアップしました。

grunt ファイルは明らかに module.export 構文を使用していますが、jasmine タスクは phantom.js ヘッドレス ブラウザーで実行されます。したがって、ブラウザは module.export 構文を認識しません。

これを回避する方法がわからないだけですか??

module.exports = function (grunt) {
grunt.initConfig({
    jasmine: {
        src: '*.js',
        options: {
            specs: '*Spec.js',
            outfile: '_SpecRunner.html'
        }
    },
    jshint: {
        files: ['Gruntfile.js', '*.js'],
    },
    watch: {
        files: ['<%= jshint.files %>'],
        tasks: ['jshint']
    }
});

grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');

grunt.registerTask('default', ['jshint']);
grunt.registerTask('watch', ['watch']);
grunt.registerTask('test', ['jasmine']);

};

これは私のエラーです:

>> ReferenceError: Can't find variable: module at
>> Gruntfile.js:1
4

0 に答える 0