Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用Resharper运行jasmine测试时设置特定端口?_Javascript_Unit Testing_Requirejs_Resharper_Jasmine - Fatal编程技术网

Javascript 使用Resharper运行jasmine测试时设置特定端口?

Javascript 使用Resharper运行jasmine测试时设置特定端口?,javascript,unit-testing,requirejs,resharper,jasmine,Javascript,Unit Testing,Requirejs,Resharper,Jasmine,在浏览器或幻影中使用resharper运行jasmine测试时,我注意到它以一个随机端口(localhost:2341)开始,是否可以告诉resharper我们希望在特定端口中运行测试 我之所以喜欢这样做,是因为我的应用程序运行在一个特定的端口上,我不能在测试中要求一个视图,因为它是一个跨域请求,requirejs/text不允许我这样做 谢谢:)遗憾的是,它根本无法配置。我建议在这里添加一个功能请求:因此,没有办法在特定端口中运行测试,我解决这个问题的方法是通过将其放在application

在浏览器或幻影中使用resharper运行jasmine测试时,我注意到它以一个随机端口(localhost:2341)开始,是否可以告诉resharper我们希望在特定端口中运行测试

我之所以喜欢这样做,是因为我的应用程序运行在一个特定的端口上,我不能在测试中要求一个视图,因为它是一个跨域请求,requirejs/text不允许我这样做


谢谢:)

遗憾的是,它根本无法配置。我建议在这里添加一个功能请求:

因此,没有办法在特定端口中运行测试,我解决这个问题的方法是通过将其放在application web.config上来启用跨域请求

<system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="Access-Control-Allow-Origin" value="*" />
        <add name="Access-Control-Allow-Headers" value="Content-Type" />
      </customHeaders>
    </httpProtocol>
</system.webServer>

一些配置代码/日志输出会很好。
 it("should load the view", function () {
        var viewLoaded;
        var viewSuccessfullyLoaded;

    $('body').load('http://localhost:8080/app/views/view.html', function(response, status) {
        if (status == "error")
            viewSuccessfullyLoaded = false;
        if (status == "success")
            viewSuccessfullyLoaded = true;
        viewLoaded = true;
    });
    //wait for the view to be loaded before evaluating the expectation
    waitsFor(function() {
        return viewLoaded;
    }, "loading view", 500);

    runs(function() {
        expect(viewSuccessfullyLoaded).toBeTruthy();
    });
});