Fix findUpDir.ts and uses

Missed a bunch of stuff in #46414 (556098e).
This commit is contained in:
Eli Barzilay 2021-10-22 03:07:51 -04:00
parent d89076381e
commit fa2ad1a35a
5 changed files with 9 additions and 7 deletions

View File

@ -39,7 +39,7 @@ const execTsc = (lkg, ...args) =>
exec(process.execPath,
[resolve(findUpRoot(), lkg ? "./lib/tsc" : "./built/local/tsc"),
"-b", ...args],
{ hidePrompt: true })
{ hidePrompt: true });
const projectBuilder = new ProjectQueue((projects, lkg, force) => execTsc(lkg, ...(force ? ["--force"] : []), ...projects));

View File

@ -1,11 +1,11 @@
namespace findUpDir {
import { join, resolve, dirname } from "path";
import { existsSync } from "fs";
namespace Utils {
const { join, resolve, dirname } = require("path") as typeof import("path");
const { existsSync } = require("fs") as typeof import("fs");
// search directories upward to avoid hard-wired paths based on the
// build tree (same as scripts/build/findUpDir.js)
export function findUpFile(name: string) {
export function findUpFile(name: string): string {
let dir = __dirname;
while (true) {
const fullPath = join(dir, name);

View File

@ -41,6 +41,7 @@ namespace Harness {
export const virtualFileSystemRoot = "/";
function createNodeIO(): IO {
const workspaceRoot = Utils.findUpRoot();
let fs: any, pathModule: any;
if (require) {
fs = require("fs");
@ -154,7 +155,7 @@ namespace Harness {
log: s => console.log(s),
args: () => ts.sys.args,
getExecutingFilePath: () => ts.sys.getExecutingFilePath(),
getWorkspaceRoot: () => vpath.resolve(__dirname, "../.."),
getWorkspaceRoot: () => workspaceRoot,
exit: exitCode => ts.sys.exit(exitCode),
readDirectory: (path, extension, exclude, include, depth) => ts.sys.readDirectory(path, extension, exclude, include, depth),
getAccessibleFileSystemEntries,

View File

@ -28,6 +28,7 @@
"evaluatorImpl.ts",
"fakesHosts.ts",
"client.ts",
"findUpDir.ts",
"runnerbase.ts",
"sourceMapRecorder.ts",

View File

@ -14,7 +14,7 @@ namespace Harness.Parallel.Host {
const { statSync } = require("fs") as typeof import("fs");
// NOTE: paths for module and types for FailedTestReporter _do not_ line up due to our use of --outFile for run.js
const FailedTestReporter = require(path.resolve(__dirname, "../../scripts/failed-tests")) as typeof import("../../../scripts/failed-tests");
const FailedTestReporter = require(Utils.findUpFile("scripts/failed-tests.js")) as typeof import("../../../scripts/failed-tests");
const perfdataFileNameFragment = ".parallelperf";
const perfData = readSavedPerfData(configOption);