Open patrickdavey opened 1 year ago
I'm also seeing this behavior
After some playing around, I noticed that running the full test suite correctly updates the badges, but running a single spec file or example does not.
In Tests#runNode, the testStatesEmitter fires the "test running" event with node.id
which is the relative path to the spec. In the second branch (when a spec file is run) and the fourth branch (when a single example is run), the testStatesEmitter fires the "test passed/failed" event with the absolute path to the spec, which it parses from the JSON.
I hacked my installation to fire the "test passed/failed" with the relative path, and the badges were updated. So, I think the solution here lies in figuring out why the output JSON has relative paths when running every spec file, but absolute paths when running a single spec file.
rspec
is run, the formatter puts the relative path, ./path/to/spec.rb[1:3]
, in the output JSON, which is what node.id
resolves to. Since running the full test suite just runs rspec
, the badges are correctly updated.rspec <path>
is run, the formatter puts <path>
directly in the output JSON. The <path>
in the command comes from node.file
, which is initialized in Tests#getTestSuiteForFile as the absolute path.I can think of two solutions, without digging further:
node
to use a relative path. This might have side-effects, because that attribute is used in multiple placesTests#runNode
to remove the workspace path before calling rspec
in the second and fourth branches.node
and use that in branch two and four.It looks like there's a pretty big rewrite of this repo though, so I don't know if a PR on this issue is very useful: #90
Your environment
vscode-ruby-test-adapter
version:Expected behavior
Running a test remotely which passes the test (as seen in the logs and running it directly) does not result in a green icon in the tree.
Actual behavior
I am running a single test using the explorer. After running the test the icon is gray. I can see the test outputs:
But, this seemingly is not parsed correctly back into the UI.
One possible/probable factor is that I am running this in a remote developing extension. Apologies if this is not an issue with this extension, I am a relative newbie to vscode!
Console log
I can also see this in the logs (which seems like it is parsing it correctly)
[DEBUG] {"version":"3.11.0","messages":["Run options: include {:locations=>{\"/FOO/BAR/spec/models/admin_maintenance_file_spec.rb\"=>[7]}}"],"seed":53589,"examples":[{"id":"/FOO/BAR/spec/models/admin_maintenance_file_spec.rb[1:1:1]","description":"must have a user","full_description":"AdminMaintenanceFile validations must have a user","status":"passed","file_path":"/FOO/BAR/spec/models/admin_maintenance_file_spec.rb","line_number":7,"type":"model","pending_message":null}],"summary":{"duration":2.367175155,"example_count":1,"failure_count":0,"pending_count":0,"errors_outside_of_examples_count":0},"summary_line":"1 example, 0 failures"}