Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test task is failed: you need to implement some adapter that implements __karma__.start method #37

Open
sivakishorejvv opened this issue Jun 28, 2016 · 2 comments

Comments

@sivakishorejvv
Copy link

Please find the attached file for the detailed stack trace and I am also attached my gulpfile.js and gulp.config.js. Could you please help me to resolve this issue.

javascriptbuildautomation_pluralsight_testtaskfail

Gulp_GulpConfigJsFiles.zip

@cjp666
Copy link

cjp666 commented Jul 18, 2016

I had the same problem and rather than spend too long looking it to it I just used the same versions of plug-ins as John. I know this doesn't solve the problem; I just wanted to complete the course and then come back to this at a later point

  "devDependencies": {
    "browser-sync": "^2.13.0",
    "chai": "^1.10.0",
    "del": "^2.2.1",
    "gulp": "^3.8.10",
    "gulp-angular-templatecache": "^1.5.0",
    "gulp-autoprefixer": "^2.0.0",
    "gulp-bump": "^0.1.11",
    "gulp-csso": "^0.2.9",
    "gulp-filter": "^2.0.0",
    "gulp-if": "^1.2.5",
    "gulp-imagemin": "^2.1.0",
    "gulp-inject": "^1.1.1",
    "gulp-jscs": "^4.0.0",
    "gulp-jshint": "^2.0.1",
    "gulp-less": "^3.1.0",
    "gulp-load-plugins": "^1.2.4",
    "gulp-minify-html": "^1.0.6",
    "gulp-ng-annotate": "^2.0.0",
    "gulp-nodemon": "^1.0.4",
    "gulp-plumber": "^0.6.6",
    "gulp-print": "^1.1.0",
    "gulp-rev": "^2.0.1",
    "gulp-rev-replace": "^0.3.1",
    "gulp-task-listing": "^1.0.0",
    "gulp-uglify": "^1.0.2",
    "gulp-useref": "^1.1.0",
    "gulp-util": "^3.0.1",
    "jshint": "^2.9.2",
    "jshint-stylish": "^2.2.0",
    "karma": "^0.12.31",
    "karma-chai": "^0.1.0",
    "karma-chai-sinon": "^0.1.4",
    "karma-chrome-launcher": "^0.1.7",
    "karma-coverage": "^0.2.7",
    "karma-growl-reporter": "^0.1.1",
    "karma-mocha": "^0.1.10",
    "karma-phantomjs-launcher": "^0.1.4",
    "karma-sinon": "^1.0.4",
    "lodash": "^2.4.1",
    "mocha": "^2.1.0",
    "mocha-clean": "^0.4.0",
    "node-notifier": "^4.0.3",
    "phantomjs": "^1.9.13",
    "sinon": "^1.12.2",
    "sinon-chai": "^2.6.0",
    "wiredep": "^4.0.0",
    "yargs": "^4.8.0"
  }

@zakhttp
Copy link

zakhttp commented Jan 27, 2017

First of all i see that you are using version above 0.13. So lets fix the start method that was deprecated in 0.13.

var Server = require('karma').Server;
var server = new Server({
        configFile: __dirname + '/karma.conf.js',
        exclude: excludeFiles,
        singleRun: !!singleRun
    }, karmaCompleted);

Now let's fix the second error, We can see that we have two problems:

  1. Gulp complaining about a format error due to the arguments passed to the callback function done.

  2. karma keeps running even after the test are done.

here the code of functionCompleted by @johnpapa:

function karmaCompleted(karmaResult) {
        log('Karma completed!');
        if (karmaResult === 1) {
            done('karma: tests failed with code ', karmaResult);
        } else {
            done();
        }
    }

And below is the quick fix, i created a variable status that with display either 'ERROR' or 'SUCCESS' depending on karma's exitCode that will be passed by karma to our karmaCompleted function in the form of karmaResult variable, then stripped the arguments passed to done() and lastly added the process.exit(karmaResult) in order to end karma once the tests finish.

 function karmaCompleted(karmaResult) {
        var status = karmaResult === 1 ? 'ERROR' : 'SUCCESS';
        log('Karma completed with: ' + status);
        log('Exit Code: ' + karmaResult);
        done(); // stripped the arguments that gulp complains about
        process.exit(karmaResult); // tell karma to exit once tests are done

    }

And voila, i hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants