Note that there are some explanatory texts on larger screens.

plurals
  1. POTesting service in Angular returns module is not defined
    primarykey
    data
    text
    <p>I am trying to run the default service unit test in my project (Taken from the Angular Seed project on GitHub), but I keep getting the error "module is not defined".</p> <p>I have read that it could be something to do with the order of the <a href="https://github.com/vojtajina/testacular/issues/66" rel="noreferrer">referenced JavaScript files</a>, but I can't seem to get it to work, so hopefully one of you might be able to help.</p> <p>My configuration for the test looks like this:</p> <blockquote> <p>basePath = '../';</p> <p>files = [<br> 'public/javascripts/lib/jquery-1.8.2.js',<br> 'public/javascripts/lib/angular.js',<br> 'public/javascripts/lib/angular-<em>.js',<br> 'public/app.js',<br> 'public/controllers/</em>.js',<br> 'public/directives.js',<br> 'public/filters.js',<br> 'public/services.js',<br> JASMINE,<br> JASMINE_ADAPTER,<br> 'public/javascripts/lib/angular-mocks.js',<br> 'test/unit/*.js' ];</p> <p>autoWatch = true;</p> <p>browsers = ['Chrome'];</p> <p>junitReporter = { outputFile: 'test_out/unit.xml', suite: 'unit' };</p> </blockquote> <p>The service looks like the following:</p> <pre><code>angular.module('myApp.services', []). value('version', '0.1'); </code></pre> <p>The test looks like this:</p> <pre><code>'use strict'; describe('service', function() { beforeEach(module('myApp.services')); describe('version', function() { it('should return current version', inject(function(version) { expect(version).toEqual('0.1'); })); }); }); </code></pre> <p>And the error when running the test through testacular is this:</p> <blockquote> <p>ReferenceError: module is not defined</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload