Skip to content

Commit

Permalink
test: convert tests to use built-in Node.js runner
Browse files Browse the repository at this point in the history
  • Loading branch information
ludofischer committed Apr 26, 2024
1 parent 643b9c6 commit f975011
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 64 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"prepare": "pnpm run build && tsc",
"build": "jison ./parser.jison -o src/parser.js",
"lint": "eslint . && tsc",
"test": "uvu test"
"test": "node --test"
},
"author": "Andy Jansson",
"license": "MIT",
Expand All @@ -39,8 +39,7 @@
"jison-gho": "^0.6.1-216",
"postcss": "^8.4.38",
"prettier": "^3.2.5",
"typescript": "~5.4.5",
"uvu": "^0.5.6"
"typescript": "~5.4.5"
},
"dependencies": {
"postcss-selector-parser": "^6.0.16",
Expand Down
47 changes: 0 additions & 47 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions test/convertUnit.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
const { test } = require('uvu');
const assert = require('uvu/assert');
const { test } = require('node:test');
const assert = require('node:assert/strict');

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

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

assert.is(
assert.strictEqual(
convertUnit(value, unit, targetUnit),
expected,
unit + ' -> ' + targetUnit
Expand Down Expand Up @@ -406,7 +406,7 @@ test('precision', () => {
const expected = e[2];
const targetUnit = e[3];

assert.is(
assert.strictEqual(
convertUnit(value, unit, targetUnit, precision),
expected,
unit + ' -> ' + targetUnit
Expand All @@ -415,7 +415,6 @@ test('precision', () => {
});

test('falsey precision', () => {
assert.is(convertUnit(10, 'px', 'cm', false), 0.26458333333333334);
assert.strictEqual(convertUnit(10, 'px', 'cm', false), 0.26458333333333334);
});

test.run();
14 changes: 6 additions & 8 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
const { test } = require('uvu');
const assert = require('uvu/assert');
const { test } = require('node:test');
const assert = require('node:assert/strict');
const postcss = require('postcss');

const reduceCalc = require('../src/index.js');
Expand All @@ -16,7 +16,7 @@ function testValue(fixture, expected, opts = {}) {
fixture,
postcssOpts
);
assert.is(result.css, expected);
assert.strictEqual(result.css, expected);
};
}

Expand All @@ -26,7 +26,7 @@ function testCss(fixture, expected, opts = {}) {
fixture,
postcssOpts
);
assert.is(result.css, expected);
assert.strictEqual(result.css, expected);
};
}

Expand All @@ -40,8 +40,8 @@ function testThrows(fixture, expected, warning, opts = {}) {
postcssOpts
);
const warnings = result.warnings();
assert.is(result.css, expected);
assert.is(warnings[0].text, warning);
assert.strictEqual(result.css, expected);
assert.strictEqual(warnings[0].text, warning);
};
}

Expand Down Expand Up @@ -910,5 +910,3 @@ test(
'Lexical error on line 1: Unrecognized text.\n\n Erroneous area:\n1: 10pc + unknown\n^.........^'
)
);

test.run();

0 comments on commit f975011

Please sign in to comment.