From 3082f7378b9fd620e11908e4cb0924681f9dea3b Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Mon, 21 Sep 2020 21:51:40 +0100 Subject: [PATCH] test(compiler-cli): make typescript_ast_factory_spec tests resilient to line-endings (#38925) The tests were assuming that newlines were `\n` characters but this is not the case on Windows. PR Close #38925 --- .../ngtsc/translator/test/typescript_ast_factory_spec.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/compiler-cli/src/ngtsc/translator/test/typescript_ast_factory_spec.ts b/packages/compiler-cli/src/ngtsc/translator/test/typescript_ast_factory_spec.ts index b128a58432..3c7ad941ef 100644 --- a/packages/compiler-cli/src/ngtsc/translator/test/typescript_ast_factory_spec.ts +++ b/packages/compiler-cli/src/ngtsc/translator/test/typescript_ast_factory_spec.ts @@ -6,6 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ import {leadingComment} from '@angular/compiler'; +import {EOL} from 'os'; import * as ts from 'typescript'; import {TypeScriptAstFactory} from '../src/typescript_ast_factory'; @@ -24,7 +25,7 @@ describe('TypeScriptAstFactory', () => { '/* comment 1 */', '//comment 2', 'x = 10;', - ].join('\n')); + ].join(EOL)); }); }); @@ -61,7 +62,7 @@ describe('TypeScriptAstFactory', () => { ' x = 10;', ' y = 20;', '}', - ].join('\n')); + ].join(EOL)); }); }); @@ -152,7 +153,7 @@ describe('TypeScriptAstFactory', () => { ' x = 10;', 'else', ' x = 42;', - ].join('\n')); + ].join(EOL)); }); it('should create an if statement if the else expression is null', () => { @@ -162,7 +163,7 @@ describe('TypeScriptAstFactory', () => { expect(generate(ifStmt)).toEqual([ 'if (!test)', ' x = 10;', - ].join('\n')); + ].join(EOL)); }); });