我不知道如何在流星中进行测试驱动开发.
我在文档或常见问题解答中没有提到它.我没有看到任何例子或类似的东西.
我看到有些软件包正在使用Tinytest.
我需要开发人员的回应,这是什么路线图.有点像:
在我开发的过程中,我希望在运行测试时看到sinatra app异常,cosider示例:
require 'sinatra/base'
class ExceptionWeb < Sinatra::Base
enable :raise_errors
enable :dump_errors
configure do
enable :dump_errors
end
get "/" do
raise "hell"
"ok"
end
def self.bad_method
raise "bad method"
end
end
require 'rack/test'
describe 'The Web interface' do
include Rack::Test::Methods
def app
ExceptionWeb
end
it "should error out" do
get "/"
#puts last_response.errors
#ExceptionWeb.bad_method
#last_response.should be_ok
end
end
Run Code Online (Sandbox Code Playgroud)
下面的rspec代码显示没有异常,如果我取消注释last_response,那么我看到有些错误,但我看不出有什么问题.
但是电话mad_method显示我异常.
并且添加puts last_response.errors到每个测试看起来都不合适.
我尝试了sinatra配置选项raise_errors,dump_errors但这对我没什么帮助.
有任何想法吗?
我需要为我的 webpack 开发服务器路径设置标头,但是正如您所看到的此配置,我必须为我想要指定的每个 url 复制代理配置,有什么方法可以干燥此配置吗?
devServer: {
port: 3120,
host: "10.0.0.46",
publicPath: "http://10.0.0.46:3102/dist/js/",
hot: true,
compress: true,
contentBase: path.join(__dirname, "public"),
proxy: {
"/customer/x": {
target: "http://localhost:3100",
secure: false,
onProxyReq: function (proxyReq, req, res) {
proxyReq.setHeader('X-Forwarded-User', 'user');
}
},
"/cluster/**": {
target: "http://localhost:3100",
secure: false,
onProxyReq: function (proxyReq, req, res) {
proxyReq.setHeader('X-Forwarded-User', 'user');
}
},
"/server/**": {
target: "http://localhost:3100",
secure: false,
onProxyReq: function (proxyReq, req, res) {
proxyReq.setHeader('X-Forwarded-User', 'user');
}
},
"/data": {
target: "http://localhost:3100",
secure: false,
onProxyReq: function (proxyReq, req, …Run Code Online (Sandbox Code Playgroud)