Test Runner output (v1 -> message) throws away newlines

We have intermediary support for a new type of test runner and before we can supply version 3 (with tasks etc. etc.), we provide preliminary output like this.

However, the message looks garbled because \\n is being thrown away.

This is with the newlines not stripped:

Is this something that can be supported?

That’s odd. What’s the JSON look like?

Generated here:

{ "version": 1, "status": "error", "message": "The submitted code did compile but at least one of the type-tests failed. We have collected the failing test encountered. At this moment the error messages are not very read-friendly, but it's a start. We are working on a more helpful output.\n-------------------------------\n\u001b[31mError: \u001b[0mModule '\"../lasagna.ts\"' has no exported member 'EXPECTED_MINUTES_IN_OVEN'.\u001b[90m ts(2305)\u001b[0m \u001b[90m 1\u001b[0m\u001b[90m | \u001b[0mimport { describe, expect, test } from 'tstyche' \u001b[90m 2\u001b[0m\u001b[90m | \u001b[0mimport { \u001b[31m 3\u001b[0m\u001b[90m | \u001b[0m EXPECTED_MINUTES_IN_OVEN, \u001b[90m | \u001b[0m \u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~\u001b[0m \u001b[90m 4\u001b[0m\u001b[90m | \u001b[0m remainingMinutesInOven, \u001b[90m 5\u001b[0m\u001b[90m | \u001b[0m preparationTimeInMinutes, \u001b[90m 6\u001b[0m\u001b[90m | \u001b[0m totalTimeInMinutes, \u001b[90m at \u001b[0m\u001b[36m./__typetests__/lasagna.tst.ts\u001b[0m\u001b[90m:3:3\u001b[0m\n" }

Or pretty:

{
  "version": 1,
  "status": "error",
  "message": "The submitted code did compile but at least one of the type-tests failed. We have collected the failing test encountered. At this moment the error messages are not very read-friendly, but it's a start. We are working on a more helpful output.\n-------------------------------\n\u001b[31mError: \u001b[0mModule '\"../lasagna.ts\"' has no exported member 'EXPECTED_MINUTES_IN_OVEN'.\u001b[90m ts(2305)\u001b[0m \u001b[90m 1\u001b[0m\u001b[90m | \u001b[0mimport { describe, expect, test } from 'tstyche' \u001b[90m 2\u001b[0m\u001b[90m | \u001b[0mimport { \u001b[31m 3\u001b[0m\u001b[90m | \u001b[0m EXPECTED_MINUTES_IN_OVEN, \u001b[90m | \u001b[0m \u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~\u001b[0m \u001b[90m 4\u001b[0m\u001b[90m | \u001b[0m remainingMinutesInOven, \u001b[90m 5\u001b[0m\u001b[90m | \u001b[0m preparationTimeInMinutes, \u001b[90m 6\u001b[0m\u001b[90m | \u001b[0m totalTimeInMinutes, \u001b[90m at \u001b[0m\u001b[36m./__typetests__/lasagna.tst.ts\u001b[0m\u001b[90m:3:3\u001b[0m\n"
}

(Note that you seeing \n means that these are not control characters but literal \ followed by literal n)

But I do see the last iteration stripped the \n in here, so will fix that first.

Yeah it was probably a bad substitution. I can now generate:

{ "version": 1, "status": "error", "message": "The submitted code did compile but at least one of the type-tests failed. We have collected the failing test encountered. At this moment the error messages are not very read-friendly, but it's a start. We are working on a more helpful output.\n-------------------------------\n\u001b[31mError: \u001b[0mModule '\"../lasagna.ts\"' has no exported member 'EXPECTED_MINUTES_IN_OVEN'.\u001b[90m ts(2305)\u001b[0m\n\n\u001b[90m  1\u001b[0m\u001b[90m | \u001b[0mimport { describe, expect, test } from 'tstyche'\n\u001b[90m  2\u001b[0m\u001b[90m | \u001b[0mimport {\n\u001b[31m  3\u001b[0m\u001b[90m | \u001b[0m  EXPECTED_MINUTES_IN_OVEN,\n   \u001b[90m | \u001b[0m  \u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~\u001b[0m\n\u001b[90m  4\u001b[0m\u001b[90m | \u001b[0m  remainingMinutesInOven,\n\u001b[90m  5\u001b[0m\u001b[90m | \u001b[0m  preparationTimeInMinutes,\n\u001b[90m  6\u001b[0m\u001b[90m | \u001b[0m  totalTimeInMinutes,\n\n     \u001b[90m at \u001b[0m\u001b[36m./__typetests__/lasagna.tst.ts\u001b[0m\u001b[90m:3:3\u001b[0m\n" }

Let’s see if that works.

1 Like