2017-09-29 17 views
1

如何從茉莉花進口createSpyObj財產?如何從茉莉花中爲「手稿」中的測試導入「createSpyObj」?

我已經通過npm安裝@types/jasminejasmine-core

我已經試過進口茉莉爲:

import jasmine from 'jasmine; 
import { createSpyObj } from 'jasmine'; //triggers import error in IDE 
import * as jasmine from 'jasmine'; //triggers import error in IDE 

這些都不能讓我訪問createSpyObj沒有在我的WebStorm IDE拋出一個錯誤。

IDE error showing it cannot find 'createSpyObj' method on jasmine

更多信息:

我看到在分型文件createSpyObj命名空間聲明。它嵌套在jasmine名稱空間中。這與expect,it不同,它們是全局聲明,但我不能用jasmine.createSpyObj訪問它嗎?

jasmine typings file

相關,而不是重複的

How to import 'describe', 'expect' and 'it' into a typescript tests for IDE to not to highlight them

Unit testing using Jasmine and TypeScript

回答

0

茉莉用途需要的語法,所以你必須得。

import createSpyObj = jasmine.createSpyObj;