@@ -3031,6 +3031,54 @@ namespace ts.projectSystem {
3031
3031
} ) ;
3032
3032
} ) ;
3033
3033
3034
+ describe ( "emit with outFile or out setting" , ( ) => {
3035
+ function test ( opts : CompilerOptions , expectedUsesOutFile : boolean ) {
3036
+ const f1 = {
3037
+ path : "/a/a.ts" ,
3038
+ content : "let x = 1"
3039
+ } ;
3040
+ const f2 = {
3041
+ path : "/a/b.ts" ,
3042
+ content : "let y = 1"
3043
+ } ;
3044
+ const config = {
3045
+ path : "/a/tsconfig.json" ,
3046
+ content : JSON . stringify ( {
3047
+ compilerOptions : opts ,
3048
+ compileOnSave : true
3049
+ } )
3050
+ } ;
3051
+ const host = createServerHost ( [ f1 , f2 , config ] ) ;
3052
+ const session = createSession ( host ) ;
3053
+ session . executeCommand ( < protocol . OpenRequest > {
3054
+ seq : 1 ,
3055
+ type : "request" ,
3056
+ command : "open" ,
3057
+ arguments : { file : f1 . path }
3058
+ } ) ;
3059
+ checkNumberOfProjects ( session . getProjectService ( ) , { configuredProjects : 1 } ) ;
3060
+ const { response } = session . executeCommand ( < protocol . CompileOnSaveAffectedFileListRequest > {
3061
+ seq : 2 ,
3062
+ type : "request" ,
3063
+ command : "compileOnSaveAffectedFileList" ,
3064
+ arguments : { file : f1 . path }
3065
+ } ) ;
3066
+ assert . equal ( ( < protocol . CompileOnSaveAffectedFileListSingleProject [ ] > response ) . length , 1 , "expected output for 1 project" ) ;
3067
+ assert . equal ( ( < protocol . CompileOnSaveAffectedFileListSingleProject [ ] > response ) [ 0 ] . fileNames . length , 2 , "expected output for 1 project" ) ;
3068
+ assert . equal ( ( < protocol . CompileOnSaveAffectedFileListSingleProject [ ] > response ) [ 0 ] . projectUsesOutFile , expectedUsesOutFile , "usesOutFile" ) ;
3069
+ }
3070
+
3071
+ it ( "projectUsesOutFile should not be returned if not set" , ( ) => {
3072
+ test ( { } , /*expectedUsesOutFile*/ false ) ;
3073
+ } ) ;
3074
+ it ( "projectUsesOutFile should be true if outFile is set" , ( ) => {
3075
+ test ( { outFile : "/a/out.js" } , /*expectedUsesOutFile*/ true ) ;
3076
+ } ) ;
3077
+ it ( "projectUsesOutFile should be true if out is set" , ( ) => {
3078
+ test ( { out : "/a/out.js" } , /*expectedUsesOutFile*/ true ) ;
3079
+ } ) ;
3080
+ } ) ;
3081
+
3034
3082
describe ( "import helpers" , ( ) => {
3035
3083
it ( "should not crash in tsserver" , ( ) => {
3036
3084
const f1 = {
0 commit comments