From 4c3a543f7fd42ec3c6490fcb39d523bc7368f776 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Sun, 26 Jan 2020 13:43:18 -0800 Subject: [PATCH] test(localize): fix broken localize/translate tests (#34974) the test failures most likely result from the babel updates in the previous commit. it does look like we lost the file path from the error message, which is something that we should follow up no in a separate change. PR Close #34974 --- .../source_files/es5_translate_plugin_spec.ts | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/packages/localize/src/tools/test/translate/source_files/es5_translate_plugin_spec.ts b/packages/localize/src/tools/test/translate/source_files/es5_translate_plugin_spec.ts index ff2a1b89d6..ecee911cc7 100644 --- a/packages/localize/src/tools/test/translate/source_files/es5_translate_plugin_spec.ts +++ b/packages/localize/src/tools/test/translate/source_files/es5_translate_plugin_spec.ts @@ -140,9 +140,9 @@ describe('makeEs5Plugin', () => { expect(diagnostics.hasErrors).toBe(true); expect(diagnostics.messages[0]).toEqual({ type: 'error', - message: '/app/dist/test.js: `$localize` called without any arguments.\n' + + message: '`$localize` called without any arguments.\n' + '> 1 | $localize()\n' + - ' | ^', + ' | ^^^^^^^^^^^', }); }); @@ -156,9 +156,9 @@ describe('makeEs5Plugin', () => { expect(diagnostics.hasErrors).toBe(true); expect(diagnostics.messages[0]).toEqual({ type: 'error', - message: '/app/dist/test.js: Unexpected argument to `$localize` (expected an array).\n' + + message: 'Unexpected argument to `$localize` (expected an array).\n' + '> 1 | $localize(...x)\n' + - ' | ^', + ' | ^^^^', }); }); @@ -172,10 +172,9 @@ describe('makeEs5Plugin', () => { expect(diagnostics.hasErrors).toBe(true); expect(diagnostics.messages[0]).toEqual({ type: 'error', - message: - '/app/dist/test.js: Unexpected messageParts for `$localize` (expected an array of strings).\n' + + message: 'Unexpected messageParts for `$localize` (expected an array of strings).\n' + '> 1 | $localize(null, [])\n' + - ' | ^', + ' | ^^^^', }); }); @@ -190,9 +189,9 @@ describe('makeEs5Plugin', () => { expect(diagnostics.messages[0]).toEqual({ type: 'error', message: - '/app/dist/test.js: Unexpected `raw` argument to the "makeTemplateObject()" function (expected an expression).\n' + + 'Unexpected `raw` argument to the "makeTemplateObject()" function (expected an expression).\n' + '> 1 | $localize(__makeTemplateObject([], ...[]))\n' + - ' | ^', + ' | ^^^^^', }); }); @@ -207,9 +206,9 @@ describe('makeEs5Plugin', () => { expect(diagnostics.messages[0]).toEqual({ type: 'error', message: - '/app/dist/test.js: Unexpected `cooked` argument to the "makeTemplateObject()" function (expected an expression).\n' + + 'Unexpected `cooked` argument to the "makeTemplateObject()" function (expected an expression).\n' + '> 1 | $localize(__makeTemplateObject(...[], []))\n' + - ' | ^', + ' | ^^^^^', }); }); @@ -223,10 +222,9 @@ describe('makeEs5Plugin', () => { expect(diagnostics.hasErrors).toBe(true); expect(diagnostics.messages[0]).toEqual({ type: 'error', - message: - '/app/dist/test.js: Unexpected messageParts for `$localize` (expected an array of strings).\n' + + message: 'Unexpected messageParts for `$localize` (expected an array of strings).\n' + '> 1 | $localize(__makeTemplateObject(["a", 12, "b"], ["a", "12", "b"]))\n' + - ' | ^', + ' | ^^^^^^^^^^^^^^', }); }); @@ -240,10 +238,9 @@ describe('makeEs5Plugin', () => { expect(diagnostics.hasErrors).toBe(true); expect(diagnostics.messages[0]).toEqual({ type: 'error', - message: - '/app/dist/test.js: Unexpected messageParts for `$localize` (expected an array of strings).\n' + + message: 'Unexpected messageParts for `$localize` (expected an array of strings).\n' + '> 1 | $localize(__makeTemplateObject(["a", "12", "b"], ["a", 12, "b"]))\n' + - ' | ^', + ' | ^^^^^^^^^^^^^^', }); }); @@ -258,9 +255,9 @@ describe('makeEs5Plugin', () => { expect(diagnostics.messages[0]).toEqual({ type: 'error', message: - '/app/dist/test.js: Invalid substitutions for `$localize` (expected all substitution arguments to be expressions).\n' + + 'Invalid substitutions for `$localize` (expected all substitution arguments to be expressions).\n' + '> 1 | $localize(__makeTemplateObject(["a", "b"], ["a", "b"]), ...[])\n' + - ' | ^', + ' | ^^^^^', }); });