Skip to content

Commit 7696f59

Browse files
author
Ivan Demidov
committed
fix(test-cli): fix path for test folder
1 parent 3bb0938 commit 7696f59

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

test/test-cli.js

+21-21
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const readPkg = require('read-pkg')
77
const copy = require('cpy')
88
const tempfile = require('tempfile')
99

10-
const cli = path.resolve('../cli.js')
10+
const cli = path.resolve('cli.js')
1111

1212
function read (pathFile) {
1313
return new Promise((resolve, reject) => {
@@ -25,7 +25,7 @@ test('Missing required arguments -i, -o', t => {
2525
})
2626

2727
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']))
2929
})
3030

3131
test('Missing required arguments -i', t => {
@@ -35,7 +35,7 @@ test('Missing required arguments -i', t => {
3535

3636
test('One of the arguments', t => {
3737
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']))
3939
})
4040

4141
test('Check version', async t => {
@@ -45,42 +45,42 @@ test('Check version', async t => {
4545
test('Transform html witch config in package.json', async t => {
4646
t.plan(2)
4747
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])
4949
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)))
5151
})
5252

5353
test('Transform html witch indent', async t => {
5454
t.plan(2)
5555
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])
5757
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)))
5959
})
6060

6161
test('Transform html witch config in file', async t => {
6262
t.plan(2)
6363
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'])
6565
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)))
6767
})
6868

6969
test('Transform html from folder', async t => {
7070
t.plan(2)
7171
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`)))
7575
})
7676

7777
test('Transform html witch options replace', async t => {
7878
t.plan(2)
7979
const folder = await tempfile()
80-
await copy(['fixtures/*.html'], `${folder}/`)
80+
await copy(['test/fixtures/*.html'], `${folder}/`)
8181
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`)))
8484
})
8585

8686
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 => {
9090
'-o',
9191
filename,
9292
'-i',
93-
'fixtures/input-bem.html',
93+
'test/fixtures/input-bem.html',
9494
'-c',
95-
'fixtures/config.json',
95+
'test/fixtures/config.json',
9696
'-u',
9797
'posthtml-bem',
9898
'--posthtml-bem.elemPrefix',
@@ -103,7 +103,7 @@ test('Transform html witch config in file and stdin options use', async t => {
103103
'posthtml-custom-elements'
104104
])
105105
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)))
107107
})
108108

109109
test('Transform html stdin options use witch modules', async t => {
@@ -113,12 +113,12 @@ test('Transform html stdin options use witch modules', async t => {
113113
'-o',
114114
filename,
115115
'-i',
116-
'fixtures/input-modules.html',
116+
'test/fixtures/input-modules.html',
117117
'-u',
118118
'posthtml-css-modules',
119119
'--posthtml-css-modules',
120-
'fixtures/css-modules.json'
120+
'test/fixtures/css-modules.json'
121121
])
122122
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)))
124124
})

0 commit comments

Comments
 (0)