fix(windows): normalize native coverage tests
This commit is contained in:
@@ -2507,9 +2507,10 @@ function mergeWorkspaceModels(models: readonly WorkspaceModel[]): WorkspaceModel
|
||||
}
|
||||
|
||||
function parseConfig(path: string): ParsedConfig {
|
||||
const read = ts.readConfigFile(path, file => ts.sys.readFile(file))
|
||||
const compilerPath = path.split(sep).join('/')
|
||||
const read = ts.readConfigFile(compilerPath, file => ts.sys.readFile(file))
|
||||
if (read.error !== undefined) throw new TypertAnalysisError(formatDiagnostic(read.error))
|
||||
const parsed = ts.parseJsonConfigFileContent(read.config, ts.sys, dirname(path), undefined, path)
|
||||
const parsed = ts.parseJsonConfigFileContent(read.config, ts.sys, dirname(compilerPath), undefined, compilerPath)
|
||||
if (parsed.errors.length > 0) throw new TypertAnalysisError(parsed.errors.map(formatDiagnostic).join('\n'))
|
||||
return { path, parsed }
|
||||
}
|
||||
|
||||
@@ -10,6 +10,10 @@ import { WorkspaceTypertGenerator } from '../src/workspace.ts'
|
||||
const fixtureRoot = resolve(import.meta.dirname, 'fixtures/remote-model')
|
||||
const temporaryRoots: string[] = []
|
||||
|
||||
function normalizedPath(path: string): string {
|
||||
return path.replaceAll('\\', '/')
|
||||
}
|
||||
|
||||
interface RuntimeSchema {
|
||||
safeParse(value: unknown): { readonly success: boolean }
|
||||
}
|
||||
@@ -646,7 +650,8 @@ void navigated
|
||||
const navigation = 'ctx.remote.goals.create'
|
||||
const position = consumerSource.indexOf(navigation) + navigation.lastIndexOf('create') + 1
|
||||
const definitions = languageService.getDefinitionAtPosition(consumerPath, position)
|
||||
const generatedDefinition = definitions?.find(candidate => candidate.fileName === declarationPath)
|
||||
const generatedDefinition = definitions?.find(candidate =>
|
||||
normalizedPath(candidate.fileName) === normalizedPath(declarationPath))
|
||||
if (generatedDefinition === undefined) {
|
||||
throw new Error(`generated Remote definition not found: ${JSON.stringify(definitions, null, 2)}`)
|
||||
}
|
||||
@@ -661,7 +666,7 @@ void navigated
|
||||
pos: generatedDefinition.textSpan.start,
|
||||
})
|
||||
languageService.dispose()
|
||||
if (definition === undefined || !definition.fileName.endsWith('/packages/remote/src/index.ts')) {
|
||||
if (definition === undefined || !normalizedPath(definition.fileName).endsWith('/packages/remote/src/index.ts')) {
|
||||
throw new Error(`generated Remote definition did not map to its Host source: ${JSON.stringify(definition)}`)
|
||||
}
|
||||
const hostSource = readFileSync(join(consumerRoot, 'packages/remote/src/index.ts'), 'utf8')
|
||||
|
||||
@@ -18,6 +18,11 @@ import { WorkspaceTypertGenerator } from '../src/workspace.ts'
|
||||
|
||||
const fixtureRoot = resolve(import.meta.dirname, 'fixtures/type-model')
|
||||
const temporaryRoots: string[] = []
|
||||
|
||||
function normalizedPath(path: string): string {
|
||||
return path.replaceAll('\\', '/')
|
||||
}
|
||||
|
||||
const parseConfigHost: ts.ParseConfigFileHost = {
|
||||
...ts.sys,
|
||||
onUnRecoverableConfigFileDiagnostic(diagnostic) {
|
||||
@@ -733,8 +738,8 @@ describe('WorkspaceAnalyzer', { timeout: 60_000 }, () => {
|
||||
rootNames: packageConfig.fileNames,
|
||||
options: aggregateConfig.options,
|
||||
})
|
||||
expect(diagnosticProgram.getSourceFiles().map(source => source.fileName))
|
||||
.toContain(join(externalRoot, 'index.d.ts'))
|
||||
expect(diagnosticProgram.getSourceFiles().map(source => normalizedPath(source.fileName)))
|
||||
.toContain(normalizedPath(join(externalRoot, 'index.d.ts')))
|
||||
|
||||
const targets = new WorkspaceAnalyzer({ root }).analyze().faces
|
||||
.flatMap(face => face.graph.nodes)
|
||||
|
||||
Reference in New Issue
Block a user