Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Custom error message in Dart #481

Closed
javatlacati opened this issue Jul 31, 2017 · 4 comments
Closed

Custom error message in Dart #481

javatlacati opened this issue Jul 31, 2017 · 4 comments

Comments

@javatlacati
Copy link
Contributor

I don know if related to #410 but I want to show a specified message for Dart tests.

How can I do it?

Here my attempts so far:
https://preview.codewars.com/kumite/597f5ecdb44a5fec1800000d/?sel=597f5ecdb44a5fec1800000d

It only shows

Test Results:
Codewars is in the array
! Test Failed

@kazk
Copy link
Member

kazk commented Jul 31, 2017

I think you need to rewrite lib/runners/dart.js.

for (let id in results) {
  let test = results[id];
  stdout += `<IT::>${test.name}\n`;
  stdout += test.result == 'success' ? `<PASSED::>Test Passed\n` : `<FAILED::>Test Failed\n`;
  stdout += `<COMPLETEDIN::>${test.runTime}\n`;
}

lib/runners/dart.js#L112-L117.

If Dart's test output JSON includes those custom messages, it should be possible by modifying above lines.

@javatlacati
Copy link
Contributor Author

You mean like adding variable desidered to the output?

stdout += test.reason ? `${test.reason}` : '';

@javatlacati
Copy link
Contributor Author

It will fix the issue in this Kata https://www.codewars.com/kata/sum-of-numbers-from-0-to-n/train/dart

@kazk
Copy link
Member

kazk commented Feb 22, 2019

I rewrote the test reporter for Dart 2.1 and backported to 1.x. So this is fixed now. Your kumite outputs

image

@kazk kazk closed this as completed Feb 22, 2019
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

2 participants