@@ -74,4 +74,44 @@ describe("pull", () => {
7474
7575 expect ( filesOnDiskExpected . size ) . toBe ( 0 ) ;
7676 } ) ;
77+
78+ it ( "correctly does not write index.js or index.d.ts when `disableJsDriver: true` is specified" , async ( ) => {
79+ process . env . DITTO_TEXT_DIR = "/ditto" ;
80+ process . env . DITTO_PROJECT_CONFIG_FILE = "/ditto/config.yml" ;
81+
82+ // we need to manually mock responses for the http calls that happen
83+ // directly within the pull function; we don't need to mock the http
84+ // calls that happen by way of http/* function calls since those have
85+ // their own mocks already.
86+ axiosMock . get . mockImplementation (
87+ ( ) : Promise < any > => Promise . resolve ( { data : "data" } )
88+ ) ;
89+
90+ vol . fromJSON ( {
91+ [ consts . CONFIG_FILE ] : mockGlobalConfigFile ,
92+ [ consts . PROJECT_CONFIG_FILE ] :
93+ mockProjectConfigFile + "\n" + "disableJsDriver: true" ,
94+ } ) ;
95+
96+ await pull ( ) ;
97+
98+ const filesOnDiskExpected = new Set ( [
99+ "components__example-folder__base.json" ,
100+ "components__example-folder__example-variant-1.json" ,
101+ "components__example-folder__example-variant-2.json" ,
102+ "components__root__base.json" ,
103+ "components__root__example-variant-1.json" ,
104+ "components__root__example-variant-2.json" ,
105+ "test-project__base.json" ,
106+ "test-project__example-variant-1.json" ,
107+ "test-project__example-variant-2.json" ,
108+ ] ) ;
109+
110+ const filesOnDisk = fs . readdirSync ( "/ditto" ) ;
111+ filesOnDisk . forEach ( ( file ) => {
112+ filesOnDiskExpected . delete ( file ) ;
113+ } ) ;
114+
115+ expect ( filesOnDiskExpected . size ) . toBe ( 0 ) ;
116+ } ) ;
77117} ) ;
0 commit comments