From f39f01e00b97849a9841addffa9ee77697cbccd5 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Fri, 25 Jan 2019 19:46:11 +0100 Subject: [PATCH] build: remove unused "test.sh" leftover code in language-service (#28550) Since we recently removed the `test.sh` script, and now run all tests with Bazel, we can remove the unused logic that makes language-service tests pass in non-Bazel. This cleans up the tests, and also makes it easier to write tests without worrying about two ways of the Angular package output (Bazel `ng_package` rules vs. old `build.sh` logic of building) PR Close #28550 --- packages/language-service/test/test_utils.ts | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/packages/language-service/test/test_utils.ts b/packages/language-service/test/test_utils.ts index 9032df6248..e3bb4871e9 100644 --- a/packages/language-service/test/test_utils.ts +++ b/packages/language-service/test/test_utils.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {isInBazel, setup} from '@angular/compiler-cli/test/test_support'; +import {setup} from '@angular/compiler-cli/test/test_support'; import * as fs from 'fs'; import * as path from 'path'; import * as ts from 'typescript'; @@ -76,20 +76,9 @@ export class MockTypescriptHost implements ts.LanguageServiceHost { constructor( private scriptNames: string[], private data: MockData, private node_modules: string = 'node_modules', private myPath: typeof path = path) { - const moduleFilename = module.filename.replace(/\\/g, '/'); - if (isInBazel()) { - const support = setup(); - this.nodeModulesPath = path.join(support.basePath, 'node_modules'); - this.angularPath = path.join(this.nodeModulesPath, '@angular'); - } else { - const angularIndex = moduleFilename.indexOf('@angular'); - if (angularIndex >= 0) - this.angularPath = - moduleFilename.substr(0, angularIndex).replace('/all/', '/all/@angular/'); - const distIndex = moduleFilename.indexOf('/dist/all'); - if (distIndex >= 0) - this.nodeModulesPath = myPath.join(moduleFilename.substr(0, distIndex), 'node_modules'); - } + const support = setup(); + this.nodeModulesPath = path.join(support.basePath, 'node_modules'); + this.angularPath = path.join(this.nodeModulesPath, '@angular'); this.options = { target: ts.ScriptTarget.ES5, module: ts.ModuleKind.CommonJS,