2017-09-29 18 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;