Skip to content

Commit 79e192b

Browse files
committed
Fix bug in tests err vs. error
1 parent 1301a31 commit 79e192b

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

test/error.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@ import tmp from './helpers/tmp.js'
44
import cli from './helpers/cli.js'
55

66
test('multiple input files && --output', t => {
7-
return cli(['test/fixtures/*.css', '-o', tmp()]).then(({ err, code }) => {
7+
return cli(['test/fixtures/*.css', '-o', tmp()]).then(({ error, code }) => {
88
t.is(code, 1, 'expected non-zero error code')
9-
t.regex(err.toString(), /Input Error: Must use --dir or --replace/)
9+
t.regex(error.toString(), /Input Error: Must use --dir or --replace/)
1010
})
1111
})
1212

1313
test('multiple input files && writing to stdout', t => {
14-
return cli(['test/fixtures/*.css']).then(({ err, code }) => {
14+
return cli(['test/fixtures/*.css']).then(({ error, code }) => {
1515
t.is(code, 1, 'expected non-zero error code')
16-
t.regex(err.toString(), /Input Error: Must use --dir or --replace/)
16+
t.regex(error.toString(), /Input Error: Must use --dir or --replace/)
1717
})
1818
})
1919

2020
test('--map && writing to stdout', t => {
21-
return cli(['test/fixtures/a.css', '--map']).then(({ err, code }) => {
21+
return cli(['test/fixtures/a.css', '--map']).then(({ error, code }) => {
2222
t.is(code, 1, 'expected non-zero error code')
2323
t.regex(
24-
err.toString(),
24+
error.toString(),
2525
/Output Error: Cannot output external sourcemaps when writing to STDOUT/
2626
)
2727
})
@@ -34,18 +34,18 @@ test.failing('invalid --config', t => {
3434
'test/postcss.config.js',
3535
'-d',
3636
tmp()
37-
]).then(({ err, code }) => {
37+
]).then(({ error, code }) => {
3838
t.is(code, 1, 'expected non-zero error code')
39-
t.regex(err.toString(), /ENOENT: no such file or directory/)
39+
t.regex(error.toString(), /ENOENT: no such file or directory/)
4040
})
4141
})
4242

4343
test('plugin not found', t => {
4444
return cli(['test/fixtures/a.css', '-u', 'postcss-plugin', '-o', tmp()]).then(
45-
({ err, code }) => {
45+
({ error, code }) => {
4646
t.is(code, 1, 'expected non-zero error code')
4747
t.regex(
48-
err.toString(),
48+
error.toString(),
4949
/Plugin Error: Cannot find module 'postcss-plugin'/
5050
)
5151
}
@@ -59,18 +59,18 @@ test('plugin throws on require', t => {
5959
'./test/fixtures/bad-plugin',
6060
'-o',
6161
tmp()
62-
]).then(({ err, code }) => {
62+
]).then(({ error, code }) => {
6363
t.is(code, 1, 'expected non-zero error code')
64-
t.regex(err.toString(), /Plugin Error \(.*bad-plugin\): This fails/)
64+
t.regex(error.toString(), /Plugin Error \(.*bad-plugin\): This fails/)
6565
})
6666
})
6767

6868
test('CssSyntaxError', t => {
6969
return cli(['test/fixtures/a.css', '--parser', 'sugarss', '-o', tmp()]).then(
70-
({ err, code }) => {
70+
({ error, code }) => {
7171
t.is(code, 1, 'expected non-zero error code')
7272
t.regex(
73-
err.toString(),
73+
error.toString(),
7474
/CssSyntaxError: .*a.css:1:4: Unnecessary curly bracket/
7575
)
7676
}

test/helpers/cli.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ export default function(args, cwd) {
66
exec(
77
`node ${path.resolve('bin/postcss')} ${args.join(' ')}`,
88
{ cwd },
9-
(err, stdout, stderr) => {
9+
(error, stdout, stderr) => {
1010
resolve({
11-
code: err && err.code ? err.code : 0,
12-
err,
11+
code: error && error.code ? error.code : 0,
12+
error,
1313
stdout,
1414
stderr
1515
})

0 commit comments

Comments
 (0)