truffleruby
truffleruby copied to clipboard
danger gem test failure: extra space in json object
1) Danger::PluginParser outputs JSON for well documented subclasses of Danger::Plugin
Failure/Error: expect(sanitized_json).to eq File.read(fixture)
expected: "[\n {\n \"name\": \"DangerProselint\",\n \"body_md\": \"Lint markdown files inside your proje...talsmith, gatsby, express\"\n ],\n \"see\": [\n \"artsy/artsy.github.io\"\n ]\n }\n]"
got: "[\n {\n \"name\": \"DangerProselint\",\n \"body_md\": \"Lint markdown files inside your proje...talsmith, gatsby, express\"\n ],\n \"see\": [\n \"artsy/artsy.github.io\"\n ]\n }\n]"
(compared using ==)
Diff:
@@ -40,6 +40,7 @@
],
"param_couplets": {
+
},
"return": "",
"one_liner": "disable_linters="
@@ -106,6 +107,7 @@
}
],
"param_couplets": {
+
},
"return": "Bool",
"one_liner": "proselint_installed? -> Bool"
it could be related to https://github.com/oracle/truffleruby/issues/2053 but I am not sure
Yes, it's the same as #2053. Ruby 2.7.2 doesn't include a recent enough version of JSON to fix it. So we have 4 choices:
- Update to latest JSON, but this means the default json gem will be newer than on MRI
- Cherry-pick that fix, but then we claim to have json x.y.z but actually with that fix included
- Use the JSON C extension, but in the past that was measured as slower at least in some cases
- Keep this incompatibility, the same would happen on CRuby 2.7.2 when using the pure Ruby JSON backend
The issue with extra new lines is not reproduced.
But it seems there is another issue with JSON formatting. There are examples of the following difference:
- },
+},
Failed specs
Failures:
1) Danger::PluginParser outputs JSON for well documented subclasses of Danger::Plugin
Failure/Error: expect(sanitized_json).to eq File.read(fixture)
expected: "[\n {\n \"name\": \"DangerProselint\",\n \"body_md\": \"Lint markdown files inside your proje...talsmith, gatsby, express\"\n ],\n \"see\": [\n \"artsy/artsy.github.io\"\n ]\n }\n]"
got: "[\n {\n \"name\": \"DangerProselint\",\n \"body_md\": \"Lint markdown files inside your proje...talsmith, gatsby, express\"\n ],\n \"see\": [\n \"artsy/artsy.github.io\"\n ]\n }\n]"
(compared using ==)
Diff:
@@ -3,11 +3,11 @@
"name": "DangerProselint",
"body_md": "Lint markdown files inside your projects.\nThis is done using the [proselint](http://proselint.com) python egg.\nResults are passed out as a table in markdown.",
"instance_name": "proselint",
- "gem": null,
- "gem_path": "",
+ "gem": "/Users/andrykonchin/projects/truffleruby-gems-to",
+ "gem_path": "/spec/fixtures/plugins/example_fully_documented.rb",
"files": [
[
- "/spec/fixtures/plugins/example_fully_documented.rb",
+ "",
18
]
],
@@ -32,7 +32,7 @@
],
"files": [
[
- "/spec/fixtures/plugins/example_fully_documented.rb",
+ "",
21
]
],
@@ -40,7 +40,7 @@
],
"param_couplets": {
- },
+},
"return": "",
"one_liner": "disable_linters="
}
@@ -59,7 +59,7 @@
],
"files": [
[
- "/spec/fixtures/plugins/example_fully_documented.rb",
+ "",
30
]
],
@@ -93,7 +93,7 @@
],
"files": [
[
- "/spec/fixtures/plugins/example_fully_documented.rb",
+ "",
77
]
],
@@ -106,7 +106,7 @@
}
],
"param_couplets": {
- },
+},
"return": "Bool",
"one_liner": "proselint_installed? -> Bool"
}
# ./spec/lib/danger/plugin_support/plugin_parser_spec.rb:78:in `block (2 levels) in <top (required)>'
2) Danger::PluginParser outputs JSON for badly documented subclasses of Danger::Plugin
Failure/Error: expect(sanitized_json).to eq File.read(fixture)
expected: "[\n {\n \"name\": \"ExampleRemote\",\n \"body_md\": \"\",\n \"instance_name\": \"example_r..."one_liner\": \"echo\"\n }\n ],\n \"tags\": [\n\n ],\n \"see\": [\n\n ]\n }\n]"
got: "[\n {\n \"name\": \"ExampleRemote\",\n \"body_md\": \"\",\n \"instance_name\": \"example_r..."one_liner\": \"echo\"\n }\n ],\n \"tags\": [\n\n ],\n \"see\": [\n\n ]\n }\n]"
(compared using ==)
Diff:
@@ -3,11 +3,11 @@
"name": "ExampleRemote",
"body_md": "",
"instance_name": "example_remote",
- "gem": null,
- "gem_path": "",
+ "gem": "/Users/andrykonchin/projects/truffleruby-gems-to",
+ "gem_path": "/spec/fixtures/plugins/example_remote.rb",
"files": [
[
- "/spec/fixtures/plugins/example_remote.rb",
+ "",
2
]
],
@@ -26,7 +26,7 @@
],
"files": [
[
- "/spec/fixtures/plugins/example_remote.rb",
+ "",
3
]
],
@@ -34,7 +34,7 @@
],
"param_couplets": {
- },
+},
"return": "",
"one_liner": "echo"
}
# ./spec/lib/danger/plugin_support/plugin_parser_spec.rb:58:in `block (2 levels) in <top (required)>'
Finished in 2 minutes 19.7 seconds (files took 9.14 seconds to load)
1205 examples, 2 failures, 2 pending
Failed examples:
rspec ./spec/lib/danger/plugin_support/plugin_parser_spec.rb:62 # Danger::PluginParser outputs JSON for well documented subclasses of Danger::Plugin
rspec ./spec/lib/danger/plugin_support/plugin_parser_spec.rb:42 # Danger::PluginParser outputs JSON for badly documented subclasses of Danger::Plugin
Randomized with seed 58387