Resharper reorders my path references in javascript tests

时间:2016-04-18 10:43:56

标签: javascript visual-studio testing resharper

I'm just starting to use Jasmine in Visual Studio with R#. To make it work I have to add these lines to the top of the spec file:

///<reference path="../jasmine/jasmine.js"/>
///<reference path="../jasmine/jasmine-html.js"/>
///<reference path="../jasmine/boot.js"/>

However, when I run the test, the file opened in the browser contains the references in the header in another order (and strange indentation):

    <script type="text/javascript" src="referenceFile?path=~/Project/Scripts/jasmine/jasmine-html.js"></script>
<script type="text/javascript" src="referenceFile?path=~/Project/Scripts/jasmine/boot.js"></script>
    <script type="text/javascript" src="referenceFile?path=~/Project/Scripts/jasmine/jasmine.js"></script>

The problem is that boot.js needs to come last, otherwise it doesn't work. Is it possible to fix this? Maybe there is a workaround if this is just R# behaviour.

1 个答案:

答案 0 :(得分:1)

  1. ReSharperRunner.html文件添加到项目中;
  2. 点击Copy default implementation to clipboard此处ReSharper | Options | Tools | Unit Testing | JavaScript Tests | Custom HTML harness并将代码粘贴到那里;
  3. 在此处指定此类文件ReSharper | Options | Tools | Unit Testing | JavaScript Tests | Enable custom HTML harness | Test harness file name
  4. Test harness location组合框。
  5. 中指定文件位置