0x-r4bbit / gulp-karma

Karma plugin for gulp
MIT License
1 stars 2 forks source link

Fork Karma Core Instead? #6

Open ajoslin opened 10 years ago

ajoslin commented 10 years ago

Hey guys! Just stumbled on gulp myself and am using it one of my projects :-)

It seems like we should just fork karma and add streams support to it?

douglasduteil commented 10 years ago

@ajoslin What do you mean by adding streams support to it ? You just want to defer the result like jshint is doing or do some kind of mocha stuff ? What do you want to end up with ?

I personally would like to end up with something like :

gulp.src('test/*.js')
.pipe(karma('test/karma.conf.js'))
.pipe(karma.swallowGulp())
.pipe(karma.wrapFiles(['withjQuery.js','src/*.js'], []))
.pipe(karma.run())
.pipe(karma.reporte())

gulp.src('test/*.js')
.pipe(karma('test/karma.conf.js'))
.pipe(karma.swallowGulp())
.pipe(karma.wrapFiles(['withoutjQuery.js','src/*.js'], []))
.pipe(karma.run())
.pipe(karma.reporte())
pkozlowski-opensource commented 10 years ago

@ajoslin @douglasduteil @PascalPrecht looks like I'm starting to migrate to gulp as well and looking around for a nice karma integration. What did you guys ended up doing?

0x-r4bbit commented 10 years ago

Oh wow, I'm actually totally out on this one :D Maybe I should kill this repo to prevent further confusion?

pkozlowski-opensource commented 10 years ago

@PascalPrecht I think that killing this repo is not a bad idea if you don't want to push it further. For now I'm just shopping for ideas.

douglasduteil commented 10 years ago

I'm still using my stuff, the existing gulp-karma don't suit me. What do you think about it ?

pkozlowski-opensource commented 10 years ago

@douglasduteil if you are talking about this one: https://www.npmjs.org/package/gulp-karma I don't think it is a way to go, I mean, I don't see any point in using gulp's src() here , since karma is taking care of watching / reading files. In short - I don't think that the mentioned plugin is taking a good direction.

What I would expect to have is something very simple like:

karma(options).server();

or something

douglasduteil commented 10 years ago

Yep I'm so agree. Here is my first pock https://github.com/douglasduteil/ui-slider/blob/refacto-gulp-builded/Gulpfile.js What you think ? Le 18 mars 2014 20:08, "Pawel Kozlowski" notifications@github.com a écrit :

@douglasduteil https://github.com/douglasduteil if you are talking about this one: https://www.npmjs.org/package/gulp-karma I don't think it is a way to go, I mean, I don't see any point in using gulp's src() here , since karma is taking care of watching / reading files. In short - I don't think that the mentioned plugin is taking a good direction.

What I would expect to have is something very simple like:

karma(options).server();

or something

Reply to this email directly or view it on GitHubhttps://github.com/PascalPrecht/gulp-karma/issues/6#issuecomment-37974886 .

douglasduteil commented 10 years ago

@pascalprecht I really want to push forward a alternative for karma in gulp. So I'll keep the fork :P

So @pkozlowski-opensource if you need something. I can help ^^

pkozlowski-opensource commented 10 years ago

@douglasduteil I'm currently working on a project where I need clean integration, so let me think about my "ideal" API for a day or two and I will comment back here. Basically I want to keep all the config in one place (gulp file) but other that this I don't think a wrapper should be doing much more.

I've also started a thread on karma-users mailing list.

@PascalPrecht sorry for hijacking your repo for this discussion :)

0x-r4bbit commented 10 years ago

I'm very happy with this guys.

pkozlowski-opensource commented 10 years ago

@douglasduteil @PascalPrecht so I've been digging into this topic and what I've ended up doing is simply using Karma's public API (http://karma-runner.github.io/0.12/dev/public-api.html) directly from a gulp task:

var karma = require('karma').server;

gulp.task('test', function () {

  karma.start({
    browsers: ['Chrome'],
    files: ['exercises/**/*.js'],
    frameworks: ['jasmine'],
    singleRun: true
  }, function (exitCode) {
    gutil.log('Karma has exited with ' + exitCode);
    process.exit(exitCode);
  });

});

For now I don't see much point in writing any plugin for Karma, given how easy is to run tests from gulp. I could write a npm module to bundle all the common karma dependencies I'm using, but it would be specific to my usage patters.

In short: thnx for the public API, I'm happy with what I've got now :-)