Skip to content

Calling require() or run() without a dependency on 'mocks' does not run test #70

@abrobston

Description

@abrobston

Using mocha, if I write a test like:

suite("main", function() {
    var Squire = requirejs('squirejs');
    var injector = new Squire();
    var myStub;
    setup("setup", function() {
        myStub = { someObjectDefinition: true };
        injector.mock("myModule/someDependency", myStub);
    }
    teardown("teardown", function() {
        injector.clean();
    }
    test("Some test", injector.run(["myModule"], function(myModule) {
        // Test something
        assert.isTrue(whatever);
    }));
});

...the test never runs. If I change injector.run(["myModule", function(myModule) { ... }) to injector.run(["myModule", "mocks"], function(myModule, mock) {...}, the test runs, even though I have no use for the mock parameter. The same issue seems to occur when using injector.require within the test function instead of using injector.run as the test function.

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