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
This commit is contained in:
Igor Minar 2020-01-26 13:43:18 -08:00
parent 7360e1ea2c
commit 4c3a543f7f
1 changed files with 16 additions and 19 deletions

View File

@ -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' +
' | ^',
' | ^^^^^',
});
});