Skip to content

Commit 9834c6d

Browse files
author
Jannik Zschiesche
committed
Bump test dependencies
1 parent 66fc852 commit 9834c6d

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848
},
4949
"devDependencies": {
5050
"@types/terser-webpack-plugin": "^2.2.0",
51-
"ava": "^2.4.0",
51+
"ava": "^3.7.0",
52+
"esm": "^3.2.25",
53+
"execa": "^4.0.0",
5254
"kaba-scss": "^3.3.6",
5355
"webpack-bundle-analyzer": "^3.7.0"
5456
},

tests/all_fixtures.js

+7-10
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {runKaba} from "./lib/runner";
1414

1515
/* eslint-disable camelcase */
1616
/** @var {Object<string,FixtureConfig>} fixtureTests */
17-
let fixtureTests = {
17+
const fixtureTests = {
1818
js: {
1919
status: 0,
2020
},
@@ -39,24 +39,21 @@ let fixtureTests = {
3939

4040
Object.keys(fixtureTests).forEach(key =>
4141
{
42-
test(`File: ${key}`, t =>
42+
test(`File: ${key}`, async t =>
4343
{
44-
let expected = fixtureTests[key];
45-
let result = runKaba(expected.dir || key, expected.args || []);
46-
let stdout = null !== result.stdout
47-
? result.stdout.toString()
48-
: "";
44+
const expected = fixtureTests[key];
45+
const result = await runKaba(expected.dir || key, expected.args || []);
4946

50-
t.is(result.status, expected.status);
47+
t.is(result.exitCode, expected.status);
5148

5249
if (undefined !== expected.match)
5350
{
54-
t.truthy(expected.match.test(stdout));
51+
t.truthy(expected.match.test(result.stdout));
5552
}
5653

5754
if (undefined !== expected.noMatch)
5855
{
59-
t.falsy(expected.noMatch.test(stdout));
56+
t.falsy(expected.noMatch.test(result.stdout));
6057
}
6158
});
6259
});

tests/lib/runner.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
const path = require("path");
2-
const {spawnSync} = require("child_process");
2+
const execa = require("execa");
33

44
/**
55
* @param {string} directory
66
* @param {string[]} args
7-
* @returns {SpawnSyncReturns<Buffer> | SpawnSyncReturns<string>}
87
*/
9-
exports.runKaba = function (directory, args = [])
8+
exports.runKaba = async function (directory, args = [])
109
{
11-
return spawnSync(
10+
return execa(
1211
path.join(__dirname, "../../bin/run.js"),
1312
args,
1413
{
1514
cwd: path.join(__dirname, "../fixtures", directory),
15+
reject: false,
1616
}
1717
);
1818
};

0 commit comments

Comments
 (0)