@@ -2,24 +2,24 @@ const { resolve } = require('path');
22const webpackCLI = require ( '../lib/webpack-cli' ) ;
33
44const targetValues = [ 'web' , 'webworker' , 'node' , 'async-node' , 'node-webkit' , 'electron-main' , 'electron-renderer' , 'electron-preload' ] ;
5- const applyOptions = new webpackCLI ( ) . applyOptions ;
5+ const cli = new webpackCLI ( ) ;
66
77describe ( 'BasicResolver' , ( ) => {
88 it ( 'should handle the output option' , async ( ) => {
9- const result = await applyOptions ( { options : { } } , { outputPath : './bundle' } ) ;
9+ const result = await cli . applyOptions ( { options : { } } , { outputPath : './bundle' } ) ;
1010
1111 expect ( result . options . output . path ) . toEqual ( resolve ( 'bundle' ) ) ;
1212 } ) ;
1313
1414 it ( 'should handle the mode option [production]' , async ( ) => {
15- const result = await applyOptions ( { options : { } } , { mode : 'production' } ) ;
15+ const result = await cli . applyOptions ( { options : { } } , { mode : 'production' } ) ;
1616
1717 expect ( result . options ) . toMatchObject ( { mode : 'production' } ) ;
1818 expect ( result . options . mode ) . toEqual ( 'production' ) ;
1919 } ) ;
2020
2121 it ( 'should handle the mode option [development]' , async ( ) => {
22- const result = await applyOptions (
22+ const result = await cli . applyOptions (
2323 { options : { } } ,
2424 {
2525 mode : 'development' ,
@@ -31,7 +31,7 @@ describe('BasicResolver', () => {
3131 } ) ;
3232
3333 it ( 'should handle the mode option [none]' , async ( ) => {
34- const result = await applyOptions (
34+ const result = await cli . applyOptions (
3535 { options : { } } ,
3636 {
3737 mode : 'none' ,
@@ -44,34 +44,34 @@ describe('BasicResolver', () => {
4444
4545 it ( 'should prefer supplied move flag over NODE_ENV' , async ( ) => {
4646 process . env . NODE_ENV = 'production' ;
47- const result = await applyOptions ( { options : { } } , { mode : 'development' } ) ;
47+ const result = await cli . applyOptions ( { options : { } } , { mode : 'development' } ) ;
4848
4949 expect ( result . options ) . toMatchObject ( { mode : 'development' } ) ;
5050 } ) ;
5151
5252 it ( 'should prefer supplied move flag over mode from config' , async ( ) => {
53- const result = await applyOptions ( { options : { mode : 'development' } } , { mode : 'production' } ) ;
53+ const result = await cli . applyOptions ( { options : { mode : 'development' } } , { mode : 'production' } ) ;
5454
5555 expect ( result . options ) . toMatchObject ( { mode : 'production' } ) ;
5656 } ) ;
5757
5858 it ( 'should prefer mode form config over NODE_ENV' , async ( ) => {
5959 process . env . NODE_ENV = 'development' ;
60- const result = await applyOptions ( { options : { } } , { mode : 'production' } ) ;
60+ const result = await cli . applyOptions ( { options : { } } , { mode : 'production' } ) ;
6161
6262 expect ( result . options ) . toMatchObject ( { mode : 'production' } ) ;
6363 } ) ;
6464
6565 it ( 'should prefer mode form flag over NODE_ENV and config' , async ( ) => {
6666 process . env . NODE_ENV = 'development' ;
67- const result = await applyOptions ( { options : { } } , { } ) ;
67+ const result = await cli . applyOptions ( { options : { } } , { } ) ;
6868
6969 expect ( result . options ) . toMatchObject ( { mode : 'development' } ) ;
7070 } ) ;
7171
7272 targetValues . map ( ( option ) => {
7373 it ( `should handle ${ option } option` , async ( ) => {
74- const result = await applyOptions ( { options : { } } , { target : option } ) ;
74+ const result = await cli . applyOptions ( { options : { } } , { target : option } ) ;
7575
7676 expect ( result . options . target ) . toEqual ( option ) ;
7777 } ) ;
0 commit comments