From 452d541b74e0fdf8f77d15b0fc4e2d79addae480 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Thu, 24 Oct 2019 15:10:18 +0200 Subject: [PATCH] DEV: Add env variable to allow easier debugging of smoke tests Set `DEBUG_NODE=1` when running `rake smoke:test` and use your favorite tool to debug the smoke tests. See https://nodejs.org/en/docs/guides/debugging-getting-started/ for more information. The debugger will break at the beginning of the smoke tests when the env variable is set. --- lib/tasks/smoke_test.rake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/tasks/smoke_test.rake b/lib/tasks/smoke_test.rake index 70abebcc985..fd7c70529ce 100644 --- a/lib/tasks/smoke_test.rake +++ b/lib/tasks/smoke_test.rake @@ -68,7 +68,12 @@ task "smoke:test" do results = +"" - IO.popen("node #{Rails.root}/test/smoke_test.js #{url}").each do |line| + node_arguments = [] + node_arguments << '--inspect-brk' if ENV["DEBUG_NODE"] + node_arguments << "#{Rails.root}/test/smoke_test.js" + node_arguments << url + + IO.popen("node #{node_arguments.join(' ')}").each do |line| puts line results << line end