Skip to content

Commit f975011

Browse files
committed
test: convert tests to use built-in Node.js runner
1 parent 643b9c6 commit f975011

File tree

4 files changed

+13
-64
lines changed

4 files changed

+13
-64
lines changed

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"prepare": "pnpm run build && tsc",
2626
"build": "jison ./parser.jison -o src/parser.js",
2727
"lint": "eslint . && tsc",
28-
"test": "uvu test"
28+
"test": "node --test"
2929
},
3030
"author": "Andy Jansson",
3131
"license": "MIT",
@@ -39,8 +39,7 @@
3939
"jison-gho": "^0.6.1-216",
4040
"postcss": "^8.4.38",
4141
"prettier": "^3.2.5",
42-
"typescript": "~5.4.5",
43-
"uvu": "^0.5.6"
42+
"typescript": "~5.4.5"
4443
},
4544
"dependencies": {
4645
"postcss-selector-parser": "^6.0.16",

pnpm-lock.yaml

-47
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/convertUnit.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
2-
const { test } = require('uvu');
3-
const assert = require('uvu/assert');
2+
const { test } = require('node:test');
3+
const assert = require('node:assert/strict');
44

55
const convertUnit = require('../src/lib/convertUnit.js');
66

@@ -96,7 +96,7 @@ test('valid conversions', () => {
9696
const expected = e[2];
9797
const targetUnit = e[3];
9898

99-
assert.is(
99+
assert.strictEqual(
100100
convertUnit(value, unit, targetUnit),
101101
expected,
102102
unit + ' -> ' + targetUnit
@@ -406,7 +406,7 @@ test('precision', () => {
406406
const expected = e[2];
407407
const targetUnit = e[3];
408408

409-
assert.is(
409+
assert.strictEqual(
410410
convertUnit(value, unit, targetUnit, precision),
411411
expected,
412412
unit + ' -> ' + targetUnit
@@ -415,7 +415,6 @@ test('precision', () => {
415415
});
416416

417417
test('falsey precision', () => {
418-
assert.is(convertUnit(10, 'px', 'cm', false), 0.26458333333333334);
418+
assert.strictEqual(convertUnit(10, 'px', 'cm', false), 0.26458333333333334);
419419
});
420420

421-
test.run();

test/index.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
2-
const { test } = require('uvu');
3-
const assert = require('uvu/assert');
2+
const { test } = require('node:test');
3+
const assert = require('node:assert/strict');
44
const postcss = require('postcss');
55

66
const reduceCalc = require('../src/index.js');
@@ -16,7 +16,7 @@ function testValue(fixture, expected, opts = {}) {
1616
fixture,
1717
postcssOpts
1818
);
19-
assert.is(result.css, expected);
19+
assert.strictEqual(result.css, expected);
2020
};
2121
}
2222

@@ -26,7 +26,7 @@ function testCss(fixture, expected, opts = {}) {
2626
fixture,
2727
postcssOpts
2828
);
29-
assert.is(result.css, expected);
29+
assert.strictEqual(result.css, expected);
3030
};
3131
}
3232

@@ -40,8 +40,8 @@ function testThrows(fixture, expected, warning, opts = {}) {
4040
postcssOpts
4141
);
4242
const warnings = result.warnings();
43-
assert.is(result.css, expected);
44-
assert.is(warnings[0].text, warning);
43+
assert.strictEqual(result.css, expected);
44+
assert.strictEqual(warnings[0].text, warning);
4545
};
4646
}
4747

@@ -910,5 +910,3 @@ test(
910910
'Lexical error on line 1: Unrecognized text.\n\n Erroneous area:\n1: 10pc + unknown\n^.........^'
911911
)
912912
);
913-
914-
test.run();

0 commit comments

Comments
 (0)