Skip to content

Commit 362a00b

Browse files
committed
test: add tests for allInOutput and root options
1 parent 785d64c commit 362a00b

7 files changed

Lines changed: 46 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<div>input-nesting-child/index</div>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<div>input-nesting-index</div>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<div>input-nesting-child/index</div>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<div>input-nesting-index</div>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<div>input-nesting-child/index</div>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<div>input-nesting-index</div>

test/test-cli.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,43 @@ test('Transform html stdin options only config one-io anf plugins array', async
201201
(await read('test/fixtures/by-config/one-io-and-plugins-array/input.html'))
202202
);
203203
});
204+
205+
test('Output with keeping the folder structure with allInOutput option', async t => {
206+
t.plan(3);
207+
await execa(cli, [
208+
'test/fixtures/input-nesting/**/*.html',
209+
'-o',
210+
'test/expected/output-nesting',
211+
'-a'
212+
]);
213+
t.true(await pathExists('test/expected/output-nesting'));
214+
t.is(
215+
(await read('test/fixtures/input-nesting/input-nesting.html')),
216+
(await read('test/expected/output-nesting/test/fixtures/input-nesting/input-nesting.html'))
217+
);
218+
t.is(
219+
(await read('test/fixtures/input-nesting/input-nesting-child/input-nesting.html')),
220+
(await read('test/expected/output-nesting/test/fixtures/input-nesting/input-nesting-child/input-nesting.html'))
221+
);
222+
});
223+
224+
test('Specify the root of the output folder structure with root option', async t => {
225+
t.plan(3);
226+
await execa(cli, [
227+
'test/fixtures/input-nesting/**/*.html',
228+
'-o',
229+
'test/expected/output-nesting-root',
230+
'-a',
231+
'-r',
232+
'test/fixtures/input-nesting'
233+
]);
234+
t.true(await pathExists('test/expected/output-nesting-root'));
235+
t.is(
236+
(await read('test/fixtures/input-nesting/input-nesting.html')),
237+
(await read('test/expected/output-nesting-root/input-nesting.html'))
238+
);
239+
t.is(
240+
(await read('test/fixtures/input-nesting/input-nesting-child/input-nesting.html')),
241+
(await read('test/expected/output-nesting-root/input-nesting-child/input-nesting.html'))
242+
);
243+
});

0 commit comments

Comments
 (0)