打字稿集合茉莉花视觉工作室2015 [英] typescript-collections jasmine visual studio 2015

查看:173
本文介绍了打字稿集合茉莉花视觉工作室2015的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在学习如何使用VS2015测试我的打字稿代码,使用resharper和Jasmine(v 2.4.1)并且它不是很顺利。我尝试使用 https://github.com/basarat/typescript-collections 中的typescript-collections 。

I am currently in the process of learning how to test my typescript code using VS2015, with resharper, and Jasmine (v 2.4.1) and it is not going very smooth. I trying to use typescript-collections from https://github.com/basarat/typescript-collections.

以下似乎工作正常:

describe("collection Tests",
  () => {

  it("collection should work",
     () => {

        expect("123").toBe("123");
  });
});

当我从VS2015执行测试时(使用resharper)然后它启动我的webbrowser并报告测试通过。

When i execute the test from VS2015 (using resharper) then it starts my webbrowser and reports that the test passed.

当我执行以下操作时:

import * as Collections from 'typescript-collections';

describe("collection Tests",
  () => {

  it("collection should work",
     () => {

        var collection = new Collections.Dictionary<string, string>();

        expect("123").toBe("123");
  });
});

我在浏览器中看到以下内容:未找到规格

i see the following in my browser: No specs found

有一些指示可以让它发挥作用。

Some pointers to get this to work would be really helpful.

推荐答案

我也遇到过这个。 Resharper支持能够为我提供一个起点,但不是一个完整的解决方案。

I encountered this too. Resharper support was able to provide me a starting point, but not a full solution.

Typescript将您的import语句转换为某种类型的模块格式(取决于您的Typescript配置) 。 Resharper测试运行器在不知道任何模块加载器的情况下执行测试。

Typescript transpiles your import statement into some type of module format (depending on your Typescript configuration). The Resharper test runner executes the tests with no knowledge of any module loader.

其他测试运行器有时会包含一种包含和配置模块加载器的方法,但是这个选项在Resharper似乎非常有限。他们的文档提供了有关如何配置测试工具文件的简要说明,但它依赖于Chutzpah兼容的模板占位符。这是一条高摩擦路径。甚至Chutzpah文档也提供了一个大胆的段落警告,说明这样做的危险。用于Javascipt测试的Resharper工具并不像其他VS语言那样成熟。尽管我更喜欢留在VS IDE并使用熟悉的工具,但我决定坚持使用更多本机JS工具进行测试。

Other test runners will sometimes include a way to include and configure a module loader, but this option in Resharper appears to be very limited. Their documentation provides a very brief description of how to configure a test harness file, but it relies on Chutzpah compliant template placeholders. This is a high friction path. Even Chutzpah documentation provides a bold paragraph warning of the perils of doing this. The Resharper tools for Javascipt testing aren’t nearly as mature as they are for other VS languages. As much as I prefer to stay in the VS IDE and use familiar tools, I’ve decided to stick with more native JS tools for testing.

这篇关于打字稿集合茉莉花视觉工作室2015的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆