2013-10-31 12 views
8

मैंने गड़बड़ी और चमेली का उपयोग करके कुछ परीक्षण स्थापित किए हैं, लेकिन जब मैं टर्मिनल में परीक्षणों को चलाने और चलाने का प्रयास करता हूं तो एक समस्या में भाग ले रहा हूं।ग्रंट जैस्मीन परीक्षण टर्मिनल में विफल रहता है लेकिन ब्राउजर नहीं

>> Error caught from phantom. More info can be found by opening the Spec Runner in a browser. 

जब मैं ब्राउज़र मुझे लगता है कि मेरे सभी परीक्षण पास और किसी भी प्रकार की कोई त्रुटि में कल्पना धावक फ़ाइल को चलाने के दिखाया गया है: मैं यह त्रुटि दिखाई देती।

क्या किसी को पता है कि इस मुद्दे का कारण क्या हो सकता है?

module.exports = function(grunt) { 

    grunt.initConfig({ 

pkg: grunt.file.readJSON('package.json'), 

/** 
* Uglify task to minify all javscript files 
* seperating out all script files into a development directory 
* and then having all 'production' scripts within a product directory 
* 
* Note: Will need a bit of work to target the plugins folder 
*  independently to the main apps - as we may have unminified 
*  versions - aswell as our Backbone views. 
*/ 
uglify: { 
    options: { 
    mangle: false 
    }, 
    files: { 
     src: 'assets/scripts/development/*.js', // source files mask 
     dest: 'assets/scripts/production/', // destination folder 
     expand: true, // allow dynamic building 
     flatten: true, // remove all unnecessary nesting 
     ext: '.min.js' // replace .js to .min.js 
    } 
}, 

/** 
* Sass module compiles all SASS files 
* This quickly avoids having to open and save 
* every single css file if a conflict is present 
*/ 
sass: { 
    dist: { 
    files: [{ 
     expand: true, 
     cwd: 'assets/styles/sass/', 
     src: ['*.scss'], 
     dest: 'assets/styles/', 
     ext: '.css' 
    }] 
    } 
}, 

/** 
* Image minification for compressing images 
* accross the project and moving them into their own folder 
* all references once production has gone through points to those 
*/ 
imagemin: { 
    png: { 
     options: { 
      optimizationLevel: 7 
     }, 
     files: [ 
      { 
       expand: true, 
       cwd: 'assets/images/', 
       src: ['**/*.png'], 
       dest: 'assets/images/compressed/', 
       ext: '.png' 
      } 
     ] 
    }, 
    jpg: { 
     options: { 
      progressive: true 
     }, 
     files: [ 
      { 
       expand: true, 
       cwd: 'assets/images/', 
       src: ['**/*.jpg'], 
       dest: 'assets/images/compressed/', 
       ext: '.jpg' 
      } 
     ] 
    } 
}, 

/** 
* PHP Code Standards fixer 
* Runs through the app (main code base for each project) 
* to ensure conforms to a standard 
*/ 
phpcsfixer: { 
    app: { 
     dir: 'app' 
    }, 
    options: { 
     bin: 'php-cs-fixer', 
     ignoreExitCode: true, 
     level: 'all', 
     quiet: false, 
     diff: true, 
     verbose: true 
    } 
}, 

jasmine : { 
    src : 'assets/scripts/views/*.js', 
    options : { 
    specs : 'assets/scripts/tests/*.js' 
     } 
    } 
    }); 

    grunt.loadNpmTasks('grunt-contrib-jasmine'); 
    grunt.loadNpmTasks('grunt-php-cs-fixer'); 
    grunt.loadNpmTasks('grunt-contrib-imagemin'); 
    grunt.loadNpmTasks('grunt-contrib-sass'); 
    // Load the plugin that provides the "uglify" task. 
    grunt.loadNpmTasks('grunt-contrib-uglify'); 

    // Default task(s). 
    grunt.registerTask('default', [ 'uglify', 'sass' ]); 

    //Jasmine unit tests 
    grunt.registerTask('test', [ 'jasmine' ]); 

}; 

किसी भी मदद के लिए धन्यवाद:

यहाँ मेरी Gruntfile है।

उत्तर

1

मैं एक ही मुद्दे में भाग गया। मेरे मामले में अपराधी चुनिंदा 2 लाइब्रेरी रहा है, लेकिन मुझे इसे समझने के लिए उन्मूलन की प्रक्रिया का उपयोग करना पड़ा।

_SpecRunner.html सीधे फंटोमज के माध्यम से सीधे ग्रंट के माध्यम से लोड करने का प्रयास करें। मैंने एक मूल रैपर स्क्रिप्ट का उपयोग किया जो अनिवार्य रूप से वही है जो आप फ़ैंटॉमजेएस होमपेज पर देखते हैं ताकि मैं रनर में स्क्रिप्ट टैग को एक-एक करके चिपका सकूं जब तक कि मेरे पास सिंटैक्स त्रुटि नहीं फेंकती।

यदि आप --force के साथ गड़बड़ी कार्य चलाते हैं तो आपको त्रुटि के स्रोत के बारे में कुछ और विवरण भी मिल सकते हैं।

मैं त्रुटि के मूल कारण को निर्धारित करने में सक्षम नहीं था।

+0

उत्तर के लिए धन्यवाद लेकिन कोशिश करने के घंटों के बाद मुझे अंत में यह काम मिल गया। कभी पता नहीं चला कि मैंने अभी तक स्क्रैच से क्या मुद्दा शुरू किया था। –

+0

क्या आप कृपया अपने संपादन यहां @ डेविड जोन्स पोस्ट कर सकते हैं, जो एक ही समस्या में चल रहे हैं। – smk

0

मेरे लिए, Gruntfile.js करने के लिए एक सहीhost विकल्प जोड़ने तय कंसोल परीक्षण (ब्राउज़र परीक्षण पहले से ही काम किया)।

jasmine: { 
    test: { 
     src: ['src/<%= pkg.name %>.js'], 
      options: { 
       specs: ['spec/*-spec.js'], 
       outfile: 'spec.html', 
       keepRunner: true, 
       host: 'http://example.com/folder-containing-to-spec-file/', 
       vendor: ['vendor/file.js'] 
      } 
     } 
    } 
} 

host विकल्प के बिना, ऐसा लग रहा था जैसे Phantomjs file:///users/path/to/local/files से सामग्री का अनुरोध किया गया था जो (जाहिर है) एक सर्वर एक ब्राउज़र (जब स्थानीय स्तर पर काम कर रहे) से सामग्री अनुरोध कर सकते हैं नहीं है।

संबंधित मुद्दे