@@ -7,7 +7,7 @@ const readPkg = require('read-pkg')
7
7
const copy = require ( 'cpy' )
8
8
const tempfile = require ( 'tempfile' )
9
9
10
- const cli = path . resolve ( '../ cli.js' )
10
+ const cli = path . resolve ( 'cli.js' )
11
11
12
12
function read ( pathFile ) {
13
13
return new Promise ( ( resolve , reject ) => {
@@ -25,7 +25,7 @@ test('Missing required arguments -i, -o', t => {
25
25
} )
26
26
27
27
test ( 'Missing required arguments -o' , t => {
28
- t . throws ( execa ( cli , [ '-i' , 'fixtures/input.html' ] ) )
28
+ t . throws ( execa ( cli , [ '-i' , 'test/ fixtures/input.html' ] ) )
29
29
} )
30
30
31
31
test ( 'Missing required arguments -i' , t => {
@@ -35,7 +35,7 @@ test('Missing required arguments -i', t => {
35
35
36
36
test ( 'One of the arguments' , t => {
37
37
const filename = tempfile ( '.html' )
38
- t . throws ( execa ( cli , [ '-o' , filename , '-r' , '-i' , 'fixtures/input.html' ] ) )
38
+ t . throws ( execa ( cli , [ '-o' , filename , '-r' , '-i' , 'test/ fixtures/input.html' ] ) )
39
39
} )
40
40
41
41
test ( 'Check version' , async t => {
@@ -45,42 +45,42 @@ test('Check version', async t => {
45
45
test ( 'Transform html witch config in package.json' , async t => {
46
46
t . plan ( 2 )
47
47
const filename = tempfile ( '.html' )
48
- await execa ( cli , [ '-i' , 'fixtures/input.html' , '-o' , filename ] )
48
+ await execa ( cli , [ '-i' , 'test/ fixtures/input.html' , '-o' , filename ] )
49
49
t . true ( await pathExists ( filename ) )
50
- t . is ( ( await read ( 'expected/output-config-pkg.html' ) ) , ( await read ( filename ) ) )
50
+ t . is ( ( await read ( 'test/ expected/output-config-pkg.html' ) ) , ( await read ( filename ) ) )
51
51
} )
52
52
53
53
test ( 'Transform html witch indent' , async t => {
54
54
t . plan ( 2 )
55
55
const filename = tempfile ( '.html' )
56
- await execa ( cli , [ '-i' , 'fixtures/input-indent.html' , '-o' , filename ] )
56
+ await execa ( cli , [ '-i' , 'test/ fixtures/input-indent.html' , '-o' , filename ] )
57
57
t . true ( await pathExists ( filename ) )
58
- t . is ( ( await read ( 'expected/output-indent.html' ) ) , ( await read ( filename ) ) )
58
+ t . is ( ( await read ( 'test/ expected/output-indent.html' ) ) , ( await read ( filename ) ) )
59
59
} )
60
60
61
61
test ( 'Transform html witch config in file' , async t => {
62
62
t . plan ( 2 )
63
63
const filename = tempfile ( '.html' )
64
- await execa ( cli , [ '-i' , 'fixtures/input.html' , '-o' , filename , '-c' , 'fixtures/config.json' ] )
64
+ await execa ( cli , [ '-i' , 'test/ fixtures/input.html' , '-o' , filename , '-c' , 'test/ fixtures/config.json' ] )
65
65
t . true ( await pathExists ( filename ) )
66
- t . is ( ( await read ( 'expected/output-config-file.html' ) ) , ( await read ( filename ) ) )
66
+ t . is ( ( await read ( 'test/ expected/output-config-file.html' ) ) , ( await read ( filename ) ) )
67
67
} )
68
68
69
69
test ( 'Transform html from folder' , async t => {
70
70
t . plan ( 2 )
71
71
const folder = await tempfile ( )
72
- await execa ( cli , [ '-i' , 'fixtures/*.html' , '-o' , `${ folder } /` ] )
73
- t . is ( ( await read ( 'expected/output-config-pkg.html' ) ) , ( await read ( `${ folder } /input.html` ) ) )
74
- t . is ( ( await read ( 'expected/output-indent.html' ) ) , ( await read ( `${ folder } /input-indent.html` ) ) )
72
+ await execa ( cli , [ '-i' , 'test/ fixtures/*.html' , '-o' , `${ folder } /` ] )
73
+ t . is ( ( await read ( 'test/ expected/output-config-pkg.html' ) ) , ( await read ( `${ folder } /input.html` ) ) )
74
+ t . is ( ( await read ( 'test/ expected/output-indent.html' ) ) , ( await read ( `${ folder } /input-indent.html` ) ) )
75
75
} )
76
76
77
77
test ( 'Transform html witch options replace' , async t => {
78
78
t . plan ( 2 )
79
79
const folder = await tempfile ( )
80
- await copy ( [ 'fixtures/*.html' ] , `${ folder } /` )
80
+ await copy ( [ 'test/ fixtures/*.html' ] , `${ folder } /` )
81
81
await execa ( cli , [ '-i' , `${ folder } /*.html` , '-r' ] )
82
- t . is ( ( await read ( 'expected/output-config-pkg.html' ) ) , ( await read ( `${ folder } /input.html` ) ) )
83
- t . is ( ( await read ( 'expected/output-indent.html' ) ) , ( await read ( `${ folder } /input-indent.html` ) ) )
82
+ t . is ( ( await read ( 'test/ expected/output-config-pkg.html' ) ) , ( await read ( `${ folder } /input.html` ) ) )
83
+ t . is ( ( await read ( 'test/ expected/output-indent.html' ) ) , ( await read ( `${ folder } /input-indent.html` ) ) )
84
84
} )
85
85
86
86
test ( 'Transform html witch config in file and stdin options use' , async t => {
@@ -90,9 +90,9 @@ test('Transform html witch config in file and stdin options use', async t => {
90
90
'-o' ,
91
91
filename ,
92
92
'-i' ,
93
- 'fixtures/input-bem.html' ,
93
+ 'test/ fixtures/input-bem.html' ,
94
94
'-c' ,
95
- 'fixtures/config.json' ,
95
+ 'test/ fixtures/config.json' ,
96
96
'-u' ,
97
97
'posthtml-bem' ,
98
98
'--posthtml-bem.elemPrefix' ,
@@ -103,7 +103,7 @@ test('Transform html witch config in file and stdin options use', async t => {
103
103
'posthtml-custom-elements'
104
104
] )
105
105
t . true ( await pathExists ( filename ) )
106
- t . is ( ( await read ( 'expected/output-bem.html' ) ) , ( await read ( filename ) ) )
106
+ t . is ( ( await read ( 'test/ expected/output-bem.html' ) ) , ( await read ( filename ) ) )
107
107
} )
108
108
109
109
test ( 'Transform html stdin options use witch modules' , async t => {
@@ -113,12 +113,12 @@ test('Transform html stdin options use witch modules', async t => {
113
113
'-o' ,
114
114
filename ,
115
115
'-i' ,
116
- 'fixtures/input-modules.html' ,
116
+ 'test/ fixtures/input-modules.html' ,
117
117
'-u' ,
118
118
'posthtml-css-modules' ,
119
119
'--posthtml-css-modules' ,
120
- 'fixtures/css-modules.json'
120
+ 'test/ fixtures/css-modules.json'
121
121
] )
122
122
t . true ( await pathExists ( filename ) )
123
- t . is ( ( await read ( 'expected/output-modules.html' ) ) , ( await read ( filename ) ) )
123
+ t . is ( ( await read ( 'test/ expected/output-modules.html' ) ) , ( await read ( filename ) ) )
124
124
} )
0 commit comments