2015-08-18 03:31:12 +02:00
/// <reference path="..\..\..\src\harness\external\mocha.d.ts" />
/// <reference path='..\..\..\src\harness\harness.ts' />
declare namespace chai . assert {
function deepEqual ( actual : any , expected : any ) : void ;
}
module ts {
2015-10-15 23:43:51 +02:00
function diagnosticToString ( diagnostic : Diagnostic ) {
let output = "" ;
if ( diagnostic . file ) {
let loc = getLineAndCharacterOfPosition ( diagnostic . file , diagnostic . start ) ;
output += ` ${ diagnostic . file . fileName } ( ${ loc . line + 1 } , ${ loc . character + 1 } ): ` ;
}
let category = DiagnosticCategory [ diagnostic . category ] . toLowerCase ( ) ;
output += ` ${ category } TS ${ diagnostic . code } : ${ flattenDiagnosticMessageText ( diagnostic . messageText , sys . newLine ) } ${ sys . newLine } ` ;
return output ;
}
2015-08-21 19:57:36 +02:00
2015-08-18 03:31:12 +02:00
interface File {
name : string
2015-10-15 23:43:51 +02:00
content? : string
2015-08-18 03:31:12 +02:00
}
function createModuleResolutionHost ( . . . files : File [ ] ) : ModuleResolutionHost {
2015-08-21 19:57:36 +02:00
let map = arrayToMap ( files , f = > f . name ) ;
2015-10-15 23:43:51 +02:00
2015-08-18 03:31:12 +02:00
return { fileExists , readFile } ;
2015-10-15 23:43:51 +02:00
2015-08-18 03:31:12 +02:00
function fileExists ( path : string ) : boolean {
2015-08-21 19:57:36 +02:00
return hasProperty ( map , path ) ;
2015-08-18 03:31:12 +02:00
}
2015-10-15 23:43:51 +02:00
2015-08-18 03:31:12 +02:00
function readFile ( path : string ) : string {
2015-08-21 19:57:36 +02:00
return hasProperty ( map , path ) ? map [ path ] . content : undefined ;
2015-08-18 03:31:12 +02:00
}
}
2015-08-18 22:36:08 +02:00
2015-08-18 03:31:12 +02:00
function splitPath ( path : string ) : { dir : string ; rel : string } {
let index = path . indexOf ( directorySeparator ) ;
2015-10-15 23:43:51 +02:00
return index === - 1
2015-08-18 03:31:12 +02:00
? { dir : path , rel : undefined }
: { dir : path.substr ( 0 , index ) , rel : path.substr ( index + 1 ) } ;
}
describe ( "Node module resolution - relative paths" , ( ) = > {
2015-10-15 23:43:51 +02:00
2015-08-18 03:31:12 +02:00
function testLoadAsFile ( containingFileName : string , moduleFileNameNoExt : string , moduleName : string ) : void {
2015-09-22 00:39:53 +02:00
for ( let ext of supportedTypeScriptExtensions ) {
2015-08-21 01:13:49 +02:00
let containingFile = { name : containingFileName }
2015-10-29 00:24:53 +01:00
let moduleFile = { name : moduleFileNameNoExt + ext }
2015-10-30 17:34:32 +01:00
let resolution = nodeModuleNameResolver ( moduleName , containingFile . name , supportedTypeScriptExtensions , createModuleResolutionHost ( containingFile , moduleFile ) ) ;
2015-09-10 20:36:31 +02:00
assert . equal ( resolution . resolvedModule . resolvedFileName , moduleFile . name ) ;
2015-09-11 02:00:29 +02:00
assert . equal ( ! ! resolution . resolvedModule . isExternalLibraryImport , false ) ;
2015-09-10 20:36:31 +02:00
2015-08-21 01:13:49 +02:00
let failedLookupLocations : string [ ] = [ ] ;
let dir = getDirectoryPath ( containingFileName ) ;
2015-09-22 00:39:53 +02:00
for ( let e of supportedTypeScriptExtensions ) {
2015-08-21 01:13:49 +02:00
if ( e === ext ) {
break ;
}
else {
2015-10-29 00:24:53 +01:00
failedLookupLocations . push ( normalizePath ( getRootLength ( moduleName ) === 0 ? combinePaths ( dir , moduleName ) : moduleName ) + e ) ;
2015-08-21 01:13:49 +02:00
}
}
2015-10-15 23:43:51 +02:00
2015-08-21 01:13:49 +02:00
assert . deepEqual ( resolution . failedLookupLocations , failedLookupLocations ) ;
2015-08-18 03:31:12 +02:00
}
}
2015-10-15 23:43:51 +02:00
2015-08-18 03:31:12 +02:00
it ( "module name that starts with './' resolved as relative file name" , ( ) = > {
testLoadAsFile ( "/foo/bar/baz.ts" , "/foo/bar/foo" , "./foo" ) ;
} ) ;
it ( "module name that starts with '../' resolved as relative file name" , ( ) = > {
testLoadAsFile ( "/foo/bar/baz.ts" , "/foo/foo" , "../foo" ) ;
} ) ;
it ( "module name that starts with '/' script extension resolved as relative file name" , ( ) = > {
testLoadAsFile ( "/foo/bar/baz.ts" , "/foo" , "/foo" ) ;
} ) ;
2015-08-18 22:36:08 +02:00
it ( "module name that starts with 'c:/' script extension resolved as relative file name" , ( ) = > {
testLoadAsFile ( "c:/foo/bar/baz.ts" , "c:/foo" , "c:/foo" ) ;
} ) ;
2015-10-15 23:43:51 +02:00
2015-08-21 01:13:49 +02:00
function testLoadingFromPackageJson ( containingFileName : string , packageJsonFileName : string , fieldRef : string , moduleFileName : string , moduleName : string ) : void {
2015-08-18 03:31:12 +02:00
let containingFile = { name : containingFileName } ;
2015-08-21 01:13:49 +02:00
let packageJson = { name : packageJsonFileName , content : JSON.stringify ( { "typings" : fieldRef } ) } ;
2015-08-18 03:31:12 +02:00
let moduleFile = { name : moduleFileName } ;
2015-09-22 00:39:53 +02:00
let resolution = nodeModuleNameResolver ( moduleName , containingFile . name , supportedTypeScriptExtensions , createModuleResolutionHost ( containingFile , packageJson , moduleFile ) ) ;
2015-09-10 20:36:31 +02:00
assert . equal ( resolution . resolvedModule . resolvedFileName , moduleFile . name ) ;
2015-09-11 02:00:29 +02:00
assert . equal ( ! ! resolution . resolvedModule . isExternalLibraryImport , false ) ;
2015-08-21 01:13:49 +02:00
// expect three failed lookup location - attempt to load module as file with all supported extensions
2015-09-22 00:39:53 +02:00
assert . equal ( resolution . failedLookupLocations . length , supportedTypeScriptExtensions . length ) ;
2015-08-18 03:31:12 +02:00
}
2015-10-15 23:43:51 +02:00
2015-08-18 03:31:12 +02:00
it ( "module name as directory - load from typings" , ( ) = > {
2015-08-21 01:13:49 +02:00
testLoadingFromPackageJson ( "/a/b/c/d.ts" , "/a/b/c/bar/package.json" , "c/d/e.d.ts" , "/a/b/c/bar/c/d/e.d.ts" , "./bar" ) ;
testLoadingFromPackageJson ( "/a/b/c/d.ts" , "/a/bar/package.json" , "e.d.ts" , "/a/bar/e.d.ts" , "../../bar" ) ;
testLoadingFromPackageJson ( "/a/b/c/d.ts" , "/bar/package.json" , "e.d.ts" , "/bar/e.d.ts" , "/bar" ) ;
testLoadingFromPackageJson ( "c:/a/b/c/d.ts" , "c:/bar/package.json" , "e.d.ts" , "c:/bar/e.d.ts" , "c:/bar" ) ;
2015-08-18 03:31:12 +02:00
} ) ;
2015-10-15 23:43:51 +02:00
it ( "module name as directory - load index.d.ts" , ( ) = > {
let containingFile = { name : "/a/b/c.ts" } ;
let packageJson = { name : "/a/b/foo/package.json" , content : JSON.stringify ( { main : "/c/d" } ) } ;
2015-08-18 03:31:12 +02:00
let indexFile = { name : "/a/b/foo/index.d.ts" } ;
2015-09-22 00:39:53 +02:00
let resolution = nodeModuleNameResolver ( "./foo" , containingFile . name , supportedTypeScriptExtensions , createModuleResolutionHost ( containingFile , packageJson , indexFile ) ) ;
2015-09-10 20:36:31 +02:00
assert . equal ( resolution . resolvedModule . resolvedFileName , indexFile . name ) ;
2015-09-11 02:00:29 +02:00
assert . equal ( ! ! resolution . resolvedModule . isExternalLibraryImport , false ) ;
2015-08-18 03:31:12 +02:00
assert . deepEqual ( resolution . failedLookupLocations , [
2015-08-21 01:13:49 +02:00
"/a/b/foo.ts" ,
"/a/b/foo.tsx" ,
"/a/b/foo.d.ts" ,
"/a/b/foo/index.ts" ,
"/a/b/foo/index.tsx" ,
2015-08-18 03:31:12 +02:00
] ) ;
} ) ;
} ) ;
2015-10-15 23:43:51 +02:00
2015-08-18 03:31:12 +02:00
describe ( "Node module resolution - non-relative paths" , ( ) = > {
it ( "load module as file - ts files not loaded" , ( ) = > {
let containingFile = { name : "/a/b/c/d/e.ts" } ;
let moduleFile = { name : "/a/b/node_modules/foo.ts" } ;
2015-09-22 00:39:53 +02:00
let resolution = nodeModuleNameResolver ( "foo" , containingFile . name , supportedTypeScriptExtensions , createModuleResolutionHost ( containingFile , moduleFile ) ) ;
2015-09-22 01:10:03 +02:00
assert . equal ( resolution . resolvedModule . resolvedFileName , moduleFile . name ) ;
2015-08-18 03:31:12 +02:00
assert . deepEqual ( resolution . failedLookupLocations , [
2015-09-22 01:10:03 +02:00
"/a/b/c/d/node_modules/foo.ts" ,
"/a/b/c/d/node_modules/foo.tsx" ,
2015-08-18 03:31:12 +02:00
"/a/b/c/d/node_modules/foo.d.ts" ,
"/a/b/c/d/node_modules/foo/package.json" ,
2015-09-22 01:10:03 +02:00
"/a/b/c/d/node_modules/foo/index.ts" ,
"/a/b/c/d/node_modules/foo/index.tsx" ,
2015-08-18 03:31:12 +02:00
"/a/b/c/d/node_modules/foo/index.d.ts" ,
2015-09-22 01:10:03 +02:00
"/a/b/c/node_modules/foo.ts" ,
"/a/b/c/node_modules/foo.tsx" ,
2015-08-18 03:31:12 +02:00
"/a/b/c/node_modules/foo.d.ts" ,
"/a/b/c/node_modules/foo/package.json" ,
2015-09-22 01:10:03 +02:00
"/a/b/c/node_modules/foo/index.ts" ,
"/a/b/c/node_modules/foo/index.tsx" ,
"/a/b/c/node_modules/foo/index.d.ts"
2015-08-18 03:31:12 +02:00
] )
} ) ;
it ( "load module as file" , ( ) = > {
let containingFile = { name : "/a/b/c/d/e.ts" } ;
let moduleFile = { name : "/a/b/node_modules/foo.d.ts" } ;
2015-09-22 00:39:53 +02:00
let resolution = nodeModuleNameResolver ( "foo" , containingFile . name , supportedTypeScriptExtensions , createModuleResolutionHost ( containingFile , moduleFile ) ) ;
2015-09-10 20:36:31 +02:00
assert . equal ( resolution . resolvedModule . resolvedFileName , moduleFile . name ) ;
2015-09-11 02:00:29 +02:00
assert . equal ( resolution . resolvedModule . isExternalLibraryImport , true ) ;
2015-08-18 03:31:12 +02:00
} ) ;
2015-10-15 23:43:51 +02:00
2015-08-18 03:31:12 +02:00
it ( "load module as directory" , ( ) = > {
let containingFile = { name : "/a/node_modules/b/c/node_modules/d/e.ts" } ;
let moduleFile = { name : "/a/node_modules/foo/index.d.ts" } ;
2015-09-22 00:39:53 +02:00
let resolution = nodeModuleNameResolver ( "foo" , containingFile . name , supportedTypeScriptExtensions , createModuleResolutionHost ( containingFile , moduleFile ) ) ;
2015-09-10 20:36:31 +02:00
assert . equal ( resolution . resolvedModule . resolvedFileName , moduleFile . name ) ;
2015-09-11 02:00:29 +02:00
assert . equal ( resolution . resolvedModule . isExternalLibraryImport , true ) ;
2015-08-18 03:31:12 +02:00
assert . deepEqual ( resolution . failedLookupLocations , [
2015-09-22 01:10:03 +02:00
"/a/node_modules/b/c/node_modules/d/node_modules/foo.ts" ,
"/a/node_modules/b/c/node_modules/d/node_modules/foo.tsx" ,
2015-08-18 03:31:12 +02:00
"/a/node_modules/b/c/node_modules/d/node_modules/foo.d.ts" ,
"/a/node_modules/b/c/node_modules/d/node_modules/foo/package.json" ,
2015-09-22 01:10:03 +02:00
"/a/node_modules/b/c/node_modules/d/node_modules/foo/index.ts" ,
"/a/node_modules/b/c/node_modules/d/node_modules/foo/index.tsx" ,
2015-08-18 03:31:12 +02:00
"/a/node_modules/b/c/node_modules/d/node_modules/foo/index.d.ts" ,
2015-09-22 01:10:03 +02:00
"/a/node_modules/b/c/node_modules/foo.ts" ,
"/a/node_modules/b/c/node_modules/foo.tsx" ,
2015-08-18 03:31:12 +02:00
"/a/node_modules/b/c/node_modules/foo.d.ts" ,
"/a/node_modules/b/c/node_modules/foo/package.json" ,
2015-09-22 01:10:03 +02:00
"/a/node_modules/b/c/node_modules/foo/index.ts" ,
"/a/node_modules/b/c/node_modules/foo/index.tsx" ,
2015-08-18 03:31:12 +02:00
"/a/node_modules/b/c/node_modules/foo/index.d.ts" ,
2015-09-22 01:10:03 +02:00
"/a/node_modules/b/node_modules/foo.ts" ,
"/a/node_modules/b/node_modules/foo.tsx" ,
2015-08-18 03:31:12 +02:00
"/a/node_modules/b/node_modules/foo.d.ts" ,
"/a/node_modules/b/node_modules/foo/package.json" ,
2015-09-22 01:10:03 +02:00
"/a/node_modules/b/node_modules/foo/index.ts" ,
"/a/node_modules/b/node_modules/foo/index.tsx" ,
2015-08-18 03:31:12 +02:00
"/a/node_modules/b/node_modules/foo/index.d.ts" ,
2015-09-22 01:10:03 +02:00
"/a/node_modules/foo.ts" ,
"/a/node_modules/foo.tsx" ,
2015-08-18 03:31:12 +02:00
"/a/node_modules/foo.d.ts" ,
2015-09-22 01:10:03 +02:00
"/a/node_modules/foo/package.json" ,
"/a/node_modules/foo/index.ts" ,
"/a/node_modules/foo/index.tsx"
2015-08-18 03:31:12 +02:00
] ) ;
} ) ;
} ) ;
2015-10-15 23:43:51 +02:00
2015-09-27 06:29:07 +02:00
describe ( "Module resolution - relative imports" , ( ) = > {
2015-10-15 23:43:51 +02:00
function test ( files : Map < string > , currentDirectory : string , rootFiles : string [ ] , expectedFilesCount : number , relativeNamesToCheck : string [ ] ) {
const options : CompilerOptions = { module : ModuleKind.CommonJS } ;
const host : CompilerHost = {
getSourceFile : ( fileName : string , languageVersion : ScriptTarget ) = > {
let path = normalizePath ( combinePaths ( currentDirectory , fileName ) ) ;
return hasProperty ( files , path ) ? createSourceFile ( fileName , files [ path ] , languageVersion ) : undefined ;
} ,
getDefaultLibFileName : ( ) = > "lib.d.ts" ,
writeFile : ( fileName , content ) : void = > { throw new Error ( "NotImplemented" ) ; } ,
getCurrentDirectory : ( ) = > currentDirectory ,
getCanonicalFileName : fileName = > fileName . toLowerCase ( ) ,
getNewLine : ( ) = > "\r\n" ,
useCaseSensitiveFileNames : ( ) = > false ,
fileExists : fileName = > {
let path = normalizePath ( combinePaths ( currentDirectory , fileName ) ) ;
return hasProperty ( files , path ) ;
} ,
readFile : ( fileName ) : string = > { throw new Error ( "NotImplemented" ) ; }
} ;
const program = createProgram ( rootFiles , options , host ) ;
assert . equal ( program . getSourceFiles ( ) . length , expectedFilesCount ) ;
const syntacticDiagnostics = program . getSyntacticDiagnostics ( ) ;
assert . equal ( syntacticDiagnostics . length , 0 , ` expect no syntactic diagnostics, got: ${ JSON . stringify ( syntacticDiagnostics . map ( diagnosticToString ) ) } ` ) ;
const semanticDiagnostics = program . getSemanticDiagnostics ( ) ;
assert . equal ( semanticDiagnostics . length , 0 , ` expect no semantic diagnostics, got: ${ JSON . stringify ( semanticDiagnostics . map ( diagnosticToString ) ) } ` ) ;
// try to get file using a relative name
for ( const relativeFileName of relativeNamesToCheck ) {
assert . isTrue ( program . getSourceFile ( relativeFileName ) !== undefined , ` expected to get file by relative name, got undefined ` ) ;
}
}
it ( "should find all modules" , ( ) = > {
const files : Map < string > = {
"/a/b/c/first/shared.ts" : `
2015-09-27 06:29:07 +02:00
class A { }
export = A ` ,
2015-10-15 23:43:51 +02:00
"/a/b/c/first/second/class_a.ts" : `
2015-09-27 06:29:07 +02:00
import Shared = require ( '../shared' ) ;
import C = require ( '../../third/class_c' ) ;
class B { }
export = B ; ` ,
2015-10-15 23:43:51 +02:00
"/a/b/c/third/class_c.ts" : `
2015-09-27 06:29:07 +02:00
import Shared = require ( '../first/shared' ) ;
class C { }
export = C ;
`
2015-10-15 23:43:51 +02:00
} ;
test ( files , "/a/b/c/first/second" , [ "class_a.ts" ] , 3 , [ "../../../c/third/class_c.ts" ] ) ;
} ) ;
it ( "should find modules in node_modules" , ( ) = > {
const files : Map < string > = {
"/parent/node_modules/mod/index.d.ts" : "export var x" ,
"/parent/app/myapp.ts" : ` import {x} from "mod" `
} ;
test ( files , "/parent/app" , [ "myapp.ts" ] , 2 , [ ] ) ;
} ) ;
2015-10-27 19:52:57 +01:00
it ( "should find file referenced via absolute and relative names" , ( ) = > {
const files : Map < string > = {
"/a/b/c.ts" : ` /// <reference path="b.ts"/> ` ,
"/a/b/b.ts" : "var x"
} ;
test ( files , "/a/b" , [ "c.ts" , "/a/b/b.ts" ] , 2 , [ ] ) ;
} ) ;
2015-10-15 23:43:51 +02:00
} ) ;
describe ( "Files with different casing" , ( ) = > {
const library = createSourceFile ( "lib.d.ts" , "" , ScriptTarget . ES5 ) ;
function test ( files : Map < string > , options : CompilerOptions , currentDirectory : string , useCaseSensitiveFileNames : boolean , rootFiles : string [ ] , diagnosticCodes : number [ ] ) : void {
const getCanonicalFileName = createGetCanonicalFileName ( useCaseSensitiveFileNames ) ;
if ( ! useCaseSensitiveFileNames ) {
let f : Map < string > = { } ;
for ( let fileName in files ) {
f [ getCanonicalFileName ( fileName ) ] = files [ fileName ] ;
}
files = f ;
}
const host : CompilerHost = {
getSourceFile : ( fileName : string , languageVersion : ScriptTarget ) = > {
if ( fileName === "lib.d.ts" ) {
return library ;
}
let path = getCanonicalFileName ( normalizePath ( combinePaths ( currentDirectory , fileName ) ) ) ;
return hasProperty ( files , path ) ? createSourceFile ( fileName , files [ path ] , languageVersion ) : undefined ;
} ,
2015-09-27 06:29:07 +02:00
getDefaultLibFileName : ( ) = > "lib.d.ts" ,
writeFile : ( fileName , content ) : void = > { throw new Error ( "NotImplemented" ) ; } ,
getCurrentDirectory : ( ) = > currentDirectory ,
2015-10-15 23:43:51 +02:00
getCanonicalFileName ,
2015-09-27 06:29:07 +02:00
getNewLine : ( ) = > "\r\n" ,
2015-10-15 23:43:51 +02:00
useCaseSensitiveFileNames : ( ) = > useCaseSensitiveFileNames ,
2015-09-27 06:29:07 +02:00
fileExists : fileName = > {
2015-10-15 23:43:51 +02:00
let path = getCanonicalFileName ( normalizePath ( combinePaths ( currentDirectory , fileName ) ) ) ;
return hasProperty ( files , path ) ;
2015-09-27 06:29:07 +02:00
} ,
readFile : ( fileName ) : string = > { throw new Error ( "NotImplemented" ) ; }
2015-10-15 23:43:51 +02:00
} ;
const program = createProgram ( rootFiles , options , host ) ;
const diagnostics = sortAndDeduplicateDiagnostics ( program . getSemanticDiagnostics ( ) . concat ( program . getOptionsDiagnostics ( ) ) ) ;
assert . equal ( diagnostics . length , diagnosticCodes . length , ` Incorrect number of expected diagnostics, expected ${ diagnosticCodes . length } , got ' ${ map ( diagnostics , diagnosticToString ) . join ( "\r\n" ) } ' ` ) ;
for ( let i = 0 ; i < diagnosticCodes . length ; ++ i ) {
assert . equal ( diagnostics [ i ] . code , diagnosticCodes [ i ] , ` Expected diagnostic code ${ diagnosticCodes [ i ] } , got ' ${ diagnostics [ i ] . code } ': ' ${ diagnostics [ i ] . messageText } ' ` ) ;
2015-09-27 06:29:07 +02:00
}
}
2015-10-15 23:43:51 +02:00
it ( "should succeed when the same file is referenced using absolute and relative names" , ( ) = > {
const files : Map < string > = {
"/a/b/c.ts" : ` /// <reference path="d.ts"/> ` ,
"/a/b/d.ts" : "var x"
} ;
test ( files , { module : ts.ModuleKind.AMD } , "/a/b" , /* useCaseSensitiveFileNames */ false , [ "c.ts" , "/a/b/d.ts" ] , [ ] ) ;
} ) ;
it ( "should fail when two files used in program differ only in casing (tripleslash references)" , ( ) = > {
const files : Map < string > = {
"/a/b/c.ts" : ` /// <reference path="D.ts"/> ` ,
"/a/b/d.ts" : "var x"
} ;
test ( files , { module : ts.ModuleKind.AMD , forceConsistentCasingInFileNames : true } , "/a/b" , /* useCaseSensitiveFileNames */ false , [ "c.ts" , "d.ts" ] , [ 1149 ] ) ;
} ) ;
it ( "should fail when two files used in program differ only in casing (imports)" , ( ) = > {
const files : Map < string > = {
"/a/b/c.ts" : ` import {x} from "D" ` ,
"/a/b/d.ts" : "export var x"
} ;
test ( files , { module : ts.ModuleKind.AMD , forceConsistentCasingInFileNames : true } , "/a/b" , /* useCaseSensitiveFileNames */ false , [ "c.ts" , "d.ts" ] , [ 1149 ] ) ;
} ) ;
2015-10-27 19:52:57 +01:00
it ( "should fail when two files used in program differ only in casing (imports, relative module names)" , ( ) = > {
const files : Map < string > = {
"moduleA.ts" : ` import {x} from "./ModuleB" ` ,
"moduleB.ts" : "export var x"
} ;
test ( files , { module : ts.ModuleKind.CommonJS , forceConsistentCasingInFileNames : true } , "" , /* useCaseSensitiveFileNames */ false , [ "moduleA.ts" , "moduleB.ts" ] , [ 1149 ] ) ;
} ) ;
2015-10-15 23:43:51 +02:00
it ( "should fail when two files exist on disk that differs only in casing" , ( ) = > {
const files : Map < string > = {
"/a/b/c.ts" : ` import {x} from "D" ` ,
"/a/b/D.ts" : "export var x" ,
"/a/b/d.ts" : "export var y"
} ;
test ( files , { module : ts.ModuleKind.AMD } , "/a/b" , /* useCaseSensitiveFileNames */ true , [ "c.ts" , "d.ts" ] , [ 1149 ] ) ;
} ) ;
2015-10-27 19:52:57 +01:00
it ( "should fail when module name in 'require' calls has inconsistent casing" , ( ) = > {
const files : Map < string > = {
"moduleA.ts" : ` import a = require("./ModuleC") ` ,
"moduleB.ts" : ` import a = require("./moduleC") ` ,
"moduleC.ts" : "export var x"
} ;
test ( files , { module : ts.ModuleKind.CommonJS , forceConsistentCasingInFileNames : true } , "" , /* useCaseSensitiveFileNames */ false , [ "moduleA.ts" , "moduleB.ts" , "moduleC.ts" ] , [ 1149 , 1149 ] ) ;
} )
2015-09-27 06:29:07 +02:00
} ) ;
2015-08-18 03:31:12 +02:00
}