Questions tagged [gulp-karma]

Karma integration into Gulp.js-based build.

gulp-karma is a gulp plugin that can start Karma test runner.

Example of usage:

var gulp = require('gulp');
var karma = require('gulp-karma');

var testFiles = [
  'client/todo.js',
  'client/todo.util.js',
  'client/todo.App.js',
  'test/client/*.js'
];

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

  // Be sure to return the stream 
  return gulp.src(testFiles)
    .pipe(karma({
      configFile: 'karma.conf.js',
      action: 'run'
    }))
    .on('error', function(err) {

      // Make sure failed tests cause gulp to exit non-zero 
      throw err;
    });
});

gulp.task('default', function() {
  gulp.src(testFiles)
    .pipe(karma({
      configFile: 'karma.conf.js',
      action: 'watch'
    }));
});
74 questions
0
votes
1 answer

How to lint specific function call in JavaScript?

My team has had the occasional problem of developers pushing Karma/Protractor tests containing the .only() function call, which of course makes our Jenkins etc only run that particular test, potentially allowing bugs to slip by. As such I thought…
Tickolas
  • 113
  • 2
  • 15
0
votes
1 answer

Why do I get UNMET PEER DEPENDENCY when I install karma and gulp-karma?

Following this tutorial I would like to use karma for testing. When I install karma and gulp-karma I get the error message below. It says karma@1.3.0 is not installed which is needed for gulp-karma. When I install karma it says the same. Now, I…
AndrasCsanyi
  • 3,111
  • 7
  • 37
  • 65
0
votes
1 answer

Unit testing form templates with directives returns "Error: [$injector:unpr] Unknown provider:"

I'm creating a unit test form my form validation. In my main form template controller, I am mocking the injected service. And the form template also contains a directive that injects the same service. I am using html2js to load my html…
Nikko Reyes
  • 3,132
  • 2
  • 17
  • 35
0
votes
1 answer

Angular test with karma

I have used the yo angular 1 generator and it created a landing page and some tests. I am not able to compile the code in VS because "module('fountainFooter');" is undefined. /// import * as angular…
Martin Andersen
  • 1,888
  • 25
  • 46
0
votes
1 answer

Karamajs only running one file

I'm trying to test my client-side scripts using a gulp task in Karmajs with the browserify and mocha extensions, but only one test file is being run. Here is my gulp task let Server = require('karma').Server; gulp.task('client-test', function (done)…
mikeyGlitz
  • 423
  • 3
  • 12
0
votes
2 answers

How to run nodemon and different gulp tasks in a docker container

I've been trying to move my node.js dev environment to a docker container. There's just one concern I have right now. I'm currently running gulp to watch changes in my files and do a rebuild, nodemon for restarting the node server on file changes…
Timur Ridjanovic
  • 776
  • 1
  • 9
  • 17
0
votes
2 answers

Karma issue Javascript import SyntaxError

I am trying to run this spec and I got this error: SyntaxError: import declarations may only appear at top level of a module But as you see I have the import on top, so there's could be another reason for this? ng-form-builder.spec.js import angular…
victor sosa
  • 879
  • 13
  • 26
0
votes
2 answers

How to replace deprecated gulp-karma with new version of karma?

Currently I am using gulp-karma for unit-testing in JS, but the current version is deprecated. How can I replace this code so I can use the new version recommended? Old version: var karma = require('gulp-karma'); var testFiles = [ …
0
votes
1 answer

Karma TypeScript PreProcessor throws Error Cannot find module 'angular'

Here is my Karma Config module.exports = function(config) { config.set({ frameworks: ['jasmine', 'traceur'], files: [ 'app/**/**/httpMock/httpMock.interceptor.ts', 'app/**/**/httpMock/httpMock.module.ts', …
Aj1
  • 863
  • 2
  • 12
  • 33
0
votes
1 answer

How to bundle tests and start karma from watch task

Whenever the appropriate files change I would like to bundle my tests and start karma, showing any failed tests. I currently have the watch task: gulp.task('default', ['browserify', 'css','runTests'], function () { …
Bomber
  • 7,195
  • 16
  • 66
  • 121
0
votes
1 answer

jspm + KarmaJS - exclude files from watch but not from serve

I can't figure out how to make karma to not watch for changes in folder jspm_packages/. If I try to add 'jspm_packages' into exclude section then I get following errors: DEBUG [web-server]: serving (cached):…
0
votes
2 answers

toEqualData matcher breaks tests in AngularJS app

I have the following very simple test written for an AngularJS application's services: describe('Services', function () { beforeEach(function(){ this.addMatchers({ toEqualData: function(expected) { return…
Matthew Daly
  • 8,369
  • 2
  • 36
  • 74
0
votes
1 answer

Get Contents of External Text File In Karma-Jasmine Test

I've been at this for the whole day and have made virtually no headway. I have an Javascript interpreter which takes text code and I am trying to test this using Karma-Jasmine tests. Because I don't want to embed code in every single spec, I am…
0
votes
1 answer

Travis CI: Cannot find module 'immutable'

Here's the build with the error. I've tried changing the Travis CI configuration. I have found similar questions that ended up being case sensitivity. In these questions, the direct dependency couldn't be found. I am not directly depending on…
David Leston
  • 148
  • 7
1 2 3 4
5