NativeScript / NativeScript/nativescript-cli
tns test fails with error "ReferenceError: Can't find variable: Zone"
未關閉
還沒有人認領這個 Issue。
to-be-checked
unit testing
- 主要語言
- JavaScript
- 星號
- 1.1k
- 分支
- 204
- 平均合併
- 1 天 9 小時
- 30 天內合併 PR
- 8
描述
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 --versionto fetch it)
3.4.0 -
Cross-platform modules: (check the 'version' attribute in the
node_modules/tns-core-modules/package.jsonfile in your project)
3.3.0 -
Runtime(s): (look for the
"tns-android"and"tns-ios"properties in the
package.jsonfile 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) {
}
}
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先,使用為 CLI、模組和執行環境列出的版本,重現回報的 tns 測試失敗。閱讀 error.service.test.ts 和 error.service.ts,重點關注 beforeEach() 中的 Angular 測試注入。完成的標準是服務測試在 iOS 和 Android 上都能執行,且不會出現關於 Zone 的 ReferenceError。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- angular, javascript
- 領域
- cli, mobile, testing
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 25/100