diff --git a/internal/api/encoder/encoder_test.go b/internal/api/encoder/encoder_test.go index 232c0fec37..0a20bf027e 100644 --- a/internal/api/encoder/encoder_test.go +++ b/internal/api/encoder/encoder_test.go @@ -55,7 +55,7 @@ func TestEncodeSourceFileWithUnicodeEscapes(t *testing.T) { func BenchmarkEncodeSourceFile(b *testing.B) { repo.SkipIfNoTypeScriptSubmodule(b) - filePath := filepath.Join(repo.TypeScriptSubmodulePath, "src/compiler/checker.ts") + filePath := filepath.Join(repo.TypeScriptSubmodulePath(), "src/compiler/checker.ts") fileContent, err := os.ReadFile(filePath) assert.NilError(b, err) sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{ diff --git a/internal/astnav/tokens_test.go b/internal/astnav/tokens_test.go index 0a0d180646..671f92280b 100644 --- a/internal/astnav/tokens_test.go +++ b/internal/astnav/tokens_test.go @@ -20,7 +20,7 @@ import ( ) var testFiles = []string{ - filepath.Join(repo.TypeScriptSubmodulePath, "src/services/mapCode.ts"), + filepath.Join(repo.TypeScriptSubmodulePath(), "src/services/mapCode.ts"), } func TestGetTokenAtPosition(t *testing.T) { diff --git a/internal/bundled/generate.go b/internal/bundled/generate.go index 28b64e3a15..28f8b56d31 100644 --- a/internal/bundled/generate.go +++ b/internal/bundled/generate.go @@ -21,8 +21,8 @@ import ( ) var ( - libInputDir = filepath.Join(repo.TypeScriptSubmodulePath, "src", "lib") - copyrightNotice = filepath.Join(repo.TypeScriptSubmodulePath, "scripts", "CopyrightNotice.txt") + libInputDir = filepath.Join(repo.TypeScriptSubmodulePath(), "src", "lib") + copyrightNotice = filepath.Join(repo.TypeScriptSubmodulePath(), "scripts", "CopyrightNotice.txt") ) func main() { diff --git a/internal/checker/checker_test.go b/internal/checker/checker_test.go index e46b994166..d611d3b9fa 100644 --- a/internal/checker/checker_test.go +++ b/internal/checker/checker_test.go @@ -66,7 +66,7 @@ func BenchmarkNewChecker(b *testing.B) { fs := osvfs.FS() fs = bundled.WrapFS(fs) - rootPath := tspath.CombinePaths(tspath.NormalizeSlashes(repo.TypeScriptSubmodulePath), "src", "compiler") + rootPath := tspath.CombinePaths(tspath.NormalizeSlashes(repo.TypeScriptSubmodulePath()), "src", "compiler") host := compiler.NewCompilerHost(rootPath, fs, bundled.LibPath(), nil, nil) parsed, errors := tsoptions.GetParsedCommandLineOfConfigFile(tspath.CombinePaths(rootPath, "tsconfig.json"), &core.CompilerOptions{}, nil, host, nil) diff --git a/internal/compiler/program_test.go b/internal/compiler/program_test.go index c4b2e6646a..80b6e0f72d 100644 --- a/internal/compiler/program_test.go +++ b/internal/compiler/program_test.go @@ -292,7 +292,7 @@ func BenchmarkNewProgram(b *testing.B) { b.Run("compiler", func(b *testing.B) { repo.SkipIfNoTypeScriptSubmodule(b) - rootPath := tspath.NormalizeSlashes(filepath.Join(repo.TypeScriptSubmodulePath, "src", "compiler")) + rootPath := tspath.NormalizeSlashes(filepath.Join(repo.TypeScriptSubmodulePath(), "src", "compiler")) fs := osvfs.FS() fs = bundled.WrapFS(fs) diff --git a/internal/diagnostics/generate.go b/internal/diagnostics/generate.go index a66d4fde69..a956278f38 100644 --- a/internal/diagnostics/generate.go +++ b/internal/diagnostics/generate.go @@ -81,7 +81,7 @@ func main() { return } - rawDiagnosticMessages := readRawMessages(filepath.Join(repo.TypeScriptSubmodulePath, "src", "compiler", "diagnosticMessages.json")) + rawDiagnosticMessages := readRawMessages(filepath.Join(repo.TypeScriptSubmodulePath(), "src", "compiler", "diagnosticMessages.json")) _, filename, _, ok := runtime.Caller(0) if !ok { @@ -198,12 +198,12 @@ func generateLocalizations(knownKeys map[string]bool, locDir string) *bytes.Buff } // Generate locale maps - localeFiles, err := filepath.Glob(filepath.Join(repo.TypeScriptSubmodulePath, "src", "loc", "lcl", "*", "diagnosticMessages", "diagnosticMessages.generated.json.lcl")) + localeFiles, err := filepath.Glob(filepath.Join(repo.TypeScriptSubmodulePath(), "src", "loc", "lcl", "*", "diagnosticMessages", "diagnosticMessages.generated.json.lcl")) if err != nil { log.Fatalf("failed to find locale files: %v", err) } if len(localeFiles) == 0 { - log.Fatalf("no locale files found in %s", filepath.Join(repo.TypeScriptSubmodulePath, "src", "loc", "lcl")) + log.Fatalf("no locale files found in %s", filepath.Join(repo.TypeScriptSubmodulePath(), "src", "loc", "lcl")) } slices.Sort(localeFiles) diff --git a/internal/format/api_test.go b/internal/format/api_test.go index 048d816f58..85566efaf0 100644 --- a/internal/format/api_test.go +++ b/internal/format/api_test.go @@ -51,7 +51,7 @@ func TestFormat(t *testing.T) { InsertSpaceBeforeTypeAnnotation: core.TSTrue, }, "\n") repo.SkipIfNoTypeScriptSubmodule(t) - filePath := filepath.Join(repo.TypeScriptSubmodulePath, "src/compiler/checker.ts") + filePath := filepath.Join(repo.TypeScriptSubmodulePath(), "src/compiler/checker.ts") fileContent, err := os.ReadFile(filePath) assert.NilError(t, err) text := string(fileContent) @@ -80,7 +80,7 @@ func BenchmarkFormat(b *testing.B) { InsertSpaceBeforeTypeAnnotation: core.TSTrue, }, "\n") repo.SkipIfNoTypeScriptSubmodule(b) - filePath := filepath.Join(repo.TypeScriptSubmodulePath, "src/compiler/checker.ts") + filePath := filepath.Join(repo.TypeScriptSubmodulePath(), "src/compiler/checker.ts") fileContent, err := os.ReadFile(filePath) assert.NilError(b, err) text := string(fileContent) diff --git a/internal/packagejson/packagejson_test.go b/internal/packagejson/packagejson_test.go index a2ab08ef5a..00f57ba6e3 100644 --- a/internal/packagejson/packagejson_test.go +++ b/internal/packagejson/packagejson_test.go @@ -17,8 +17,8 @@ import ( ) var packageJsonFixtures = []filefixture.Fixture{ - filefixture.FromFile("package.json", filepath.Join(repo.RootPath, "package.json")), - filefixture.FromFile("date-fns.json", filepath.Join(repo.TestDataPath, "fixtures", "packagejson", "date-fns.json")), + filefixture.FromFile("package.json", filepath.Join(repo.RootPath(), "package.json")), + filefixture.FromFile("date-fns.json", filepath.Join(repo.TestDataPath(), "fixtures", "packagejson", "date-fns.json")), } func BenchmarkPackageJSON(b *testing.B) { diff --git a/internal/parser/parser_test.go b/internal/parser/parser_test.go index b2f2b9a6e4..b685ba68d2 100644 --- a/internal/parser/parser_test.go +++ b/internal/parser/parser_test.go @@ -106,7 +106,7 @@ func FuzzParser(f *testing.F) { } for _, test := range tests { - root := filepath.Join(repo.TypeScriptSubmodulePath, test) + root := filepath.Join(repo.TypeScriptSubmodulePath(), test) for file := range allParsableFiles(f, root) { sourceText, err := os.ReadFile(file.path) @@ -117,9 +117,9 @@ func FuzzParser(f *testing.F) { } testDirs := []string{ - filepath.Join(repo.TypeScriptSubmodulePath, "tests/cases/compiler"), - filepath.Join(repo.TypeScriptSubmodulePath, "tests/cases/conformance"), - filepath.Join(repo.TestDataPath, "tests/cases/compiler"), + filepath.Join(repo.TypeScriptSubmodulePath(), "tests/cases/compiler"), + filepath.Join(repo.TypeScriptSubmodulePath(), "tests/cases/conformance"), + filepath.Join(repo.TestDataPath(), "tests/cases/compiler"), } for _, testDir := range testDirs { diff --git a/internal/repo/paths.go b/internal/repo/paths.go index 2d329b1b61..b3838389a0 100644 --- a/internal/repo/paths.go +++ b/internal/repo/paths.go @@ -4,39 +4,63 @@ import ( "os" "path/filepath" "runtime" + "strings" "sync" ) -var ( - RootPath string - TypeScriptSubmodulePath string - TestDataPath string -) - -func init() { +var rootPath = sync.OnceValue(func() string { _, filename, _, ok := runtime.Caller(0) if !ok { panic("could not get current filename") } filename = filepath.FromSlash(filename) // runtime.Caller always returns forward slashes; https://go.dev/issues/3335, https://go.dev/cl/603275 - RootPath = findGoMod(filepath.Dir(filename)) - TypeScriptSubmodulePath = filepath.Join(RootPath, "_submodules", "TypeScript") - TestDataPath = filepath.Join(RootPath, "testdata") -} -func findGoMod(dir string) string { - root := filepath.VolumeName(dir) - for dir != root { + if strings.HasPrefix(filename, "github.com/") { + panic("repo root cannot be found when built with -trimpath") + } + + if !filepath.IsAbs(filename) { + panic(filename + " is not an absolute path") + } + + root := filepath.VolumeName(filename) + string(filepath.Separator) + + dir := filepath.Dir(filename) + for { if _, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil { return dir } + if dir == root { + break + } dir = filepath.Dir(dir) } - panic("could not find go.mod") + + panic("could not find go.mod above " + filename) +}) + +func RootPath() string { + return rootPath() +} + +var typeScriptSubmodulePath = sync.OnceValue(func() string { + return filepath.Join(rootPath(), "_submodules", "TypeScript") +}) + +func TypeScriptSubmodulePath() string { + return typeScriptSubmodulePath() +} + +var testDataPath = sync.OnceValue(func() string { + return filepath.Join(rootPath(), "testdata") +}) + +func TestDataPath() string { + return testDataPath() } var typeScriptSubmoduleExists = sync.OnceValue(func() bool { - p := filepath.Join(TypeScriptSubmodulePath, "package.json") + p := filepath.Join(typeScriptSubmodulePath(), "package.json") if _, err := os.Stat(p); err != nil { if os.IsNotExist(err) { return false diff --git a/internal/testrunner/compiler_runner.go b/internal/testrunner/compiler_runner.go index 54ece44da7..8acd489bae 100644 --- a/internal/testrunner/compiler_runner.go +++ b/internal/testrunner/compiler_runner.go @@ -119,7 +119,7 @@ func (r *CompilerBaselineRunner) RunTests(t *testing.T) { } } -var localBasePath = filepath.Join(repo.TestDataPath, "baselines", "local") +var localBasePath = filepath.Join(repo.TestDataPath(), "baselines", "local") func (r *CompilerBaselineRunner) cleanUpLocal(t *testing.T) { localPath := filepath.Join(localBasePath, core.IfElse(r.isSubmodule, "diff", ""), r.testSuitName) @@ -402,7 +402,7 @@ func (c *compilerTest) verifyJavaScriptOutput(t *testing.T, suiteName string, is } defer testutil.RecoverAndFail(t, "Panic on creating js output for test "+c.filename) - headerComponents := tspath.GetPathComponentsRelativeTo(repo.TestDataPath, c.filename, tspath.ComparePathsOptions{}) + headerComponents := tspath.GetPathComponentsRelativeTo(repo.TestDataPath(), c.filename, tspath.ComparePathsOptions{}) if isSubmodule { headerComponents = headerComponents[4:] // Strip "./../_submodules/TypeScript" prefix } @@ -425,7 +425,7 @@ func (c *compilerTest) verifyJavaScriptOutput(t *testing.T, suiteName string, is func (c *compilerTest) verifySourceMapOutput(t *testing.T, suiteName string, isSubmodule bool) { t.Run("sourcemap", func(t *testing.T) { defer testutil.RecoverAndFail(t, "Panic on creating source map output for test "+c.filename) - headerComponents := tspath.GetPathComponentsRelativeTo(repo.TestDataPath, c.filename, tspath.ComparePathsOptions{}) + headerComponents := tspath.GetPathComponentsRelativeTo(repo.TestDataPath(), c.filename, tspath.ComparePathsOptions{}) if isSubmodule { headerComponents = headerComponents[4:] // Strip "./../_submodules/TypeScript" prefix } @@ -445,7 +445,7 @@ func (c *compilerTest) verifySourceMapOutput(t *testing.T, suiteName string, isS func (c *compilerTest) verifySourceMapRecord(t *testing.T, suiteName string, isSubmodule bool) { t.Run("sourcemap record", func(t *testing.T) { defer testutil.RecoverAndFail(t, "Panic on creating source map record for test "+c.filename) - headerComponents := tspath.GetPathComponentsRelativeTo(repo.TestDataPath, c.filename, tspath.ComparePathsOptions{}) + headerComponents := tspath.GetPathComponentsRelativeTo(repo.TestDataPath(), c.filename, tspath.ComparePathsOptions{}) if isSubmodule { headerComponents = headerComponents[4:] // Strip "./../_submodules/TypeScript" prefix } @@ -475,7 +475,7 @@ func (c *compilerTest) verifyTypesAndSymbols(t *testing.T, suiteName string, isS }, ) - headerComponents := tspath.GetPathComponentsRelativeTo(repo.TestDataPath, c.filename, tspath.ComparePathsOptions{}) + headerComponents := tspath.GetPathComponentsRelativeTo(repo.TestDataPath(), c.filename, tspath.ComparePathsOptions{}) if isSubmodule { headerComponents = headerComponents[4:] // Strip "./../_submodules/TypeScript" prefix } diff --git a/internal/testutil/baseline/baseline.go b/internal/testutil/baseline/baseline.go index ff6cf23c4b..b391c32e0f 100644 --- a/internal/testutil/baseline/baseline.go +++ b/internal/testutil/baseline/baseline.go @@ -80,7 +80,7 @@ func Run(t *testing.T, fileName string, actual string, opts Options) { var submoduleAcceptedFileNames = sync.OnceValue(func() *collections.Set[string] { var set collections.Set[string] - submoduleAccepted := filepath.Join(repo.TestDataPath, "submoduleAccepted.txt") + submoduleAccepted := filepath.Join(repo.TestDataPath(), "submoduleAccepted.txt") if content, err := os.ReadFile(submoduleAccepted); err == nil { for line := range strings.SplitSeq(string(content), "\n") { line = strings.TrimSpace(line) @@ -214,7 +214,7 @@ func writeComparison(t *testing.T, actualContent string, local, reference string } var ( - localRoot = filepath.Join(repo.TestDataPath, "baselines", "local") - referenceRoot = filepath.Join(repo.TestDataPath, "baselines", "reference") - submoduleReferenceRoot = filepath.Join(repo.TypeScriptSubmodulePath, "tests", "baselines", "reference") + localRoot = filepath.Join(repo.TestDataPath(), "baselines", "local") + referenceRoot = filepath.Join(repo.TestDataPath(), "baselines", "reference") + submoduleReferenceRoot = filepath.Join(repo.TypeScriptSubmodulePath(), "tests", "baselines", "reference") ) diff --git a/internal/testutil/fixtures/benchfixtures.go b/internal/testutil/fixtures/benchfixtures.go index a1d8dc9034..8b54a2c73b 100644 --- a/internal/testutil/fixtures/benchfixtures.go +++ b/internal/testutil/fixtures/benchfixtures.go @@ -9,8 +9,8 @@ import ( var BenchFixtures = []filefixture.Fixture{ filefixture.FromString("empty.ts", "empty.ts", ""), - filefixture.FromFile("checker.ts", filepath.Join(repo.TypeScriptSubmodulePath, "src/compiler/checker.ts")), - filefixture.FromFile("dom.generated.d.ts", filepath.Join(repo.TypeScriptSubmodulePath, "src/lib/dom.generated.d.ts")), - filefixture.FromFile("Herebyfile.mjs", filepath.Join(repo.TypeScriptSubmodulePath, "Herebyfile.mjs")), - filefixture.FromFile("jsxComplexSignatureHasApplicabilityError.tsx", filepath.Join(repo.TypeScriptSubmodulePath, "tests/cases/compiler/jsxComplexSignatureHasApplicabilityError.tsx")), + filefixture.FromFile("checker.ts", filepath.Join(repo.TypeScriptSubmodulePath(), "src/compiler/checker.ts")), + filefixture.FromFile("dom.generated.d.ts", filepath.Join(repo.TypeScriptSubmodulePath(), "src/lib/dom.generated.d.ts")), + filefixture.FromFile("Herebyfile.mjs", filepath.Join(repo.TypeScriptSubmodulePath(), "Herebyfile.mjs")), + filefixture.FromFile("jsxComplexSignatureHasApplicabilityError.tsx", filepath.Join(repo.TypeScriptSubmodulePath(), "tests/cases/compiler/jsxComplexSignatureHasApplicabilityError.tsx")), } diff --git a/internal/testutil/harnessutil/harnessutil.go b/internal/testutil/harnessutil/harnessutil.go index 482552a77a..3ba617b384 100644 --- a/internal/testutil/harnessutil/harnessutil.go +++ b/internal/testutil/harnessutil/harnessutil.go @@ -239,7 +239,7 @@ func CompileFilesEx( var testLibFolderMap = sync.OnceValue(func() map[string]any { testfs := make(map[string]any) - libfs := os.DirFS(filepath.Join(repo.TypeScriptSubmodulePath, "tests", "lib")) + libfs := os.DirFS(filepath.Join(repo.TypeScriptSubmodulePath(), "tests", "lib")) err := fs.WalkDir(libfs, ".", func(path string, d fs.DirEntry, err error) error { if err != nil { return err @@ -971,7 +971,7 @@ func listFiles(path string, spec *regexp.Regexp, recursive bool) ([]string, erro } func listFilesWorker(spec *regexp.Regexp, recursive bool, folder string) ([]string, error) { - folder = tspath.GetNormalizedAbsolutePath(folder, repo.TestDataPath) + folder = tspath.GetNormalizedAbsolutePath(folder, repo.TestDataPath()) entries, err := os.ReadDir(folder) if err != nil { return nil, err diff --git a/internal/testutil/jstest/node.go b/internal/testutil/jstest/node.go index 4eb3cd29b4..ebc8833f1e 100644 --- a/internal/testutil/jstest/node.go +++ b/internal/testutil/jstest/node.go @@ -38,7 +38,7 @@ func EvalNodeScriptWithTS[T any](t testing.TB, script string, dir string, args . if dir == "" { dir = t.TempDir() } - tsSrc := tspath.NormalizePath(filepath.Join(repo.RootPath, "node_modules/typescript/lib/typescript.js")) + tsSrc := tspath.NormalizePath(filepath.Join(repo.RootPath(), "node_modules/typescript/lib/typescript.js")) if tsSrc[0] == '/' { tsSrc = "file://" + tsSrc } else { diff --git a/internal/tsoptions/commandlineparser_test.go b/internal/tsoptions/commandlineparser_test.go index 7e5347b51c..4586a29135 100644 --- a/internal/tsoptions/commandlineparser_test.go +++ b/internal/tsoptions/commandlineparser_test.go @@ -312,7 +312,7 @@ func (f commandLineSubScenario) assertBuildParseResultWithTsBaseline(t *testing. // f.workerDiagnostic is either defined or set to default pointer in `createSubScenario` parsed := tsoptions.ParseBuildCommandLine(f.commandLine, &tsoptionstest.VfsParseConfigHost{ Vfs: osvfs.FS(), - CurrentDirectory: tspath.NormalizeSlashes(repo.TypeScriptSubmodulePath), + CurrentDirectory: tspath.NormalizeSlashes(repo.TypeScriptSubmodulePath()), }) newBaselineProjects := strings.Join(parsed.Projects, ",") @@ -416,7 +416,7 @@ func createSubScenario(scenarioKind string, subScenarioName string, commandline baselineFileName := "tests/baselines/reference/config/commandLineParsing/" + subScenarioName + ".js" result := &commandLineSubScenario{ - filefixture.FromFile(subScenarioName, filepath.Join(repo.TypeScriptSubmodulePath, baselineFileName)), + filefixture.FromFile(subScenarioName, filepath.Join(repo.TypeScriptSubmodulePath(), baselineFileName)), subScenarioName, commandline, nil, diff --git a/internal/tsoptions/tsconfigparsing_test.go b/internal/tsoptions/tsconfigparsing_test.go index 8c371ef34a..47328e16e7 100644 --- a/internal/tsoptions/tsconfigparsing_test.go +++ b/internal/tsoptions/tsconfigparsing_test.go @@ -1008,7 +1008,7 @@ func TestParseSrcCompiler(t *testing.T) { repo.SkipIfNoTypeScriptSubmodule(t) - compilerDir := tspath.NormalizeSlashes(filepath.Join(repo.TypeScriptSubmodulePath, "src", "compiler")) + compilerDir := tspath.NormalizeSlashes(filepath.Join(repo.TypeScriptSubmodulePath(), "src", "compiler")) tsconfigFileName := tspath.CombinePaths(compilerDir, "tsconfig.json") fs := osvfs.FS() @@ -1061,7 +1061,7 @@ func TestParseSrcCompiler(t *testing.T) { Module: core.ModuleKindNodeNext, ModuleResolution: core.ModuleResolutionKindNodeNext, NewLine: core.NewLineKindLF, - OutDir: tspath.NormalizeSlashes(filepath.Join(repo.TypeScriptSubmodulePath, "built", "local")), + OutDir: tspath.NormalizeSlashes(filepath.Join(repo.TypeScriptSubmodulePath(), "built", "local")), Target: core.ScriptTargetES2020, Types: []string{"node"}, ConfigFilePath: tsconfigFileName, @@ -1073,7 +1073,7 @@ func TestParseSrcCompiler(t *testing.T) { IsolatedDeclarations: core.TSTrue, NoImplicitOverride: core.TSTrue, PreserveConstEnums: core.TSTrue, - RootDir: tspath.NormalizeSlashes(filepath.Join(repo.TypeScriptSubmodulePath, "src")), + RootDir: tspath.NormalizeSlashes(filepath.Join(repo.TypeScriptSubmodulePath(), "src")), SkipLibCheck: core.TSTrue, Strict: core.TSTrue, StrictBindCallApply: core.TSFalse, @@ -1177,7 +1177,7 @@ func TestParseSrcCompiler(t *testing.T) { func BenchmarkParseSrcCompiler(b *testing.B) { repo.SkipIfNoTypeScriptSubmodule(b) - compilerDir := tspath.NormalizeSlashes(filepath.Join(repo.TypeScriptSubmodulePath, "src", "compiler")) + compilerDir := tspath.NormalizeSlashes(filepath.Join(repo.TypeScriptSubmodulePath(), "src", "compiler")) tsconfigFileName := tspath.CombinePaths(compilerDir, "tsconfig.json") fs := osvfs.FS() diff --git a/internal/vfs/osvfs/os_test.go b/internal/vfs/osvfs/os_test.go index 7f9b7e2ed4..4acc7d55ca 100644 --- a/internal/vfs/osvfs/os_test.go +++ b/internal/vfs/osvfs/os_test.go @@ -21,7 +21,7 @@ func TestOS(t *testing.T) { t.Run("ReadFile", func(t *testing.T) { t.Parallel() - goMod := filepath.Join(repo.RootPath, "go.mod") + goMod := filepath.Join(repo.RootPath(), "go.mod") goModPath := tspath.NormalizePath(goMod) expectedRaw, err := os.ReadFile(goMod) diff --git a/internal/vfs/vfs_test.go b/internal/vfs/vfs_test.go index 81de1b5178..d125daa148 100644 --- a/internal/vfs/vfs_test.go +++ b/internal/vfs/vfs_test.go @@ -37,7 +37,7 @@ func BenchmarkReadFile(b *testing.B) { } if repo.TypeScriptSubmoduleExists() { - checkerPath := tspath.CombinePaths(tspath.NormalizeSlashes(repo.TypeScriptSubmodulePath), "src", "compiler", "checker.ts") + checkerPath := tspath.CombinePaths(tspath.NormalizeSlashes(repo.TypeScriptSubmodulePath()), "src", "compiler", "checker.ts") checkerContents, ok := osFS.ReadFile(checkerPath) assert.Assert(b, ok)