11import test from 'ava' ;
2+ import path from 'path' ;
23import cfgResolve from '../lib/cfg-resolve' ;
34
45test ( 'should return function' , t => {
@@ -13,77 +14,83 @@ test('should throw error `input files not found`', t => {
1314 t . is ( error . message , 'input files not found' ) ;
1415} ) ;
1516
16- test ( 'should return config with one use key without property' , t => {
17+ test ( 'should return config plugins with one use key without property' , t => {
18+ const input = 'input.html' ;
1719 const flags = {
1820 use : 'posthtml-bem'
1921 } ;
20- const config = cfgResolve ( { flags} ) ;
22+ const config = cfgResolve ( { input , flags} ) ;
2123 const expected = { 'posthtml-bem' : { } } ;
2224
2325 t . deepEqual ( config . plugins , expected ) ;
2426} ) ;
2527
2628test ( 'should return config with one use key with one property' , t => {
29+ const input = 'input.html' ;
2730 const flags = {
2831 use : 'posthtml-bem' ,
2932 posthtmlBem : {
3033 prefix : '__'
3134 }
3235 } ;
33- const config = cfgResolve ( { flags} ) ;
36+ const config = cfgResolve ( { input , flags} ) ;
3437 const expected = { 'posthtml-bem' : { prefix : '__' } } ;
3538
3639 t . deepEqual ( config . plugins , expected ) ;
3740} ) ;
3841
3942test ( 'should return config with key config plugins' , t => {
43+ const input = 'input.html' ;
4044 const flags = {
4145 config : 'test/config/.config-plugins'
4246 } ;
43- const config = cfgResolve ( { flags} ) ;
47+ const config = cfgResolve ( { input , flags} ) ;
4448 const expected = { 'posthtml-bem' : { } } ;
4549
4650 t . deepEqual ( config . plugins , expected ) ;
4751} ) ;
4852
4953test ( 'should return config with key config options' , t => {
54+ const input = 'input.html' ;
5055 const flags = {
5156 config : 'test/config/.config-options'
5257 } ;
53- const config = cfgResolve ( { flags} ) ;
58+ const config = cfgResolve ( { input , flags} ) ;
5459 const expected = { sync : true } ;
5560
5661 t . deepEqual ( config . options , expected ) ;
5762} ) ;
5863
5964test ( 'should return config options' , t => {
65+ const input = 'input.html' ;
6066 const flags = {
6167 options : { sync : true }
6268 } ;
63- const config = cfgResolve ( { flags} ) ;
69+ const config = cfgResolve ( { input , flags} ) ;
6470 const expected = { sync : true } ;
6571
6672 t . deepEqual ( config . options , expected ) ;
6773} ) ;
6874
6975test ( 'should return config with key config and use key' , t => {
76+ const input = 'input.html' ;
7077 const flags = {
7178 use : 'posthtml-assets' ,
7279 config : 'test/config/.config-plugins'
7380 } ;
74- const config = cfgResolve ( { flags} ) ;
81+ const config = cfgResolve ( { input , flags} ) ;
7582 const expected = { 'posthtml-bem' : { } , 'posthtml-assets' : { } } ;
7683
7784 t . deepEqual ( config . plugins , expected ) ;
7885} ) ;
7986
80- test ( 'should return config when CLI params priority' , t => {
87+ test ( 'should return config when CLI input param priority' , t => {
8188 const input = 'src/template/**/*.html' ;
8289 const flags = {
8390 config : 'test/config/.config-input-priority'
8491 } ;
8592 const config = cfgResolve ( { input, flags} ) ;
86- const expected = 'src/template/**/*.html' ;
93+ const expected = [ path . resolve ( 'src/template/**/*.html' ) ] ;
8794
8895 t . deepEqual ( config . input , expected ) ;
8996} ) ;
0 commit comments