NativeScript / NativeScript/nativescript-cli

tns test fails with error "ReferenceError: Can't find variable: Zone"

Aperta
#3,303 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

to-be-checked unit testing
Lingua principale
JavaScript
Stelle
1.1k
Fork
204
Merge medio
1g 9h
PR unite (30g)
8

Descrizione

Tell us about the problem

Please, ensure your title is less than 63 characters long and starts with a capital
letter.

Which platform(s) does your issue occur on?

iOS, Android

Please provide the following version numbers that your issue occurs with:
  • CLI: (run tns --version to fetch it)
    3.4.0

  • Cross-platform modules: (check the 'version' attribute in the
    node_modules/tns-core-modules/package.json file in your project)
    3.3.0

  • Runtime(s): (look for the "tns-android" and "tns-ios" properties in the
    package.json file of your project)
    3.0.0

Please tell us how to recreate the issue in as much detail as possible.
  • Build a service that requires injection of TranslateService (from ng-translate)
  • Inject that service in beforeEach() of a test suite.
Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

error.service.test.ts

'use strict';

import {ErrorService} from '../services/error.service';
import {inject} from "@angular/core/testing";

declare let assert: Chai.AssertStatic;

describe("ErrorService tests", () => {

    let service = null;

    beforeEach((done) => {
        inject([ErrorService], (injectService: ErrorService) => {
            service = injectService;
            done();
        });
    });

    it("Service exists", (done) => {
        assert.exists(service);
        done();
    });

});

error.service.ts

import { Injectable } from "@angular/core";
import { TranslateService } from "ng2-translate";

@Injectable()
export class ErrorService {

    constructor(private i18n: TranslateService) {
    }
}

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il test tns che fallisce, come segnalato, usando le versioni elencate per CLI, moduli e runtime. Leggi error.service.test.ts e error.service.ts, concentrandoti sull’iniezione del testing di Angular in beforeEach(). Il lavoro è completato quando il test del servizio viene eseguito sia su iOS sia su Android senza il ReferenceError relativo a Zone.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, javascript
Ambito
cli, mobile, testing
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.