s9tpepper / karma-cucumberjs

A Cucumber.js Karma test runner adapter.
MIT License
54 stars 21 forks source link

"Angular is not Defined" Error #24

Open JimLynchCodes opened 7 years ago

JimLynchCodes commented 7 years ago

I'm getting this error when running:

Chrome 52.0.2743 (Mac OS X 10.11.4) ERROR Uncaught ReferenceError: angular is not defined at /Users/jim/Git-Projects/Flexbox-Push-Drawer-Example/src/app/index.module.js:4

My karma.config file:

// Karma configuration
// Generated on Mon Aug 08 2016 16:30:26 GMT-0300 (BRT)

//npm install -g grunt-cli bower yo generator-karma generator-angular
//npm install -g karma-phantomjs-launcher karma
//npm install -g karma-phantomjs-launcher karma cucumber
//npm install karma-cucumberjs --save-dev

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

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['cucumberjs'],

    // list of files / patterns to load in the browser
    files: [
      'src/app/**/*.module.js',
      {pattern: 'ff/**/*.feature', watched: true, included: false, served: true},
      // {pattern: 'ff/**/*.js', watched: true, included: true, served: true},
      {pattern: 'src/**/*.js', watched: true, included: true, served: true}
    ],

    // list of files to exclude
    exclude: [
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress'],

    // web server port
    port: 9876,

    // enable / disable colors in the output (reporters and logs)
    colors: true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_DEBUG,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['Chrome'],
    //browsers: ['PhantomJS'],

    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false,

    // Concurrency level
    // how many browser should be started simultaneous
    concurrency: Infinity
  })
}

ff/ff.feature:

Feature: Adding

  Scenario: Add two numbers
    Given the input "2+2"
    When the calculator is run
    Then the output should be "4"

ff/ff.steps.js:

//var zombie = require('zombie');
addStepDefinitions(function (scenario) {
//module.exports = function () {
  scenario.Given(/^the input "([^"]*)"$/, function (arg1, callback) {
    // Write code here that turns the phrase above into concrete actions
    callback(null, 'pending');
  });

  scenario.When(/^the calculator is run$/, function (callback) {
    // Write code here that turns the phrase above into concrete actions
    callback(null, 'pending');
  });

  //this.Then(/^the output should be "([^"]*)"$/, function (arg1, callback) {
  // Write code here that turns the phrase above into concrete actions
  // callback(null, 'pending');
  //});
});