Skip to content
This repository was archived by the owner on Jul 6, 2019. It is now read-only.
This repository was archived by the owner on Jul 6, 2019. It is now read-only.

How to move tests into different area? #40

Description

@samlevin

I love the angularjs-requirejs seed, and have used it several times for a number of projects. For my current project, I'm required to move the tests OUT of the main code-base. I've tried a number of ways to add tests to a separate area, but then I get errors like this:

ERROR [karma]: Uncaught Error: Mismatched anonymous define() module: function (app) {
        describe('app.version module', function() {
                beforeEach(module('app.version'));

                describe('app-version directive', function() {
                        it('should print current version', function() {
                                module(function($provide) {
                                        $provide.value('version', 'TEST_VER');
                                });
                                inject(function($compile, $rootScope) {
                                        var element = $compile('<span app-version></span>')($rootScope);
                                        expect(element.text()).toEqual('TEST_VER');
                               });
                        });
                });
        });
}
http://requirejs.org/docs/errors.html#mismatch
at http://localhost:9876/absoluteC:/Users/zzz/zzz/node_modules/requirejs/require.js?3d820c829606b74b8680ffd0416fdb96d16ec957:141

I know that the project/test environment is correct, because when I move the tests back to their native folders, everything works okay. Here's a sample karma.conf (relevant parts):

    basePath : './public',

    files : [
        {pattern: 'libs/angular/angular.js', included: false},
        {pattern: 'libs/angular-mocks/angular-mocks.js', included: false},
        {pattern: 'libs/angular-translate/angular-translate.min.js', included: false},
        {pattern: 'libs/angular-bootstrap/ui-bootstrap.min.js', included: false},
        {pattern: 'libs/angular-ui-router/release/angular-ui-router.js', included: false},
        {pattern: 'libs/requirejs-text/text.js', included: false},
        {pattern: 'app/shared/version/*.js', included: false},
        {pattern: 'app/service/*.js', included: false},
        {pattern: 'app/model/*.js', included: false},
        {pattern: 'app.js', included: false},
        {pattern: 'test/*.js', included: true},
        'require-config.js'
    ],

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions