Skip to content

Commit fa2ad1a

Browse files
committed
Fix findUpDir.ts and uses
Missed a bunch of stuff in #46414 (556098e).
1 parent d890763 commit fa2ad1a

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

scripts/build/projects.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const execTsc = (lkg, ...args) =>
3939
exec(process.execPath,
4040
[resolve(findUpRoot(), lkg ? "./lib/tsc" : "./built/local/tsc"),
4141
"-b", ...args],
42-
{ hidePrompt: true })
42+
{ hidePrompt: true });
4343

4444
const projectBuilder = new ProjectQueue((projects, lkg, force) => execTsc(lkg, ...(force ? ["--force"] : []), ...projects));
4545

src/harness/findUpDir.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
namespace findUpDir {
2-
import { join, resolve, dirname } from "path";
3-
import { existsSync } from "fs";
1+
namespace Utils {
2+
const { join, resolve, dirname } = require("path") as typeof import("path");
3+
const { existsSync } = require("fs") as typeof import("fs");
44

55
// search directories upward to avoid hard-wired paths based on the
66
// build tree (same as scripts/build/findUpDir.js)
77

8-
export function findUpFile(name: string) {
8+
export function findUpFile(name: string): string {
99
let dir = __dirname;
1010
while (true) {
1111
const fullPath = join(dir, name);

src/harness/harnessIO.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ namespace Harness {
4141
export const virtualFileSystemRoot = "/";
4242

4343
function createNodeIO(): IO {
44+
const workspaceRoot = Utils.findUpRoot();
4445
let fs: any, pathModule: any;
4546
if (require) {
4647
fs = require("fs");
@@ -154,7 +155,7 @@ namespace Harness {
154155
log: s => console.log(s),
155156
args: () => ts.sys.args,
156157
getExecutingFilePath: () => ts.sys.getExecutingFilePath(),
157-
getWorkspaceRoot: () => vpath.resolve(__dirname, "../.."),
158+
getWorkspaceRoot: () => workspaceRoot,
158159
exit: exitCode => ts.sys.exit(exitCode),
159160
readDirectory: (path, extension, exclude, include, depth) => ts.sys.readDirectory(path, extension, exclude, include, depth),
160161
getAccessibleFileSystemEntries,

src/harness/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"evaluatorImpl.ts",
2929
"fakesHosts.ts",
3030
"client.ts",
31+
"findUpDir.ts",
3132

3233
"runnerbase.ts",
3334
"sourceMapRecorder.ts",

src/testRunner/parallel/host.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Harness.Parallel.Host {
1414
const { statSync } = require("fs") as typeof import("fs");
1515

1616
// NOTE: paths for module and types for FailedTestReporter _do not_ line up due to our use of --outFile for run.js
17-
const FailedTestReporter = require(path.resolve(__dirname, "../../scripts/failed-tests")) as typeof import("../../../scripts/failed-tests");
17+
const FailedTestReporter = require(Utils.findUpFile("scripts/failed-tests.js")) as typeof import("../../../scripts/failed-tests");
1818

1919
const perfdataFileNameFragment = ".parallelperf";
2020
const perfData = readSavedPerfData(configOption);

0 commit comments

Comments
 (0)