@@ -273,108 +273,100 @@ def test_display_errors_with_path_option
273
273
274
274
def test_output_no_errors_to_junit_xml
275
275
@project . write_sorbet_config! ( "file.rb" )
276
- Tempfile . create ( "sorbet_junit" ) do |tempfile |
277
- result = @project . spoom ( "srb tc --junit_output_path=#{ tempfile . path } " )
278
- expected_doc = <<~XML . chomp
279
- <?xml version='1.0'?>
280
- <testsuite name='Sorbet' failures='0'>
281
- <testcase name='Typecheck' tests='1'/>
282
- </testsuite>
283
- XML
284
- tempfile . rewind
285
- actual_doc = tempfile . read
286
- assert_equal ( expected_doc , actual_doc )
287
- assert ( result . status )
288
- end
276
+ result = @project . spoom ( "srb tc --junit_output_path=junit.xml" )
277
+ expected_doc = <<~XML . chomp
278
+ <?xml version='1.0'?>
279
+ <testsuite name='Sorbet' failures='0'>
280
+ <testcase name='Typecheck' tests='1'/>
281
+ </testsuite>
282
+ XML
283
+ assert_equal ( expected_doc , @project . read ( "junit.xml" ) )
284
+ assert ( result . status )
289
285
end
290
286
291
287
def test_output_errors_to_junit_xml
292
- Tempfile . create ( "sorbet_junit" ) do |tempfile |
293
- expected_doc = <<~XML . chomp
294
- <?xml version='1.0'?>
295
- <testsuite name='Sorbet' failures='7'>
296
- <testcase name='Unable to resolve constant `Bar`' file='errors/errors.rb' line='5'>
297
- <failure type='5002'>
298
- <![CDATA[In file errors/errors.rb:
299
- 5 | sig { params(bar: Bar).returns(C) }
300
- ^^^]]>
301
- </failure>
302
- </testcase>
303
- <testcase name='Unable to resolve constant `C`' file='errors/errors.rb' line='5'>
304
- <failure type='5002'>
305
- <![CDATA[In file errors/errors.rb:
306
- 5 | sig { params(bar: Bar).returns(C) }
307
- ^
308
- Did you mean `RDoc::Parser::C`? Use `-a` to autocorrect
309
- errors/errors.rb:5: Replace with `RDoc::Parser::C`
310
- 5 | sig { params(bar: Bar).returns(C) }
311
- ^
312
- https://github.com/sorbet/sorbet/tree/dad16b7fe5bf8ebdec30bac0d9c1cb0e66f582cf/rbi/stdlib/rdoc.rbi#L6768: `RDoc::Parser::C` defined here
313
- 6768 |class RDoc::Parser::C < ::RDoc::Parser
314
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^]]>
315
- </failure>
316
- </testcase>
317
- <testcase name='Method `params` does not exist on `T.class_of(Foo)`' file='errors/errors.rb' line='5'>
318
- <failure type='7003'>
319
- <![CDATA[In file errors/errors.rb:
320
- 5 | sig { params(bar: Bar).returns(C) }
321
- ^^^^^^]]>
322
- </failure>
323
- </testcase>
324
- <testcase name='Method `sig` does not exist on `T.class_of(Foo)`' file='errors/errors.rb' line='5'>
325
- <failure type='7003'>
326
- <![CDATA[In file errors/errors.rb:
327
- 5 | sig { params(bar: Bar).returns(C) }
328
- ^^^
329
- Autocorrect: Use `-a` to autocorrect
330
- errors/errors.rb:5: Insert `extend T::Sig`
331
- 5 | sig { params(bar: Bar).returns(C) }
332
- ^]]>
333
- </failure>
334
- </testcase>
335
- <testcase name='Wrong number of arguments for constructor. Expected: `0`, got: `1`' file='errors/errors.rb' line='10'>
336
- <failure type='7004'>
337
- <![CDATA[In file errors/errors.rb:
338
- 10 |b = Foo.new(42)
339
- ^^
340
- https://github.com/sorbet/sorbet/tree/dad16b7fe5bf8ebdec30bac0d9c1cb0e66f582cf/rbi/core/basic_object.rbi#L228: `initialize` defined here
341
- 228 | def initialize(); end
342
- ^^^^^^^^^^^^^^^^
343
- Autocorrect: Use `-a` to autocorrect
344
- errors/errors.rb:10: Delete
345
- 10 |b = Foo.new(42)
346
- ^^]]>
347
- </failure>
348
- </testcase>
349
- <testcase name='Method `c` does not exist on `T.class_of(<root>)`' file='errors/errors.rb' line='11'>
350
- <failure type='7003'>
351
- <![CDATA[In file errors/errors.rb:
352
- 11 |b.foo(b, c)
353
- ^]]>
354
- </failure>
355
- </testcase>
356
- <testcase name='Too many arguments provided for method `Foo#foo`. Expected: `1`, got: `2`' file='errors/errors.rb' line='11'>
357
- <failure type='7004'>
358
- <![CDATA[In file errors/errors.rb:
359
- 11 |b.foo(b, c)
360
- ^
361
- errors/errors.rb:6: `foo` defined here
362
- 6 | def foo(bar)
363
- ^^^^^^^^^^^^
364
- Autocorrect: Use `-a` to autocorrect
365
- errors/errors.rb:11: Delete
366
- 11 |b.foo(b, c)
367
- ^^^]]>
368
- </failure>
369
- </testcase>
370
- </testsuite>
371
- XML
372
- result = @project . spoom ( "srb tc --junit_output_path=#{ tempfile . path } " )
373
- tempfile . rewind
374
- actual_doc = tempfile . read
375
- assert_equal ( expected_doc , actual_doc )
376
- refute ( result . status )
377
- end
288
+ result = @project . spoom ( "srb tc --junit_output_path=junit.xml" )
289
+ expected_doc = <<~XML . chomp
290
+ <?xml version='1.0'?>
291
+ <testsuite name='Sorbet' failures='7'>
292
+ <testcase name='Unable to resolve constant `Bar`' file='errors/errors.rb' line='5'>
293
+ <failure type='5002'>
294
+ <![CDATA[In file errors/errors.rb:
295
+ 5 | sig { params(bar: Bar).returns(C) }
296
+ ^^^]]>
297
+ </failure>
298
+ </testcase>
299
+ <testcase name='Unable to resolve constant `C`' file='errors/errors.rb' line='5'>
300
+ <failure type='5002'>
301
+ <![CDATA[In file errors/errors.rb:
302
+ 5 | sig { params(bar: Bar).returns(C) }
303
+ ^
304
+ Did you mean `RDoc::Parser::C`? Use `-a` to autocorrect
305
+ errors/errors.rb:5: Replace with `RDoc::Parser::C`
306
+ 5 | sig { params(bar: Bar).returns(C) }
307
+ ^
308
+ https://github.com/sorbet/sorbet/tree/dad16b7fe5bf8ebdec30bac0d9c1cb0e66f582cf/rbi/stdlib/rdoc.rbi#L6768: `RDoc::Parser::C` defined here
309
+ 6768 |class RDoc::Parser::C < ::RDoc::Parser
310
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^]]>
311
+ </failure>
312
+ </testcase>
313
+ <testcase name='Method `params` does not exist on `T.class_of(Foo)`' file='errors/errors.rb' line='5'>
314
+ <failure type='7003'>
315
+ <![CDATA[In file errors/errors.rb:
316
+ 5 | sig { params(bar: Bar).returns(C) }
317
+ ^^^^^^]]>
318
+ </failure>
319
+ </testcase>
320
+ <testcase name='Method `sig` does not exist on `T.class_of(Foo)`' file='errors/errors.rb' line='5'>
321
+ <failure type='7003'>
322
+ <![CDATA[In file errors/errors.rb:
323
+ 5 | sig { params(bar: Bar).returns(C) }
324
+ ^^^
325
+ Autocorrect: Use `-a` to autocorrect
326
+ errors/errors.rb:5: Insert `extend T::Sig`
327
+ 5 | sig { params(bar: Bar).returns(C) }
328
+ ^]]>
329
+ </failure>
330
+ </testcase>
331
+ <testcase name='Wrong number of arguments for constructor. Expected: `0`, got: `1`' file='errors/errors.rb' line='10'>
332
+ <failure type='7004'>
333
+ <![CDATA[In file errors/errors.rb:
334
+ 10 |b = Foo.new(42)
335
+ ^^
336
+ https://github.com/sorbet/sorbet/tree/dad16b7fe5bf8ebdec30bac0d9c1cb0e66f582cf/rbi/core/basic_object.rbi#L228: `initialize` defined here
337
+ 228 | def initialize(); end
338
+ ^^^^^^^^^^^^^^^^
339
+ Autocorrect: Use `-a` to autocorrect
340
+ errors/errors.rb:10: Delete
341
+ 10 |b = Foo.new(42)
342
+ ^^]]>
343
+ </failure>
344
+ </testcase>
345
+ <testcase name='Method `c` does not exist on `T.class_of(<root>)`' file='errors/errors.rb' line='11'>
346
+ <failure type='7003'>
347
+ <![CDATA[In file errors/errors.rb:
348
+ 11 |b.foo(b, c)
349
+ ^]]>
350
+ </failure>
351
+ </testcase>
352
+ <testcase name='Too many arguments provided for method `Foo#foo`. Expected: `1`, got: `2`' file='errors/errors.rb' line='11'>
353
+ <failure type='7004'>
354
+ <![CDATA[In file errors/errors.rb:
355
+ 11 |b.foo(b, c)
356
+ ^
357
+ errors/errors.rb:6: `foo` defined here
358
+ 6 | def foo(bar)
359
+ ^^^^^^^^^^^^
360
+ Autocorrect: Use `-a` to autocorrect
361
+ errors/errors.rb:11: Delete
362
+ 11 |b.foo(b, c)
363
+ ^^^]]>
364
+ </failure>
365
+ </testcase>
366
+ </testsuite>
367
+ XML
368
+ assert_equal ( expected_doc , @project . read ( "junit.xml" ) )
369
+ refute ( result . status )
378
370
end
379
371
380
372
def test_pass_options_to_sorbet
0 commit comments