![](/img/trans.png)
[英]Importing files for tests written on Mocha/Chai/TypeScript both in browser and Node.JS
[英]Importing Chai in Typescript
我正在嘗試在打字稿中使用 chai。
Chai 的 javascript 示例將其顯示為:
var should = require('chai').should();
我下載了類型定義:
tsd install chai
...引用了文件,嘗試導入
/// <reference path='../typings/chai/chai.d.ts' />
import should = require('chai').should();
我得到:
error TS1005: ';' expected
...知道如何做到這一點嗎?
import { should } from 'chai';
should();
import { expect } from 'chai';
import 'chai/register-should';
使用expect
和should
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.