NativeScript / NativeScript/nativescript-cli

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

Aberta
#3,303 1 comentário 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

to-be-checked unit testing
Linguagem predominante
JavaScript
Estrelas
1.1k
Forks
204
Merge médio
1d 9h
PRs com merge (30d)
8

Descrição

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) {
    }
}

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Comece reproduzindo a falha de teste do tns relatada usando as versões listadas para CLI, módulos e runtimes. Leia error.service.test.ts e error.service.ts, com foco na injeção de testing do Angular em beforeEach(). A tarefa estará concluída quando o teste do serviço for executado tanto no iOS quanto no Android sem o ReferenceError relacionado a Zone.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
angular, javascript
Domínio
cli, mobile, testing
Tipo de issue
Bug
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Precisa de esclarecimento
Facilidade para iniciantes
25/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.