@@ -155,17 +155,20 @@ describe('build command', async () => {
155155
156156 test ( 'build options' , async ( ) => {
157157 const fixturePath = path . join ( __dirname , 'options' ) ;
158- await fse . remove ( path . join ( fixturePath , 'fooDist ' ) ) ;
158+ await fse . remove ( path . join ( fixturePath , 'dist/ok ' ) ) ;
159159
160160 const stdout = runCliSync (
161- 'build ' + '--entry="./src/*" ' + '--dist-path=dist/ok ' + '--no-bundle ' ,
162- // '--format=esm ' +
163- // '--syntax=es2015 ' +
164- // '--target=web ' +
165- // '--dts=true ' +
166- // '--external=./bar ' +
167- // '--minify=false ' +
168- // '--auto-extension=false' +
161+ 'build ' +
162+ '--entry="./src/*" ' +
163+ '--dist-path=dist/ok ' +
164+ '--no-bundle ' +
165+ '--format=esm ' +
166+ `--syntax='["node 14", "Chrome 103"]' ` +
167+ '--target=web ' +
168+ '--dts=true ' +
169+ '--externals=./bar ' +
170+ '--minify=false ' +
171+ '--auto-extension=false' ,
169172 {
170173 cwd : fixturePath ,
171174 env : {
@@ -176,15 +179,22 @@ describe('build command', async () => {
176179 ) ;
177180
178181 const rslibConfigText = stripAnsi ( extractRslibConfig ( stdout ) ) ;
179- console . log ( '👩❤️💋👩' , stdout ) ;
180182 expect ( rslibConfigText ) . toMatchInlineSnapshot ( `
181183 "{
182184 lib: [
183185 {
184- format: 'cjs',
185- output: { distPath: { root: 'dist/ok' } },
186186 bundle: false,
187- source: { entry: { index: './src/*' } }
187+ source: { entry: { index: './src/*' } },
188+ format: 'esm',
189+ output: {
190+ distPath: { root: 'dist/ok' },
191+ target: 'web',
192+ minify: false,
193+ externals: [ './bar' ]
194+ },
195+ syntax: [ 'node 14', 'Chrome 103' ],
196+ dts: true,
197+ autoExtension: 'false'
188198 }
189199 ],
190200 _privateMeta: {
@@ -194,10 +204,15 @@ describe('build command', async () => {
194204 }"
195205 ` ) ;
196206
197- // const files = await globContentJSON(path.join(fixturePath, 'fooDist'));
198- // const fileNames = Object.keys(files).sort();
199- // expect(fileNames).toMatchInlineSnapshot(`[]`);
200- // const output = files[fileNames[0]!];
201- // expect(output).toMatch(/export { .* }/);
207+ const files = await globContentJSON ( path . join ( fixturePath , 'dist/ok' ) ) ;
208+ const fileNames = Object . keys ( files ) . sort ( ) ;
209+ expect ( fileNames ) . toMatchInlineSnapshot ( `
210+ [
211+ "<ROOT>/tests/integration/cli/build/options/dist/ok/foo.d.ts",
212+ "<ROOT>/tests/integration/cli/build/options/dist/ok/foo.js",
213+ ]
214+ ` ) ;
215+ const output = files [ fileNames [ 1 ] ! ] ;
216+ expect ( output ) . toMatch ( / e x p o r t { .* } / ) ;
202217 } ) ;
203218} ) ;
0 commit comments