Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cli_support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function pathToModuleName(context: string, fileName: string): string {
}
// Replace characters not supported by goog.module.
let moduleName =
fileName.replace(/\//g, '.').replace(/^[^a-zA-Z_$]/, '_').replace(/[^a-zA-Z0-9._$]/g, '_');
fileName.replace(/\/|\\/g, '.').replace(/^[^a-zA-Z_$]/, '_').replace(/[^a-zA-Z0-9._$]/g, '_');

return moduleName;
}
4 changes: 2 additions & 2 deletions test/test_support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const {cachedLibPath, cachedLib} = (function() {
let fn = host.getDefaultLibFileName(compilerOptions);
let p = ts.getDefaultLibFilePath(compilerOptions);
return {
// Normalize path to fix mixed/wrong directory separators on windows.
// Normalize path to fix mixed/wrong directory separators on Windows.
cachedLibPath: path.normalize(p),
cachedLib: host.getSourceFile(fn, ts.ScriptTarget.ES2015)
};
Expand All @@ -51,7 +51,7 @@ export function createProgram(sources: Map<string, string>): ts.Program {
host.getSourceFile = function(
fileName: string, languageVersion: ts.ScriptTarget,
onError?: (msg: string) => void): ts.SourceFile {
// Normalize path to fix wrong directory separators on windows which
// Normalize path to fix wrong directory separators on Windows which
// would break the equality check.
fileName = path.normalize(fileName);
if (fileName === cachedLibPath) return cachedLib;
Expand Down
6 changes: 5 additions & 1 deletion test/tsickle_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ function compareAgainstGolden(output: string|null, path: string) {
}
}

// Make sure we have proper line endings when testing on Windows.
if (golden != null) golden = golden.replace(/\r\n/g, '\n');
if (output != null) output = output.replace(/\r\n/g, '\n');

if (UPDATE_GOLDENS && output !== golden) {
console.log('Updating golden file for', path);
if (output !== null) {
Expand Down Expand Up @@ -137,7 +141,7 @@ testFn('golden tests', () => {
(context, importPath) => {
importPath = importPath.replace(/(\.d)?\.[tj]s$/, '');
if (importPath[0] === '.') importPath = path.join(path.dirname(context), importPath);
return importPath.replace(/\//g, '.');
return importPath.replace(/\/|\\/g, '.');
},
options, {
fileExists: ts.sys.fileExists,
Expand Down