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

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 00:39:31

问题


Wrote some tests and everything successfully runs, but my IDE (webstorm) highlights describe, expect and it and says "cannot find name". I want to keep everythig clean and get rid of these, but have no idea how.

We use protractor and jasmine.

Some more of the script:

import {HomePO} from './pageobjects/home'
import {browser } from 'protractor'


describe('Smoke test', function() {

    it('should initialize', function() {
        let width = 320;
        let height = 568;
        browser.driver.manage().window().setSize(width, height);
    });

    it('should open homepage', function() {
        HomePO.get();
        expect(HomePO.isCurrentPage()).toBe(true);
    });
});

回答1:


I was having the same problem and did:

 npm install @types/jasmine --save-dev

and that solved it - no need to import anything from jasmine.



来源:https://stackoverflow.com/questions/41143700/how-to-import-describe-expect-and-it-into-a-typescript-tests-for-ide-to-n

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!