Skip to content

Not able to configure a module from TestBed.configureTestingModule #479

Open
@tsonevn

Description

@tsonevn

From @ignaciolarranaga on September 28, 2016 21:3

Please, provide the details below:

Tell us about the problem

I can not configure a testing module, on the start of the tests it throws:

NativeScript / 9.1 (9.1; iPhone)  ../../tests/shared/services/user.service.spec.js at line 0 FAILED
    ReferenceError: Can't find variable: Zone
NativeScript / 9.1 (9.1; iPhone): Executed 1 of 0 (1 FAILED) ERROR (0.033 secs / 0 secs)

Which platform(s) does your issue occur on?

iOS

Please provide the following version numbers that your issue occurs with:

  • CLI: 2.3.0
  • Cross-platform modules:
    tns-core-modules: 2.3.0
  • Runtime(s): ios 2.3.0

Please tell us how to recreate the issue in as much detail as possible.

Just try to configure a test module

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

import { TestBed } from "@angular/core/testing";
import { NativeScriptModule } from "nativescript-angular/platform";
import { NativeScriptFormsModule } from "nativescript-angular/forms"
import { NativeScriptHttpModule } from "nativescript-angular/http";
import { UserService } from "../../../shared/services";
import { IdentifiedHttp } from "../../../shared/util";

describe("UserService tests", () => {
    beforeEach(() => {
        TestBed.configureTestingModule({
            imports: [
                NativeScriptModule,
                NativeScriptFormsModule,
                NativeScriptHttpModule,
            ],
            declarations: [ UserService ],
            providers: [ IdentifiedHttp ]
        });
    });
});

Copied from original issue: NativeScript/NativeScript#2814

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions