0

嘗試單元測試我的新的ionic2應用程序在添加地理位置測試用例後失敗。下面是一個最小的例子:https://github.com/geoHeil/ioni2GeolocationUnitTest離子單元測試地理位置失敗

錯誤可以通過運行npm test

TypeScript error: app/services/geo/geolocation.service.spec.ts(30,38): Error TS2339: Property 'Coordinates' does not exist on type 'typeof ".../node_modules/ionic-native/dist/plugins/geolocation"'. 

奇怪的是,即使我指定被複制:

import * as NativeGeo from 'ionic-native/dist/plugins/geolocation'; 

這種類型的定義似乎是用來

/Applications/IntelliJ\ IDEA\ 2016.2\ EAP.app/Contents/plugins/JavaScriptLanguage/typescriptCompiler/external/lib.d.ts 

編輯

我剛剛發現Geolocation unit test with JsTestDriver可能我固定它創建我自己的實現座標,等稍相關

回答

0

class MyCoordinates implements Coordinates { 
    latitude: number; 
    longitude: number; 
    accuracy: number; 
    altitude: number; 
    altitudeAccuracy: number; 
    heading: number; 
    speed: number; 
}