简体   繁体   English

在打字稿项目之间添加参考,以在Visual Studio中进行单元测试

[英]Adding a reference between typescript projects for unit testing in visual studio

I have two typescript projects in which one is a unit test project. 我有两个打字稿项目,其中一个是单元测试项目。 I am using Mocha to run these unit test and I am using VS2015. 我正在使用Mocha来运行这些单元测试,并且正在使用VS2015。 I want to add a reference from my AuthenticationApiTS to AuthenticationApiTSTest project. 我想将我的AuthenticationApiTS的引用添加到AuthenticationApiTSTest项目。 I tried out many of the ways suggested, but nothing seems to work. 我尝试了许多建议的方法,但似乎没有任何效果。 Below is my project structure. 下面是我的项目结构。

This is my folder structure 这是我的文件夹结构

say in your package.json your project name is AuthenticationApiTS 在您的package.json说您的项目名称是AuthenticationApiTS

run npm link in AuthenticationApiTS folder AuthenticationApiTS文件夹中运行npm link

run npm link AuthenticationApiTS in AuthenticationApiTSTest folder. AuthenticationApiTSTest文件夹中运行npm link AuthenticationApiTS

then you can use AuthenticationApiTS like it's a npm installed pacakge. 那么您可以像使用npm已安装的pacakge一样使用AuthenticationApiTS

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM