From d845e132e2004437fbf6492fff0d7dfe9719c4a5 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Wed, 16 Oct 2019 13:59:00 -0400 Subject: [PATCH] Refactor test assertion to be platform agnostic. globby _always_ returns posix style paths (regardless of platform). In order to search for the "file with the error" in the output, we need to convert the `path.join` result into posix style paths. We (and globby) use `slash` for this in other areas, so it is used here for simplicity and to match the logic globby would use. --- tests/ember-template-recast-test.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/ember-template-recast-test.js b/tests/ember-template-recast-test.js index 0691c97e..1eb0812d 100644 --- a/tests/ember-template-recast-test.js +++ b/tests/ember-template-recast-test.js @@ -2,6 +2,7 @@ const execa = require('execa'); const { readFileSync } = require('fs'); const { join } = require('path'); const { createTempDir } = require('broccoli-test-helper'); +const slash = require('slash'); function run(args, cwd) { return execa(require.resolve('../bin/ember-template-recast'), args, { cwd }); @@ -104,10 +105,13 @@ Errored: 1` 'Status message includes error count' ); - assert.ok( - stdout.includes(join(this.fixture.path(), 'files/bad-template.hbs')), - 'Output includes full path to bad template' - ); + let badFilePath = slash(join(this.fixture.path(), 'files/bad-template.hbs')); + + assert.pushResult({ + result: stdout.includes(badFilePath), + message: `Expected output to include full path to the invalid template (${badFilePath}): \n\n${stdout}`, + }); + assert.ok( stdout.includes('Error: Parse error on line 1:'), 'Output includes error stacktrace'