lundi 28 mars 2016

Running Jasmine tests on MeteorJS with Karma test runner

I am trying to run some Jasmine unit tests on MeteorJS with Karma as the test runner. I know Velocity is the preferred test runner for Meteor, but due to other reasons I am trying other test runners.

In my karma.conf.js file, I have to list my dependencies for the tests to run. Unlike some other frameworks which use npm (or Bower) to install the necessary packages in a node_modules folder, MeteorJS does not appear to store the packages anywhere locally (correct me if I am wrong). It does not even need NPM to be installed. Hence I cannot refer to them in my configuration file. When trying to run the tests, I am understandably getting a ReferenceError for Template, which is contained in the source file.

My file is given below:

module.exports = function(config) {
  config.set({

    // the base path for including files and packages to run the tests
    basePath: './',

    // test frameworks to use
    frameworks: ['jasmine'],

    // files to include for the tests (relative to basePath if the path is relative), and the test files themselves
    files: [

      // source file
      '../departments/client/src/dept.js',

      // file with tests to be executed
      'jasmine/client/unit/dept/dept.js'
    ],
    ...

I need to set the paths of the Meteor dependencies in the conf file for Karma to be able to load the Meteor files. Does anyone know how I can do this?

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire