angularjs - when running unit test with gulp PhantomJS fails to connect -
getting error when running gulp test unit testing. i've looked around solutions none have solved issue far. here's test returns after run test.
and here karma.conf.js file
'use strict'; var path = require('path'); var conf = require('./gulp/conf'); var _ = require('lodash'); var wiredep = require('wiredep'); function listfiles() { var wiredepoptions = _.extend({}, conf.wiredep, { dependencies: true, devdependencies: true }); return wiredep(wiredepoptions).js .concat([ path.join(conf.paths.src, '/scripts/*.js'), path.join(conf.paths.src, '/app/**/*.module.js'), path.join(conf.paths.src, '/app/**/*.js'), path.join(conf.paths.src, '/**/*.spec.js'), path.join(conf.paths.src, '/**/*.mock.js'), path.join(conf.paths.src, '/**/*.html') ]); } module.exports = function(config) { var configuration = { files: listfiles(), singlerun: true, autowatch: false, frameworks: ['jasmine', 'angular-filesort'], angularfilesort: { whitelist: [path.join(conf.paths.src, '/**/!(*.html|*.spec|*.mock).js')] }, nghtml2jspreprocessor: { stripprefix: 'src/', modulename: 'angular' }, //browsers : ['chrome', 'phantomjs', 'firefox'], browsers: ['phantomjs'], plugins : [ //'karma-chrome-launcher', 'karma-phantomjs-launcher', //'karma-firefox-launcher', 'karma-angular-filesort', 'karma-jasmine', 'karma-ng-html2js-preprocessor', 'karma-coverage' ], preprocessors: { 'src/**/*.html': ['ng-html2js'], 'src/**/!(*.spec|*.mock).js': ['coverage'] }, reporters: ['progress', 'coverage'], // optionally, configure reporter coveragereporter: { type : 'html', dir : 'coverage/' } }; // block needed execute chrome on travis // if ever plan use chrome , travis, can keep // if not, can safely remove // https://github.com/karma-runner/karma/issues/1144#issuecomment-53633076 if(configuration.browsers[0] === 'chrome' && process.env.travis) { configuration.customlaunchers = { 'chrome-travis-ci': { base: 'chrome', flags: ['--no-sandbox'] } }; configuration.browsers = ['chrome-travis-ci']; } config.set(configuration); }; thanks guys :d

Comments
Post a Comment