From 6f134fca336a42b9a91321832fc9262d515025c0 Mon Sep 17 00:00:00 2001 From: Ludovico Fischer <43557+ludofischer@users.noreply.github.com> Date: Sat, 27 Apr 2024 16:53:27 +0200 Subject: [PATCH] test: migrate to built-in Node.js test runner (#1611) * test: migrate to built-in Node.js test runner * test: drop separate helpers testing step Since minimum requirements are Node.js 18, helpers should be able to run together. --- .github/workflows/test.yml | 20 ----- package.json | 6 +- .../test/autoprefixer.js | 3 +- .../test/integrations.js | 7 +- .../test/css-declaration-sorter.js | 3 +- .../test/integrations.js | 7 +- packages/cssnano-preset-lite/test/index.js | 3 +- .../cssnano-preset-lite/test/integrations.js | 3 +- .../cssnano-utils/test/getArguments.test.js | 7 +- .../cssnano-utils/test/sameParent.test.js | 25 +++--- packages/cssnano/test/_processCss.js | 4 +- packages/cssnano/test/api.js | 9 +-- .../test/config_loading/config-loading.js | 9 +-- packages/cssnano/test/fixtures.js | 3 +- packages/cssnano/test/issue26.js | 7 +- packages/cssnano/test/issue315.js | 7 +- packages/cssnano/test/issue420.js | 7 +- packages/cssnano/test/issue579.js | 7 +- packages/cssnano/test/issue927.js | 9 +-- packages/cssnano/test/knownIssues.js | 3 +- packages/cssnano/test/plugins_config.js | 60 ++++++++------ packages/cssnano/test/postcss-calc.js | 3 +- packages/cssnano/test/postcss-colormin.js | 4 +- .../cssnano/test/postcss-convert-values.js | 3 +- .../cssnano/test/postcss-discard-comments.js | 3 +- .../test/postcss-discard-duplicates.js | 3 +- .../test/postcss-discard-overridden.js | 3 +- .../cssnano/test/postcss-merge-longhand.js | 3 +- packages/cssnano/test/postcss-merge-rules.js | 3 +- .../test/postcss-minify-font-values.js | 4 +- .../test/postcss-minify-font-weight.js | 3 +- .../cssnano/test/postcss-minify-gradients.js | 3 +- .../cssnano/test/postcss-minify-params.js | 3 +- .../cssnano/test/postcss-minify-selectors.js | 3 +- .../cssnano/test/postcss-normalize-url.js | 3 +- .../test/postcss-normalize-whitespace.js | 4 +- .../cssnano/test/postcss-reduce-transforms.js | 3 +- packages/cssnano/test/postcss-svgo.js | 3 +- packages/cssnano/test/presets.js | 27 +++---- packages/postcss-colormin/test/index.js | 4 +- packages/postcss-colormin/test/minifyColor.js | 33 ++++---- packages/postcss-convert-values/test/index.js | 3 +- .../postcss-discard-comments/test/index.js | 3 +- .../postcss-discard-duplicates/test/index.js | 3 +- packages/postcss-discard-empty/test/index.js | 7 +- .../postcss-discard-overridden/test/index.js | 7 +- packages/postcss-discard-unused/test/index.js | 3 +- .../postcss-discard-unused/test/namespace.js | 3 +- packages/postcss-merge-idents/test/index.js | 3 +- packages/postcss-merge-longhand/test/api.js | 7 +- .../postcss-merge-longhand/test/borders.js | 3 +- .../postcss-merge-longhand/test/boxBase.js | 3 +- .../postcss-merge-longhand/test/columns.js | 3 +- packages/postcss-merge-rules/test/index.js | 9 +-- .../postcss-minify-font-values/test/index.js | 3 +- .../test/minify-family.js | 7 +- .../test/minify-font.js | 6 +- .../test/minify-weight.js | 13 ++- .../postcss-minify-gradients/test/index.js | 3 +- .../test/isColorStop.js | 17 ++-- packages/postcss-minify-params/test/index.js | 3 +- .../postcss-minify-selectors/test/index.js | 9 +-- .../postcss-normalize-charset/test/index.js | 7 +- .../test/index.js | 3 +- .../postcss-normalize-positions/test/index.js | 3 +- .../test/index.js | 3 +- .../postcss-normalize-string/test/index.js | 3 +- .../test/index.js | 3 +- .../postcss-normalize-unicode/test/index.js | 3 +- packages/postcss-normalize-url/test/index.js | 4 +- .../postcss-normalize-url/test/normalize.js | 32 ++++---- .../test/index.js | 3 +- packages/postcss-ordered-values/test/index.js | 3 +- packages/postcss-ordered-values/test/rules.js | 21 ++--- packages/postcss-reduce-idents/test/index.js | 17 ++-- .../postcss-reduce-initial/script/test/io.mjs | 19 ++--- .../script/test/mdnCssProps.mjs | 80 +++++++------------ packages/postcss-reduce-initial/test/index.js | 4 +- .../postcss-reduce-transforms/test/index.js | 3 +- packages/postcss-svgo/test/index.js | 15 ++-- .../postcss-unique-selectors/test/index.js | 3 +- packages/postcss-zindex/test/index.js | 3 +- packages/stylehacks/test/_processCSS.js | 6 +- packages/stylehacks/test/api.js | 19 +++-- packages/stylehacks/test/bodyEmpty.js | 3 +- .../test/htmlCombinatorCommentBody.js | 3 +- packages/stylehacks/test/htmlFirstChild.js | 3 +- packages/stylehacks/test/important.js | 3 +- packages/stylehacks/test/issue8.js | 7 +- packages/stylehacks/test/leadingStar.js | 3 +- packages/stylehacks/test/leadingUnderscore.js | 3 +- packages/stylehacks/test/mediaSlash0.js | 3 +- packages/stylehacks/test/mediaSlash0Slash9.js | 3 +- packages/stylehacks/test/mediaSlash9.js | 3 +- packages/stylehacks/test/slash9.js | 3 +- packages/stylehacks/test/starHtml.js | 3 +- .../stylehacks/test/trailingSlashComma.js | 3 +- pnpm-lock.yaml | 35 -------- util/integrationTestHelpers.js | 4 +- util/testHelpers.js | 6 +- 100 files changed, 316 insertions(+), 474 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c51cfc694..fc1f78735 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,26 +29,6 @@ jobs: - name: Run lint run: pnpm lint - test_helpers: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.3 - - name: Install pnpm - uses: pnpm/action-setup@v3.0.0 - with: - version: 9.0.6 - - name: Install Node.js 20.x - uses: actions/setup-node@v4.0.2 - with: - node-version: '20' - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Test helpers - run: pnpm test:helpers - test: needs: lint runs-on: ${{ matrix.os }} diff --git a/package.json b/package.json index c553f98a9..f1422bf9c 100644 --- a/package.json +++ b/package.json @@ -6,10 +6,9 @@ "fixlint": "prettier --write . && pnpm lint -- --fix", "build:integration": "node ./util/buildFrameworks.mjs", "pretest": "pnpm lint", - "test:only": "uvu packages \"test.*\\.js$\"", + "test:only": "node --test", "test:coverage": "c8 pnpm test:only", "test": "pnpm test:coverage", - "test:helpers": "uvu packages \"test.*\\.mjs$\"", "types": "tsc -b", "all-publish": "pnpm changeset publish" }, @@ -29,8 +28,7 @@ "postcss": "^8.4.38", "postcss-font-magician": "^4.0.0", "prettier": "^3.2.5", - "typescript": "~5.4.5", - "uvu": "^0.5.6" + "typescript": "~5.4.5" }, "browserslist": { "production": [ diff --git a/packages/cssnano-preset-advanced/test/autoprefixer.js b/packages/cssnano-preset-advanced/test/autoprefixer.js index 0fa152eb6..2a114a633 100644 --- a/packages/cssnano-preset-advanced/test/autoprefixer.js +++ b/packages/cssnano-preset-advanced/test/autoprefixer.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { processCSSWithPresetFactory, } = require('../../../util/integrationTestHelpers.js'); @@ -38,4 +38,3 @@ test( 'should not remove outdated vendor prefixes if excluded', exclude('h1{-webkit-box-sizing:content-box;box-sizing:content-box}') ); -test.run(); diff --git a/packages/cssnano-preset-advanced/test/integrations.js b/packages/cssnano-preset-advanced/test/integrations.js index 690b1be93..265f4e4c7 100644 --- a/packages/cssnano-preset-advanced/test/integrations.js +++ b/packages/cssnano-preset-advanced/test/integrations.js @@ -1,7 +1,7 @@ 'use strict'; const { join } = require('path'); -const { test } = require('uvu'); -const assert = require('uvu/assert'); +const { test } = require('node:test'); +const assert = require('node:assert/strict'); const { integrationTests, loadPreset, @@ -51,11 +51,10 @@ function excludeProcessor(options) { loadPreset(preset(options)) .process(input, { from: undefined }) .then(({ css }) => { - assert.is(css, input); + assert.strictEqual(css, input); }); } test('exclude zindex', excludeProcessor({ zindex: false })); test('exclude zindex #1', excludeProcessor({ zindex: { exclude: true } })); -test.run(); diff --git a/packages/cssnano-preset-default/test/css-declaration-sorter.js b/packages/cssnano-preset-default/test/css-declaration-sorter.js index cb9502d41..fe5594ac5 100644 --- a/packages/cssnano-preset-default/test/css-declaration-sorter.js +++ b/packages/cssnano-preset-default/test/css-declaration-sorter.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { processCSSWithPresetFactory, } = require('../../../util/integrationTestHelpers.js'); @@ -149,4 +149,3 @@ test( 'a{border:0;border-top:3px solid}' ) ); -test.run(); diff --git a/packages/cssnano-preset-default/test/integrations.js b/packages/cssnano-preset-default/test/integrations.js index 196da8970..d8121db66 100644 --- a/packages/cssnano-preset-default/test/integrations.js +++ b/packages/cssnano-preset-default/test/integrations.js @@ -1,7 +1,7 @@ 'use strict'; const { join } = require('path'); -const { test } = require('uvu'); -const assert = require('uvu/assert'); +const { test } = require('node:test'); +const assert = require('node:assert/strict'); const { integrationTests, loadPreset, @@ -45,11 +45,10 @@ function excludeProcessor(options) { loadPreset(preset(options)) .process(input, { from: undefined }) .then(({ css }) => { - assert.is(css, input); + assert.strictEqual(css, input); }); } test('exclude colormin', excludeProcessor({ colormin: false })); test('exclude colormin #1', excludeProcessor({ colormin: { exclude: true } })); -test.run(); diff --git a/packages/cssnano-preset-lite/test/index.js b/packages/cssnano-preset-lite/test/index.js index a463fd303..4f3ad5432 100644 --- a/packages/cssnano-preset-lite/test/index.js +++ b/packages/cssnano-preset-lite/test/index.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { processCSSWithPresetFactory, } = require('../../../util/integrationTestHelpers.js'); @@ -64,4 +64,3 @@ test( '' ) ); -test.run(); diff --git a/packages/cssnano-preset-lite/test/integrations.js b/packages/cssnano-preset-lite/test/integrations.js index 4ac22b89f..46616c002 100644 --- a/packages/cssnano-preset-lite/test/integrations.js +++ b/packages/cssnano-preset-lite/test/integrations.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { integrationTests } = require('../../../util/integrationTestHelpers.js'); const preset = require('..'); @@ -7,4 +7,3 @@ test( 'should correctly handle the framework tests', integrationTests(preset, `${__dirname}/integrations`) ); -test.run(); diff --git a/packages/cssnano-utils/test/getArguments.test.js b/packages/cssnano-utils/test/getArguments.test.js index 3959a603b..3053c70f6 100644 --- a/packages/cssnano-utils/test/getArguments.test.js +++ b/packages/cssnano-utils/test/getArguments.test.js @@ -1,13 +1,13 @@ 'use strict'; -const { test } = require('uvu'); -const assert = require('uvu/assert'); +const { test } = require('node:test'); +const assert = require('node:assert/strict'); const valueParser = require('postcss-value-parser'); const getArguments = require('../src/getArguments.js'); test('should get arguments', () => { const parsed = valueParser('linear-gradient(to bottom left, red, blue)'); - assert.equal(getArguments(parsed.nodes[0]), [ + assert.deepStrictEqual(getArguments(parsed.nodes[0]), [ [ { type: 'word', @@ -58,4 +58,3 @@ test('should get arguments', () => { ], ]); }); -test.run(); diff --git a/packages/cssnano-utils/test/sameParent.test.js b/packages/cssnano-utils/test/sameParent.test.js index ff3e79662..bc7c3dffa 100644 --- a/packages/cssnano-utils/test/sameParent.test.js +++ b/packages/cssnano-utils/test/sameParent.test.js @@ -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 sameParent = require('../src/sameParent.js'); @@ -11,7 +11,7 @@ test('should calculate same parent', () => { const h1 = result.root.nodes[0]; const h2 = result.root.nodes[1]; - assert.is(sameParent(h1, h2), true); + assert.strictEqual(sameParent(h1, h2), true); }); }); @@ -25,7 +25,7 @@ test('should calculate same parent (detached nodes)', () => { h1.remove(); h2.remove(); - assert.is(sameParent(h1, h2), true); + assert.strictEqual(sameParent(h1, h2), true); }); }); @@ -39,7 +39,7 @@ test('should calculate same parent (at rules)', () => { const h1 = result.root.nodes[0].nodes[0]; const h2 = result.root.nodes[0].nodes[1]; - assert.is(sameParent(h1, h2), true); + assert.strictEqual(sameParent(h1, h2), true); }); }); @@ -53,7 +53,7 @@ test('should calculate same parent (multiple at rules)', () => { const h1 = result.root.nodes[0].nodes[0]; const h2 = result.root.nodes[1].nodes[0]; - assert.is(sameParent(h1, h2), true); + assert.strictEqual(sameParent(h1, h2), true); }); }); @@ -67,7 +67,7 @@ test('should calculate same parent (multiple at rules (uppercase))', () => { const h1 = result.root.nodes[0].nodes[0]; const h2 = result.root.nodes[1].nodes[0]; - assert.is(sameParent(h1, h2), true); + assert.strictEqual(sameParent(h1, h2), true); }); }); @@ -92,7 +92,7 @@ test('should calculate same parent (nested at rules)', () => { const h1 = result.root.nodes[0].nodes[0].nodes[0]; const h2 = result.root.nodes[1].nodes[0].nodes[0]; - assert.is(sameParent(h1, h2), true); + assert.strictEqual(sameParent(h1, h2), true); }); }); @@ -117,7 +117,7 @@ test('should calculate not same parent (nested at rules)', () => { const h1 = result.root.nodes[0].nodes[0].nodes[0]; const h2 = result.root.nodes[1].nodes[0].nodes[0]; - assert.is.not(sameParent(h1, h2), true); + assert.notStrictEqual(sameParent(h1, h2), true); }); }); @@ -142,7 +142,7 @@ test('should calculate not same parent (nested at rules) (2)', () => { const h1 = result.root.nodes[0].nodes[0].nodes[0]; const h2 = result.root.nodes[1].nodes[0].nodes[0]; - assert.is.not(sameParent(h1, h2), true); + assert.notStrictEqual(sameParent(h1, h2), true); }); }); @@ -165,7 +165,7 @@ test('should calculate not same parent (nested at rules) (3)', () => { const h1 = result.root.nodes[0].nodes[0]; const h2 = result.root.nodes[1].nodes[0].nodes[0]; - assert.is.not(sameParent(h1, h2), true); + assert.notStrictEqual(sameParent(h1, h2), true); }); }); @@ -188,7 +188,6 @@ test('should calculate not same parent (nested at rules) (4)', () => { const h1 = result.root.nodes[0].nodes[0]; const h2 = result.root.nodes[1].nodes[0].nodes[0]; - assert.is.not(sameParent(h1, h2), true); + assert.notStrictEqual(sameParent(h1, h2), true); }); }); -test.run(); diff --git a/packages/cssnano/test/_processCss.js b/packages/cssnano/test/_processCss.js index 153ce5297..e4d707ae7 100644 --- a/packages/cssnano/test/_processCss.js +++ b/packages/cssnano/test/_processCss.js @@ -1,5 +1,5 @@ 'use strict'; -const assert = require('uvu/assert'); +const assert = require('node:assert/strict'); const postcss = require('postcss'); const cssnano = require('..'); @@ -8,7 +8,7 @@ function processCss(fixture, expected, options = { from: undefined }) { postcss([cssnano()]) .process(fixture, options) .then(({ css }) => { - assert.is(css, expected); + assert.strictEqual(css, expected); }); } module.exports = processCss; diff --git a/packages/cssnano/test/api.js b/packages/cssnano/test/api.js index bba04c95c..5835546a8 100644 --- a/packages/cssnano/test/api.js +++ b/packages/cssnano/test/api.js @@ -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 nano = require('..'); @@ -10,7 +10,7 @@ function pluginMacro(instance) { return () => instance.process(css, { from: undefined }).then((result) => { - assert.is(result.css, min); + assert.strictEqual(result.css, min); }); } @@ -28,10 +28,9 @@ test('should work with sourcemaps', () => { return postcss([nano]) .process('h1{z-index:1}', { from: undefined, map: { inline: true } }) .then(({ css }) => { - assert.is( + assert.strictEqual( /sourceMappingURL=data:application\/json;base64/.test(css), true ); }); }); -test.run(); diff --git a/packages/cssnano/test/config_loading/config-loading.js b/packages/cssnano/test/config_loading/config-loading.js index 86a0960aa..dc82856c8 100644 --- a/packages/cssnano/test/config_loading/config-loading.js +++ b/packages/cssnano/test/config_loading/config-loading.js @@ -1,7 +1,7 @@ 'use strict'; const process = require('process'); -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 litePreset = require('cssnano-preset-lite'); const defaultPreset = require('cssnano-preset-default'); @@ -23,11 +23,10 @@ test.after(() => { test('should read the cssnano configuration file', () => { const processor = postcss([cssnano]); - assert.is(processor.plugins.length, litePreset().plugins.length); + assert.strictEqual(processor.plugins.length, litePreset().plugins.length); }); test('PostCSS config should override the cssnano config', () => { const processor = postcss([cssnano({ preset: 'default' })]); - assert.is(processor.plugins.length, defaultPreset().plugins.length); + assert.strictEqual(processor.plugins.length, defaultPreset().plugins.length); }); -test.run(); diff --git a/packages/cssnano/test/fixtures.js b/packages/cssnano/test/fixtures.js index 959a24f30..1d16d38e4 100644 --- a/packages/cssnano/test/fixtures.js +++ b/packages/cssnano/test/fixtures.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCss = require('./_processCss'); test( @@ -358,4 +358,3 @@ test( 'should remove leading zeroes from reduced calc values', processCss(`.box { margin: calc(-.5 * 1rem); }`, `.box{margin:-.5rem}`) ); -test.run(); diff --git a/packages/cssnano/test/issue26.js b/packages/cssnano/test/issue26.js index 2fa498534..b72ed6309 100644 --- a/packages/cssnano/test/issue26.js +++ b/packages/cssnano/test/issue26.js @@ -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 nano = require('..'); @@ -44,6 +44,5 @@ test('it should compress whitespace after node.clone()', () => { return processor .process(fixture, { from: undefined }) - .then((r) => assert.is(r.css, expected)); + .then((r) => assert.strictEqual(r.css, expected)); }); -test.run(); diff --git a/packages/cssnano/test/issue315.js b/packages/cssnano/test/issue315.js index 330badcf1..f08a8f885 100644 --- a/packages/cssnano/test/issue315.js +++ b/packages/cssnano/test/issue315.js @@ -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 fontMagician = require('postcss-font-magician'); const cssnano = require('..'); @@ -14,10 +14,9 @@ test('should work with postcss-font-magician', () => { return postcss([fontMagician({}), cssnano()]) .process(css, { from: undefined }) .then((result) => { - assert.snapshot( + assert.strictEqual( result.css, `@font-face{font-family:Alice;font-style:normal;font-weight:400;src:url(//fonts.gstatic.com/s/alice/v20/OpNCnoEEmtHa6GcArgo.eot?#) format("eot"),url(//fonts.gstatic.com/s/alice/v20/OpNCnoEEmtHa6GcOrg4.woff2) format("woff2"),url(//fonts.gstatic.com/s/alice/v20/OpNCnoEEmtHa6GcArgg.woff) format("woff")}body{font-family:Alice}` ); }); }); -test.run(); diff --git a/packages/cssnano/test/issue420.js b/packages/cssnano/test/issue420.js index 2f16a951c..2fe629af0 100644 --- a/packages/cssnano/test/issue420.js +++ b/packages/cssnano/test/issue420.js @@ -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 fontMagician = require('postcss-font-magician'); const cssnano = require('..'); @@ -15,10 +15,9 @@ test('should work with postcss-font-magician with `display` parameter', () => { return postcss([fontMagician({ display: 'optional' }), cssnano()]) .process(css, { from: undefined }) .then((result) => { - assert.snapshot( + assert.strictEqual( result.css, `@font-face{font-display:optional;font-family:Alice;font-style:normal;font-weight:400;src:url(//fonts.gstatic.com/s/alice/v20/OpNCnoEEmtHa6GcArgo.eot?#) format("eot"),url(//fonts.gstatic.com/s/alice/v20/OpNCnoEEmtHa6GcOrg4.woff2) format("woff2"),url(//fonts.gstatic.com/s/alice/v20/OpNCnoEEmtHa6GcArgg.woff) format("woff")}body{font-family:Alice}` ); }); }); -test.run(); diff --git a/packages/cssnano/test/issue579.js b/packages/cssnano/test/issue579.js index 8b1ffe03f..c1c870109 100644 --- a/packages/cssnano/test/issue579.js +++ b/packages/cssnano/test/issue579.js @@ -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 cssnano = require('..'); @@ -16,10 +16,9 @@ test('should support `env()` and `constant()` is an iPhone X-only feature', () = return postcss([cssnano]) .process(css, { from: undefined }) .then((result) => { - assert.is( + assert.strictEqual( result.css, '@supports (height:env(safe-area-inset-bottom)){.footer{padding-bottom:calc(env(safe-area-inset-bottom)*3)!important}}' ); }); }); -test.run(); diff --git a/packages/cssnano/test/issue927.js b/packages/cssnano/test/issue927.js index 445d3236f..b730e94bf 100644 --- a/packages/cssnano/test/issue927.js +++ b/packages/cssnano/test/issue927.js @@ -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 nano = require('..'); @@ -30,7 +30,7 @@ test('it should compress the columns (old plugin syntax)', () => { return processor .process(fixture, { from: undefined }) - .then((r) => assert.is(r.css, expected)); + .then((r) => assert.strictEqual(r.css, expected)); }); test('it should compress the columns (new plugin syntax)', () => { @@ -51,6 +51,5 @@ test('it should compress the columns (new plugin syntax)', () => { return processor .process(fixture, { from: undefined }) - .then((r) => assert.is(r.css, expected)); + .then((r) => assert.strictEqual(r.css, expected)); }); -test.run(); diff --git a/packages/cssnano/test/knownIssues.js b/packages/cssnano/test/knownIssues.js index 192b2c1c4..ddb4af8cf 100644 --- a/packages/cssnano/test/knownIssues.js +++ b/packages/cssnano/test/knownIssues.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCss = require('./_processCss'); /* @@ -33,4 +33,3 @@ test.skip( `\\64 \\69 \\76 { \\63 \\6f \\6c \\6f \\72 : \\72 \\67 \\62 \\61 \\28 \\32 \\35 \\35 \\2c \\30 \\2c \\30 \\2c \\2e \\37 \\35 \\29 }`, `\\64\\69\\76{\\63\\6f\\6c\\6f\\72:\\72\\67\\62\\61\\28\\32\\35\\35\\2c\\30\\2c\\30\\2c\\2e\\37\\35\\29}` ); -test.run(); diff --git a/packages/cssnano/test/plugins_config.js b/packages/cssnano/test/plugins_config.js index 9f583d053..450fd7286 100644 --- a/packages/cssnano/test/plugins_config.js +++ b/packages/cssnano/test/plugins_config.js @@ -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 litePreset = require('cssnano-preset-lite'); const autoprefixer = require('autoprefixer'); @@ -21,7 +21,7 @@ test('should run the plugins in the preset', () => { { from: undefined } ) .then((result) => { - assert.is( + assert.strictEqual( result.css, `.example{display:grid;transition:all .5s;user-select:none;background:linear-gradient(to bottom,white,black)}` ); @@ -43,7 +43,7 @@ test('should run the plugins in the first preset in an array', () => { { from: undefined } ) .then((result) => { - assert.is( + assert.strictEqual( result.css, `.example{display:grid;transition:all .5s;user-select:none;background:linear-gradient(to bottom,white,black)}` ); @@ -65,7 +65,7 @@ test('should run the plugin passed through the cssnano config.plugins', () => { { from: undefined } ) .then((result) => { - assert.is( + assert.strictEqual( result.css, `.example{display:grid;transition:all .5s;-ms-user-select:none;user-select:none;background:linear-gradient(to bottom,white,black)}` ); @@ -81,7 +81,10 @@ test('should run the plugin when plugin module is being used with no array insid { from: undefined } ) .then((result) => { - assert.is(result.css, `.example{-ms-user-select:none;user-select:none}`); + assert.strictEqual( + result.css, + `.example{-ms-user-select:none;user-select:none}` + ); }); }); @@ -93,7 +96,7 @@ test('should run the plugin when no preset is mentioned', () => { { from: undefined } ) .then((result) => { - assert.is( + assert.strictEqual( result.css, `.example { -ms-user-select: none; user-select: none; } ` @@ -109,7 +112,7 @@ test('should run the plugin when no preset is mentioned with string plugin name' { from: undefined } ) .then((result) => { - assert.is( + assert.strictEqual( result.css, `.example { -ms-user-select: none; user-select: none; } ` @@ -125,7 +128,7 @@ test('should run the plugin when no preset is mentioned with string plugin name { from: undefined } ) .then((result) => { - assert.is( + assert.strictEqual( result.css, `.example { -ms-user-select: none; user-select: none; } ` @@ -142,7 +145,10 @@ test('should run the plugin with string plugin name as in array', () => { { from: undefined } ) .then((result) => { - assert.is(result.css, `.example{-ms-user-select:none;user-select:none}`); + assert.strictEqual( + result.css, + `.example{-ms-user-select:none;user-select:none}` + ); }); }); @@ -154,7 +160,7 @@ test('should run the plugin when no preset is mentioned with string plugin name { from: undefined } ) .then((result) => { - assert.is( + assert.strictEqual( result.css, `.example { -ms-user-select: none; user-select: none; } ` @@ -173,7 +179,10 @@ test('should run the plugin with string plugin name as in array and options', () { from: undefined } ) .then((result) => { - assert.is(result.css, `.example{-ms-user-select:none;user-select:none}`); + assert.strictEqual( + result.css, + `.example{-ms-user-select:none;user-select:none}` + ); }); }); @@ -187,7 +196,7 @@ test('should run the plugin when preset is empty array and plugin module as in a { from: undefined } ) .then((result) => { - assert.is( + assert.strictEqual( result.css, `.example { -ms-user-select: none; user-select: none; } ` @@ -204,7 +213,10 @@ test('should run the plugin plugin module as in array in plugins array', () => { { from: undefined } ) .then((result) => { - assert.is(result.css, `.example{-ms-user-select:none;user-select:none}`); + assert.strictEqual( + result.css, + `.example{-ms-user-select:none;user-select:none}` + ); }); }); @@ -219,7 +231,10 @@ test('should run the plugin plugin module as in array in plugins array with empt { from: undefined } ) .then((result) => { - assert.is(result.css, `.example{-ms-user-select:none;user-select:none}`); + assert.strictEqual( + result.css, + `.example{-ms-user-select:none;user-select:none}` + ); }); }); @@ -231,7 +246,7 @@ test('should run the plugin when preset is empty array and plugin module as in n { from: undefined } ) .then((result) => { - assert.is( + assert.strictEqual( result.css, `.example { -ms-user-select: none; user-select: none; } ` @@ -247,7 +262,7 @@ test('should run the plugin when preset is empty array and plugin as string as i { from: undefined } ) .then((result) => { - assert.is( + assert.strictEqual( result.css, `.example { -ms-user-select: none; user-select: none; } ` @@ -265,7 +280,7 @@ test('should run the plugin when preset is empty array', () => { { from: undefined } ) .then((result) => { - assert.is( + assert.strictEqual( result.css, `.example { -ms-user-select: none; user-select: none; } ` @@ -283,7 +298,7 @@ test('should run the plugin when preset is empty array with string as a plugin', { from: undefined } ) .then((result) => { - assert.is( + assert.strictEqual( result.css, `.example { -ms-user-select: none; user-select: none; } ` @@ -301,7 +316,7 @@ test('should run the plugin when preset is empty array with options', () => { { from: undefined } ) .then((result) => { - assert.is( + assert.strictEqual( result.css, `.example { user-select: none; } ` @@ -320,7 +335,7 @@ test('should run the plugin when preset is empty array with options and string a { preset: [], plugins: [['autoprefixer', { add: false }]] } ) .then((result) => { - assert.is( + assert.strictEqual( result.css, `.example { user-select: none; } ` @@ -336,11 +351,10 @@ test('should run the plugin when preset is empty array with options and string a { from: undefined } ) .then((result) => { - assert.is( + assert.strictEqual( result.css, `.example { -ms-user-select: none; user-select: none; } ` ); }); }); -test.run(); diff --git a/packages/cssnano/test/postcss-calc.js b/packages/cssnano/test/postcss-calc.js index 38a8bc487..52174e534 100644 --- a/packages/cssnano/test/postcss-calc.js +++ b/packages/cssnano/test/postcss-calc.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCss = require('./_processCss'); test( @@ -103,4 +103,3 @@ test( 'h1{width:calc(100% - var(--my-var))}' ) ); -test.run(); diff --git a/packages/cssnano/test/postcss-colormin.js b/packages/cssnano/test/postcss-colormin.js index b911cdbeb..3d8cd084b 100644 --- a/packages/cssnano/test/postcss-colormin.js +++ b/packages/cssnano/test/postcss-colormin.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCss = require('./_processCss'); test( @@ -92,5 +92,3 @@ test( 'h1{FILTER:progid:DXImageTransform.Microsoft.gradient(startColorstr= #000000,endColorstr= #ffffff)}' ) ); - -test.run(); diff --git a/packages/cssnano/test/postcss-convert-values.js b/packages/cssnano/test/postcss-convert-values.js index 0d1a9af82..dd116d9e0 100644 --- a/packages/cssnano/test/postcss-convert-values.js +++ b/packages/cssnano/test/postcss-convert-values.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCss = require('./_processCss'); test( @@ -110,4 +110,3 @@ test( 'should support viewports units', processCss('h1,h2{letter-spacing:-0.1vmin}', 'h1,h2{letter-spacing:-.1vmin}') ); -test.run(); diff --git a/packages/cssnano/test/postcss-discard-comments.js b/packages/cssnano/test/postcss-discard-comments.js index 98b34abd0..3508facf7 100644 --- a/packages/cssnano/test/postcss-discard-comments.js +++ b/packages/cssnano/test/postcss-discard-comments.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCss = require('./_processCss'); test( @@ -119,4 +119,3 @@ test( "should pass through when it doesn't find a comment", processCss('h1{color:#000;font-weight:700}', 'h1{color:#000;font-weight:700}') ); -test.run(); diff --git a/packages/cssnano/test/postcss-discard-duplicates.js b/packages/cssnano/test/postcss-discard-duplicates.js index 7be1605b8..4729f7fe5 100644 --- a/packages/cssnano/test/postcss-discard-duplicates.js +++ b/packages/cssnano/test/postcss-discard-duplicates.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCss = require('./_processCss'); test( @@ -48,4 +48,3 @@ test( 'h1{display:block}@media print{h1{display:block}}' ) ); -test.run(); diff --git a/packages/cssnano/test/postcss-discard-overridden.js b/packages/cssnano/test/postcss-discard-overridden.js index 59bb322ab..13605035e 100644 --- a/packages/cssnano/test/postcss-discard-overridden.js +++ b/packages/cssnano/test/postcss-discard-overridden.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCss = require('./_processCss'); test( @@ -17,4 +17,3 @@ test( '@media screen and (max-width:500px){@keyframes a{0%{transform:rotate(0deg)}to{transform:rotate(358deg)}}}@keyframes a{0%{transform:rotate(0deg)}to{transform:rotate(359deg)}}.box{animation-name:a}' ) ); -test.run(); diff --git a/packages/cssnano/test/postcss-merge-longhand.js b/packages/cssnano/test/postcss-merge-longhand.js index 763eca267..abe6bfff0 100644 --- a/packages/cssnano/test/postcss-merge-longhand.js +++ b/packages/cssnano/test/postcss-merge-longhand.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCss = require('./_processCss'); test( @@ -219,4 +219,3 @@ test( 'h1{padding:10px 15px 20px 25px;padding-left:var(--variable);padding-top:var(--variable)}' ) ); -test.run(); diff --git a/packages/cssnano/test/postcss-merge-rules.js b/packages/cssnano/test/postcss-merge-rules.js index 554d761ae..3820bffa1 100644 --- a/packages/cssnano/test/postcss-merge-rules.js +++ b/packages/cssnano/test/postcss-merge-rules.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCss = require('./_processCss'); test( @@ -270,4 +270,3 @@ test( '.box1{display:inline-block;display:block}.box2{display:inline-block}' ) ); -test.run(); diff --git a/packages/cssnano/test/postcss-minify-font-values.js b/packages/cssnano/test/postcss-minify-font-values.js index e56d934cd..32586ecf8 100644 --- a/packages/cssnano/test/postcss-minify-font-values.js +++ b/packages/cssnano/test/postcss-minify-font-values.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCss = require('./_processCss'); test( @@ -31,5 +31,3 @@ test( 'should not mangle font names', processCss.passthrough('h1{font-family:Glyphicons Halflings}') ); - -test.run(); diff --git a/packages/cssnano/test/postcss-minify-font-weight.js b/packages/cssnano/test/postcss-minify-font-weight.js index f3d4b238c..b4afea6ec 100644 --- a/packages/cssnano/test/postcss-minify-font-weight.js +++ b/packages/cssnano/test/postcss-minify-font-weight.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCss = require('./_processCss'); test( @@ -16,4 +16,3 @@ test( 'should not update the font-style property', processCss('h1{font-style: normal}', 'h1{font-style:normal}') ); -test.run(); diff --git a/packages/cssnano/test/postcss-minify-gradients.js b/packages/cssnano/test/postcss-minify-gradients.js index 11120f410..54a9afe2b 100644 --- a/packages/cssnano/test/postcss-minify-gradients.js +++ b/packages/cssnano/test/postcss-minify-gradients.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCss = require('./_processCss'); test( @@ -121,4 +121,3 @@ test( 'background:repeating-radial-gradient(#121,#121 5px,#ffe500 0,#ffe500 10px)' ) ); -test.run(); diff --git a/packages/cssnano/test/postcss-minify-params.js b/packages/cssnano/test/postcss-minify-params.js index 485967876..2d7749f3f 100644 --- a/packages/cssnano/test/postcss-minify-params.js +++ b/packages/cssnano/test/postcss-minify-params.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCss = require('./_processCss'); test( @@ -9,4 +9,3 @@ test( '@media only screen and (min-width:400px,min-height:500px){h1{color:#00f}}' ) ); -test.run(); diff --git a/packages/cssnano/test/postcss-minify-selectors.js b/packages/cssnano/test/postcss-minify-selectors.js index caa7f32f5..990d2f29c 100644 --- a/packages/cssnano/test/postcss-minify-selectors.js +++ b/packages/cssnano/test/postcss-minify-selectors.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCss = require('./_processCss'); test( @@ -196,4 +196,3 @@ test( '[a=":not( *.b, h1, h1 )"]{color:#00f}' ) ); -test.run(); diff --git a/packages/cssnano/test/postcss-normalize-url.js b/packages/cssnano/test/postcss-normalize-url.js index a874ada9d..7f1e3f853 100644 --- a/packages/cssnano/test/postcss-normalize-url.js +++ b/packages/cssnano/test/postcss-normalize-url.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCss = require('./_processCss'); test( @@ -164,4 +164,3 @@ test( '@document url(http://www.w3.org/),url-prefix(http://www.w3.org/Style/){body{font-size:2em}}' ) ); -test.run(); diff --git a/packages/cssnano/test/postcss-normalize-whitespace.js b/packages/cssnano/test/postcss-normalize-whitespace.js index e25e0a642..d6d0a55dd 100644 --- a/packages/cssnano/test/postcss-normalize-whitespace.js +++ b/packages/cssnano/test/postcss-normalize-whitespace.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCss = require('./_processCss'); test( @@ -9,5 +9,3 @@ test( 'h1{width:calc(10px - 100px/var(--test))}' ) ); - -test.run(); diff --git a/packages/cssnano/test/postcss-reduce-transforms.js b/packages/cssnano/test/postcss-reduce-transforms.js index 84ffb447c..eaf0d3533 100644 --- a/packages/cssnano/test/postcss-reduce-transforms.js +++ b/packages/cssnano/test/postcss-reduce-transforms.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCss = require('./_processCss'); test( @@ -89,4 +89,3 @@ test( 'h1{-webkit-transform:translateZ(0)}' ) ); -test.run(); diff --git a/packages/cssnano/test/postcss-svgo.js b/packages/cssnano/test/postcss-svgo.js index 0b545966e..365fc560a 100644 --- a/packages/cssnano/test/postcss-svgo.js +++ b/packages/cssnano/test/postcss-svgo.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCss = require('./_processCss'); test( @@ -33,4 +33,3 @@ test( "h1{background:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve'%3E%3Ccircle cx='50' cy='50' r='40' fill='%23ff0'/%3E%3C/svg%3E\")}" ) ); -test.run(); diff --git a/packages/cssnano/test/presets.js b/packages/cssnano/test/presets.js index 9ebd7590e..d420e76d6 100644 --- a/packages/cssnano/test/presets.js +++ b/packages/cssnano/test/presets.js @@ -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 advancedPreset = require('cssnano-preset-advanced'); const defaultPreset = require('cssnano-preset-default'); @@ -12,7 +12,7 @@ test('should accept an invoked preset', () => { return postcss([cssnano({ preset })]) .process(`h1{content:"©"}`, { from: undefined }) .then((result) => { - assert.is(result.css, `@charset "utf-8";h1{content:"©"}`); + assert.strictEqual(result.css, `@charset "utf-8";h1{content:"©"}`); }); }); @@ -22,7 +22,7 @@ test('should accept a non-invoked preset', () => { return postcss([cssnano({ preset })]) .process(`h1{content:"©"}`, { from: undefined }) .then((result) => { - assert.is(result.css, `@charset "utf-8";h1{content:"©"}`); + assert.strictEqual(result.css, `@charset "utf-8";h1{content:"©"}`); }); }); @@ -32,7 +32,7 @@ test('should accept a default preset string', () => { return postcss([cssnano({ preset })]) .process(`h1{content:"©"}`, { from: undefined }) .then((result) => { - assert.is(result.css, `@charset "utf-8";h1{content:"©"}`); + assert.strictEqual(result.css, `@charset "utf-8";h1{content:"©"}`); }); }); @@ -42,7 +42,7 @@ test('should accept an invoked preset other than default', () => { return postcss([cssnano({ preset })]) .process(`h1{z-index:10}`, { from: undefined }) .then((result) => { - assert.is(result.css, `h1{z-index:15}`); + assert.strictEqual(result.css, `h1{z-index:15}`); }); }); @@ -52,7 +52,7 @@ test('should accept a preset string other than default', () => { return postcss([cssnano({ preset })]) .process(`h1{z-index:10}`, { from: undefined }) .then((result) => { - assert.is(result.css, `h1{z-index:1}`); + assert.strictEqual(result.css, `h1{z-index:1}`); }); }); @@ -62,7 +62,7 @@ test('should accept a preset string other than default, with options', () => { return postcss([cssnano({ preset })]) .process(`h1{z-index:10}`, { from: undefined }) .then((result) => { - assert.is(result.css, `h1{z-index:15}`); + assert.strictEqual(result.css, `h1{z-index:15}`); }); }); @@ -72,7 +72,7 @@ test('should accept a preset string other than default (sugar syntax)', () => { return postcss([cssnano({ preset })]) .process(`h1{z-index:10}`, { from: undefined }) .then((result) => { - assert.is(result.css, `h1{z-index:15}`); + assert.strictEqual(result.css, `h1{z-index:15}`); }); }); @@ -82,7 +82,7 @@ test('should be able to exclude plugins', () => { return postcss([cssnano({ preset })]) .process(`h1{z-index:10}`, { from: undefined }) .then((result) => { - assert.is(result.css, `h1{z-index:10}`); + assert.strictEqual(result.css, `h1{z-index:10}`); }); }); @@ -92,7 +92,7 @@ test('should be able to include plugins', () => { return postcss([cssnano({ preset })]) .process(`h1{z-index:10}`, { from: undefined }) .then((result) => { - assert.is(result.css, `h1{z-index:1}`); + assert.strictEqual(result.css, `h1{z-index:1}`); }); }); @@ -102,7 +102,7 @@ test('should be able to exclude plugins (exclude syntax)', () => { return postcss([cssnano({ preset })]) .process(`h1{z-index:10}`, { from: undefined }) .then((result) => { - assert.is(result.css, `h1{z-index:10}`); + assert.strictEqual(result.css, `h1{z-index:10}`); }); }); @@ -117,7 +117,7 @@ test('should be able to exclude pointer-events plugin', () => { }) .process('.selector { pointer-events: initial; }', { from: undefined }) .then((result) => { - assert.is(result.css, '.selector{pointer-events:initial}'); + assert.strictEqual(result.css, '.selector{pointer-events:initial}'); }); }); test('should error on a bad preset', async () => { @@ -130,4 +130,3 @@ test('should error on a bad preset', async () => { assert.ok(error); } }); -test.run(); diff --git a/packages/postcss-colormin/test/index.js b/packages/postcss-colormin/test/index.js index 3478a399a..33a11eb89 100644 --- a/packages/postcss-colormin/test/index.js +++ b/packages/postcss-colormin/test/index.js @@ -1,6 +1,6 @@ 'use strict'; const { join } = require('path'); -const { test } = require('uvu'); +const { test } = require('node:test'); const { usePostCSSPlugin, processCSSFactory, @@ -301,5 +301,3 @@ test( 'should not attempt to convert font names', passthroughCSS('@font-face{src:local(Noto Sans Black)}') ); - -test.run(); diff --git a/packages/postcss-colormin/test/minifyColor.js b/packages/postcss-colormin/test/minifyColor.js index 561c99290..f55b81c62 100644 --- a/packages/postcss-colormin/test/minifyColor.js +++ b/packages/postcss-colormin/test/minifyColor.js @@ -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 minifyColor = require('../src/minifyColor.js'); function min(input, options = {}) { @@ -13,7 +13,7 @@ function min(input, options = {}) { } function isEqual(input, output) { - return () => assert.is(min(input), output); + return () => assert.strictEqual(min(input), output); } test('should lowercase keywords', isEqual('RED', 'red')); @@ -153,30 +153,35 @@ test( ); test('should pass through if not recognised', () => { - assert.is(min('Unrecognised'), 'Unrecognised'); - assert.is(min('inherit'), 'inherit'); + assert.strictEqual(min('Unrecognised'), 'Unrecognised'); + assert.strictEqual(min('inherit'), 'inherit'); }); test('should convert to hex4', () => { - assert.is(min('#aabbcc33', { alphaHex: true }), '#abc3'); - assert.is(min('transparent', { alphaHex: true }), '#0000'); - assert.is(min('rgb(119,119,119,0.2)', { alphaHex: true }), '#7773'); - assert.is(min('hsla(0,0%,100%,.4)', { alphaHex: true }), '#fff6'); + assert.strictEqual(min('#aabbcc33', { alphaHex: true }), '#abc3'); + assert.strictEqual(min('transparent', { alphaHex: true }), '#0000'); + assert.strictEqual(min('rgb(119,119,119,0.2)', { alphaHex: true }), '#7773'); + assert.strictEqual(min('hsla(0,0%,100%,.4)', { alphaHex: true }), '#fff6'); }); test('should convert to hex8', () => { - assert.is(min('rgba(128, 128, 128, 0.5)', { alphaHex: true }), '#80808080'); - assert.is(min('hsla(180, 100%, 50%, 0.5)', { alphaHex: true }), '#00ffff80'); + assert.strictEqual( + min('rgba(128, 128, 128, 0.5)', { alphaHex: true }), + '#80808080' + ); + assert.strictEqual( + min('hsla(180, 100%, 50%, 0.5)', { alphaHex: true }), + '#00ffff80' + ); }); test('should not convert to alpha hex since the conversion is not lossless', () => { - assert.is( + assert.strictEqual( min('rgba(0, 0, 0, 0.075)', { alphaHex: true }), 'rgba(0,0,0,.075)' ); - assert.is( + assert.strictEqual( min('hsla(0, 0%, 50%, 0.515)', { alphaHex: true }), 'hsla(0,0%,50%,.515)' ); }); -test.run(); diff --git a/packages/postcss-convert-values/test/index.js b/packages/postcss-convert-values/test/index.js index cb6721840..e2ce8604a 100644 --- a/packages/postcss-convert-values/test/index.js +++ b/packages/postcss-convert-values/test/index.js @@ -1,6 +1,6 @@ 'use strict'; const { join } = require('path'); -const { test } = require('uvu'); +const { test } = require('node:test'); const { usePostCSSPlugin, processCSSFactory, @@ -500,4 +500,3 @@ test( ); test('should use the postcss plugin api', usePostCSSPlugin(plugin())); -test.run(); diff --git a/packages/postcss-discard-comments/test/index.js b/packages/postcss-discard-comments/test/index.js index d79f013cb..dce7adc2d 100644 --- a/packages/postcss-discard-comments/test/index.js +++ b/packages/postcss-discard-comments/test/index.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const vars = require('postcss-simple-vars'); const { usePostCSSPlugin, @@ -240,4 +240,3 @@ test( ':root{ box-shadow:inset 0 -10px 12px 0 red, inset 0 0 5px 0 red; }' ) ); -test.run(); diff --git a/packages/postcss-discard-duplicates/test/index.js b/packages/postcss-discard-duplicates/test/index.js index fb16eb164..235364439 100644 --- a/packages/postcss-discard-duplicates/test/index.js +++ b/packages/postcss-discard-duplicates/test/index.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { usePostCSSPlugin, processCSSFactory, @@ -169,4 +169,3 @@ test( ); test('should use the postcss plugin api', usePostCSSPlugin(plugin())); -test.run(); diff --git a/packages/postcss-discard-empty/test/index.js b/packages/postcss-discard-empty/test/index.js index 03f356eda..34f6827dd 100644 --- a/packages/postcss-discard-empty/test/index.js +++ b/packages/postcss-discard-empty/test/index.js @@ -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 { usePostCSSPlugin, processCSSFactory, @@ -41,7 +41,7 @@ function testRemovals(fixture, expected, removedSelectors) { } }); - assert.is(result.css, expected); + assert.strictEqual(result.css, expected); }); } @@ -115,4 +115,3 @@ test( ); test('should use the postcss plugin api', usePostCSSPlugin(plugin())); -test.run(); diff --git a/packages/postcss-discard-overridden/test/index.js b/packages/postcss-discard-overridden/test/index.js index d1e17dbfe..5c638d186 100644 --- a/packages/postcss-discard-overridden/test/index.js +++ b/packages/postcss-discard-overridden/test/index.js @@ -1,7 +1,7 @@ 'use strict'; const fs = require('fs'); -const assert = require('uvu/assert'); -const { test } = require('uvu'); +const assert = require('node:assert/strict'); +const { test } = require('node:test'); const postcss = require('postcss'); const { diffLines } = require('diff'); const pc = require('picocolors'); @@ -60,7 +60,7 @@ function exec(input) { throw getDiff(result.css, output); } - assert.is(result.warnings().length, 0); + assert.strictEqual(result.warnings().length, 0); }); } @@ -70,4 +70,3 @@ test( 'overridden @counter-style should be discarded correctly', exec('counter-style') ); -test.run(); diff --git a/packages/postcss-discard-unused/test/index.js b/packages/postcss-discard-unused/test/index.js index 9f0f9267a..61efbe25d 100644 --- a/packages/postcss-discard-unused/test/index.js +++ b/packages/postcss-discard-unused/test/index.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { usePostCSSPlugin, processCSSFactory, @@ -158,4 +158,3 @@ test( ); test('should use the postcss plugin api', usePostCSSPlugin(plugin())); -test.run(); diff --git a/packages/postcss-discard-unused/test/namespace.js b/packages/postcss-discard-unused/test/namespace.js index a7bc8170d..7ab870ddc 100644 --- a/packages/postcss-discard-unused/test/namespace.js +++ b/packages/postcss-discard-unused/test/namespace.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { processCSSFactory } = require('../../../util/testHelpers.js'); const plugin = require('../src/index.js'); @@ -47,4 +47,3 @@ test( namespace: false, }) ); -test.run(); diff --git a/packages/postcss-merge-idents/test/index.js b/packages/postcss-merge-idents/test/index.js index 412c2a503..b2d0b4e9f 100644 --- a/packages/postcss-merge-idents/test/index.js +++ b/packages/postcss-merge-idents/test/index.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { usePostCSSPlugin, processCSSFactory, @@ -224,4 +224,3 @@ test( `.hi{animation:hi 2s infinite linear}.ho{animation:ho 2s infinite linear}@-webkit-keyframes ho{0%{transform:rotate(0deg)}to{transform:rotate(359deg)}}@keyframes hi{0%{transform:rotate(0deg)}to{transform:rotate(359deg)}}` ) ); -test.run(); diff --git a/packages/postcss-merge-longhand/test/api.js b/packages/postcss-merge-longhand/test/api.js index 85bebb844..2806b4cce 100644 --- a/packages/postcss-merge-longhand/test/api.js +++ b/packages/postcss-merge-longhand/test/api.js @@ -1,10 +1,9 @@ 'use strict'; -const { test } = require('uvu'); -const assert = require('uvu/assert'); +const { test } = require('node:test'); +const assert = require('node:assert/strict'); const { name } = require('../package.json'); const plugin = require('../src/index.js'); test('should use the postcss plugin api', () => { - assert.is(plugin().postcssPlugin, name); + assert.strictEqual(plugin().postcssPlugin, name); }); -test.run(); diff --git a/packages/postcss-merge-longhand/test/borders.js b/packages/postcss-merge-longhand/test/borders.js index b6e5efee9..91b2c7416 100644 --- a/packages/postcss-merge-longhand/test/borders.js +++ b/packages/postcss-merge-longhand/test/borders.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const trbl = require('../src/lib/trbl.js'); const { processCSSFactory } = require('../../../util/testHelpers.js'); const plugin = require('../src/index.js'); @@ -1298,4 +1298,3 @@ test( ); test('should handle empty border', processCSS('h1{border:;}', 'h1{border:;}')); -test.run(); diff --git a/packages/postcss-merge-longhand/test/boxBase.js b/packages/postcss-merge-longhand/test/boxBase.js index 341406026..a946cce59 100644 --- a/packages/postcss-merge-longhand/test/boxBase.js +++ b/packages/postcss-merge-longhand/test/boxBase.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { processCSSFactory } = require('../../../util/testHelpers.js'); const plugin = require('../src/index.js'); @@ -334,4 +334,3 @@ addTests( expected: (prop) => `h1{${prop}:;}`, } ); -test.run(); diff --git a/packages/postcss-merge-longhand/test/columns.js b/packages/postcss-merge-longhand/test/columns.js index 01c149874..a3764dc21 100644 --- a/packages/postcss-merge-longhand/test/columns.js +++ b/packages/postcss-merge-longhand/test/columns.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { processCSSFactory } = require('../../../util/testHelpers.js'); const plugin = require('../src/index.js'); @@ -198,4 +198,3 @@ test( 'should handle empty columns', processCSS('h1{columns:;}', 'h1{columns:;}') ); -test.run(); diff --git a/packages/postcss-merge-rules/test/index.js b/packages/postcss-merge-rules/test/index.js index 312cd5f1b..6304a2c5f 100644 --- a/packages/postcss-merge-rules/test/index.js +++ b/packages/postcss-merge-rules/test/index.js @@ -1,7 +1,7 @@ 'use strict'; const { join } = require('path'); -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 vars = require('postcss-simple-vars'); const comments = require('postcss-discard-comments'); // alias not loading correctly @@ -719,7 +719,7 @@ test('should not crash when node.raws.value is null', () => { '$color: red; h1{box-shadow:inset 0 -10px 12px 0 $color, /* some comment */ inset 0 0 5px 0 $color;color:blue}h2{color:blue}'; const res = postcss([vars(), comments(), plugin]).process(css).css; - assert.is( + assert.strictEqual( res, 'h1{box-shadow:inset 0 -10px 12px 0 red, inset 0 0 5px 0 red}h1,h2{color:blue}' ); @@ -730,7 +730,7 @@ test('should not crash when node.raws.value is null (2)', () => { '#foo .bar { margin-left: auto ; margin-right: auto ; } #foo .qux { margin-right: auto ; }'; const res = postcss([comments(), plugin]).process(css).css; - assert.is( + assert.strictEqual( res, '#foo .bar{ margin-left:auto; } #foo .bar,#foo .qux{ margin-right:auto; }' ); @@ -962,4 +962,3 @@ test( }` ) ); -test.run(); diff --git a/packages/postcss-minify-font-values/test/index.js b/packages/postcss-minify-font-values/test/index.js index f63819ed4..fd68b3631 100644 --- a/packages/postcss-minify-font-values/test/index.js +++ b/packages/postcss-minify-font-values/test/index.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { usePostCSSPlugin, processCSSFactory, @@ -521,4 +521,3 @@ test( ); test('should use the postcss plugin api', usePostCSSPlugin(plugin())); -test.run(); diff --git a/packages/postcss-minify-font-values/test/minify-family.js b/packages/postcss-minify-font-values/test/minify-family.js index 66a37c7dd..d32975303 100644 --- a/packages/postcss-minify-font-values/test/minify-family.js +++ b/packages/postcss-minify-font-values/test/minify-family.js @@ -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 minifyFamily = require('../src/lib/minify-family.js'); const tests = [ @@ -93,7 +93,6 @@ const tests = [ test('minify-family', () => { tests.forEach(({ fixture, options, expected }) => { - assert.equal(minifyFamily(fixture, options), expected); + assert.deepStrictEqual(minifyFamily(fixture, options), expected); }); }); -test.run(); diff --git a/packages/postcss-minify-font-values/test/minify-font.js b/packages/postcss-minify-font-values/test/minify-font.js index 95caad4fa..1d4fda323 100644 --- a/packages/postcss-minify-font-values/test/minify-font.js +++ b/packages/postcss-minify-font-values/test/minify-font.js @@ -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 minifyFont = require('../src/lib/minify-font.js'); test('.8em "Times New Roman", Arial, Helvetica, sans-serif', () => { @@ -47,5 +47,3 @@ test('tabs and newlines', () => { '700 italic \t 20px \n Times New Roman,serif' ); }); - -test.run(); diff --git a/packages/postcss-minify-font-values/test/minify-weight.js b/packages/postcss-minify-font-values/test/minify-weight.js index 1d70393db..de1c3e06b 100644 --- a/packages/postcss-minify-font-values/test/minify-weight.js +++ b/packages/postcss-minify-font-values/test/minify-weight.js @@ -1,12 +1,11 @@ 'use strict'; -const { test } = require('uvu'); -const assert = require('uvu/assert'); +const { test } = require('node:test'); +const assert = require('node:assert/strict'); const minifyWeight = require('../src/lib/minify-weight.js'); test('minify-weight', () => { - assert.is(minifyWeight('normal'), '400'); - assert.is(minifyWeight('bold'), '700'); - assert.is(minifyWeight('lighter'), 'lighter'); - assert.is(minifyWeight('bolder'), 'bolder'); + assert.strictEqual(minifyWeight('normal'), '400'); + assert.strictEqual(minifyWeight('bold'), '700'); + assert.strictEqual(minifyWeight('lighter'), 'lighter'); + assert.strictEqual(minifyWeight('bolder'), 'bolder'); }); -test.run(); diff --git a/packages/postcss-minify-gradients/test/index.js b/packages/postcss-minify-gradients/test/index.js index a48bc7d42..77f4312a6 100644 --- a/packages/postcss-minify-gradients/test/index.js +++ b/packages/postcss-minify-gradients/test/index.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { usePostCSSPlugin, processCSSFactory, @@ -424,4 +424,3 @@ test( ); test('should use the postcss plugin api', usePostCSSPlugin(plugin())); -test.run(); diff --git a/packages/postcss-minify-gradients/test/isColorStop.js b/packages/postcss-minify-gradients/test/isColorStop.js index 0aefa6fa8..32128649f 100644 --- a/packages/postcss-minify-gradients/test/isColorStop.js +++ b/packages/postcss-minify-gradients/test/isColorStop.js @@ -1,14 +1,13 @@ 'use strict'; -const { test } = require('uvu'); -const assert = require('uvu/assert'); +const { test } = require('node:test'); +const assert = require('node:assert/strict'); const isColorStop = require('../src/isColorStop.js'); test('should recognise color stops', () => { - assert.is(isColorStop('yellow'), true); - assert.is(isColorStop('yellow', '12px'), true); - assert.is(isColorStop('yellow', 'px'), false); - assert.is(isColorStop('yellow', 'calc(100%)'), true); - assert.is(isColorStop(undefined), false); - assert.is(isColorStop('yellow', '0'), true); + assert.strictEqual(isColorStop('yellow'), true); + assert.strictEqual(isColorStop('yellow', '12px'), true); + assert.strictEqual(isColorStop('yellow', 'px'), false); + assert.strictEqual(isColorStop('yellow', 'calc(100%)'), true); + assert.strictEqual(isColorStop(undefined), false); + assert.strictEqual(isColorStop('yellow', '0'), true); }); -test.run(); diff --git a/packages/postcss-minify-params/test/index.js b/packages/postcss-minify-params/test/index.js index f84b027ff..9da5f7d00 100644 --- a/packages/postcss-minify-params/test/index.js +++ b/packages/postcss-minify-params/test/index.js @@ -1,6 +1,6 @@ 'use strict'; const { join } = require('path'); -const { test } = require('uvu'); +const { test } = require('node:test'); const { usePostCSSPlugin, processCSSFactory, @@ -329,4 +329,3 @@ test( ); test('should use the postcss plugin api', usePostCSSPlugin(plugin())); -test.run(); diff --git a/packages/postcss-minify-selectors/test/index.js b/packages/postcss-minify-selectors/test/index.js index a5a7d7be2..c3aaae19b 100644 --- a/packages/postcss-minify-selectors/test/index.js +++ b/packages/postcss-minify-selectors/test/index.js @@ -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 magician = require('postcss-font-magician'); const { @@ -468,7 +468,7 @@ test( test('cssnano issue 39', () => { const css = 'body{font:100%/1.25 "Open Sans", sans-serif;background:#F6F5F4;overflow-x:hidden}'; - assert.not.throws( + assert.doesNotThrow( () => postcss([magician(), plugin()]).process(css, { from: undefined }).css ); }); @@ -519,7 +519,7 @@ test('should handle selectors from other plugins', () => { .6f6b__ok { padding: 4px; }`; - assert.is( + assert.strictEqual( postcss([toModules, plugin]).process(css, { from: undefined }).css, expected ); @@ -556,4 +556,3 @@ test( ':where(:nth-child(7),:nth-child(7)~*) { }' ) ); -test.run(); diff --git a/packages/postcss-normalize-charset/test/index.js b/packages/postcss-normalize-charset/test/index.js index 8d542e980..0af635633 100644 --- a/packages/postcss-normalize-charset/test/index.js +++ b/packages/postcss-normalize-charset/test/index.js @@ -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 { usePostCSSPlugin, processCSSFactory, @@ -24,7 +24,7 @@ function sourceTest(origin) { ); } - return assert.is(source, origin); + return assert.strictEqual(source, origin); }, }; } @@ -86,4 +86,3 @@ test( ); test('should use the postcss plugin api', usePostCSSPlugin(plugin())); -test.run(); diff --git a/packages/postcss-normalize-display-values/test/index.js b/packages/postcss-normalize-display-values/test/index.js index 49831c7ac..ad318cd24 100644 --- a/packages/postcss-normalize-display-values/test/index.js +++ b/packages/postcss-normalize-display-values/test/index.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { usePostCSSPlugin, processCSSFactory, @@ -60,4 +60,3 @@ test( ); test('should use the postcss plugin api', usePostCSSPlugin(plugin())); -test.run(); diff --git a/packages/postcss-normalize-positions/test/index.js b/packages/postcss-normalize-positions/test/index.js index 6c6d05d5b..08439c5a4 100644 --- a/packages/postcss-normalize-positions/test/index.js +++ b/packages/postcss-normalize-positions/test/index.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { usePostCSSPlugin, processCSSFactory, @@ -341,4 +341,3 @@ test( ); test('should use the postcss plugin api', usePostCSSPlugin(plugin())); -test.run(); diff --git a/packages/postcss-normalize-repeat-style/test/index.js b/packages/postcss-normalize-repeat-style/test/index.js index da746a033..c304791e8 100644 --- a/packages/postcss-normalize-repeat-style/test/index.js +++ b/packages/postcss-normalize-repeat-style/test/index.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { usePostCSSPlugin, processCSSFactory, @@ -143,4 +143,3 @@ test( ); test('should use the postcss plugin api', usePostCSSPlugin(plugin())); -test.run(); diff --git a/packages/postcss-normalize-string/test/index.js b/packages/postcss-normalize-string/test/index.js index a8cbff279..72fba1713 100644 --- a/packages/postcss-normalize-string/test/index.js +++ b/packages/postcss-normalize-string/test/index.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { usePostCSSPlugin, processCSSFactory, @@ -240,4 +240,3 @@ test( ); test('should work for columns', passthroughCSS(`div{columns: 2 auto;}`)); -test.run(); diff --git a/packages/postcss-normalize-timing-functions/test/index.js b/packages/postcss-normalize-timing-functions/test/index.js index 3f3291f78..6b4769f56 100644 --- a/packages/postcss-normalize-timing-functions/test/index.js +++ b/packages/postcss-normalize-timing-functions/test/index.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { usePostCSSPlugin, processCSSFactory, @@ -219,4 +219,3 @@ test( ); test('should use the postcss plugin api', usePostCSSPlugin(plugin())); -test.run(); diff --git a/packages/postcss-normalize-unicode/test/index.js b/packages/postcss-normalize-unicode/test/index.js index bab1647e7..49c56e3bb 100644 --- a/packages/postcss-normalize-unicode/test/index.js +++ b/packages/postcss-normalize-unicode/test/index.js @@ -1,6 +1,6 @@ 'use strict'; const { join } = require('path'); -const { test } = require('uvu'); +const { test } = require('node:test'); const { usePostCSSPlugin, processCSSFactory, @@ -171,4 +171,3 @@ test( ); test('should use the postcss plugin api', usePostCSSPlugin(plugin())); -test.run(); diff --git a/packages/postcss-normalize-url/test/index.js b/packages/postcss-normalize-url/test/index.js index 386b36560..dc49c57d6 100644 --- a/packages/postcss-normalize-url/test/index.js +++ b/packages/postcss-normalize-url/test/index.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { usePostCSSPlugin, processCSSFactory, @@ -303,5 +303,3 @@ test( ); test('should use the postcss plugin api', usePostCSSPlugin(plugin())); - -test.run(); diff --git a/packages/postcss-normalize-url/test/normalize.js b/packages/postcss-normalize-url/test/normalize.js index 5fe6b742c..29e46a1c0 100644 --- a/packages/postcss-normalize-url/test/normalize.js +++ b/packages/postcss-normalize-url/test/normalize.js @@ -1,32 +1,32 @@ 'use strict'; -const assert = require('uvu/assert'); -const { test } = require('uvu'); +const assert = require('node:assert/strict'); +const { test } = require('node:test'); const normalizeUrl = require('../src/normalize.js'); test('should add the http prefix to unprefixed URLs', () => { - assert.is(normalizeUrl('example.com'), 'http://example.com'); + assert.strictEqual(normalizeUrl('example.com'), 'http://example.com'); }); test('should not attempt to sort parameters', () => { const fixture = 'http://sindresorhus.com/?d=Z&b=Y&c=X&a=W'; - assert.is(normalizeUrl(fixture), fixture); + assert.strictEqual(normalizeUrl(fixture), fixture); }); test('should leave encoded slashes alone', () => { const fixture = 'https://example.com/music/bands/AC%2FDC'; - assert.is(normalizeUrl(fixture), fixture); + assert.strictEqual(normalizeUrl(fixture), fixture); }); test('should decode URI octets', () => { - assert.is( + assert.strictEqual( normalizeUrl('http://example.com/%7Efoo/'), 'http://example.com/~foo' ); }); test('should handle spaces inside parameters', () => { - assert.is( + assert.strictEqual( normalizeUrl('http://example.com/?foo=bar baz'), 'http://example.com/?foo=bar%20baz' ); @@ -34,40 +34,38 @@ test('should handle spaces inside parameters', () => { test('should preserve authentication string', () => { const fixture = 'http://user:password@www.example.com'; - assert.is(normalizeUrl(fixture), fixture); + assert.strictEqual(normalizeUrl(fixture), fixture); }); test('should preserve index', () => { const fixture = 'http://example.com/index.html'; - assert.is(normalizeUrl(fixture), fixture); + assert.strictEqual(normalizeUrl(fixture), fixture); }); test('should preserve non-standard port', () => { const fixture = 'https://example.com:123'; - assert.is(normalizeUrl(fixture), fixture); + assert.strictEqual(normalizeUrl(fixture), fixture); }); test('should strip default MIME type', () => { - assert.is(normalizeUrl('data:text/plain,foo'), 'data:,foo'); + assert.strictEqual(normalizeUrl('data:text/plain,foo'), 'data:,foo'); }); test('should strip default charset', () => { - assert.is(normalizeUrl('data:;charset=us-ascii,foo'), 'data:,foo'); + assert.strictEqual(normalizeUrl('data:;charset=us-ascii,foo'), 'data:,foo'); }); test('should lowercase the MIME type', () => { - assert.is(normalizeUrl('data:TEXT/HTML,foo'), 'data:text/html,foo'); + assert.strictEqual(normalizeUrl('data:TEXT/HTML,foo'), 'data:text/html,foo'); }); test('should keep spaces when not base64', () => { - assert.is(normalizeUrl('data:, foo #bar'), 'data:, foo #bar'); + assert.strictEqual(normalizeUrl('data:, foo #bar'), 'data:, foo #bar'); }); test('should remove trailing semicolon', () => { - assert.is( + assert.strictEqual( normalizeUrl('data:;charset=UTF-8;,foo'), 'data:;charset=utf-8,foo' ); }); - -test.run(); diff --git a/packages/postcss-normalize-whitespace/test/index.js b/packages/postcss-normalize-whitespace/test/index.js index 030c66c43..728c9372b 100644 --- a/packages/postcss-normalize-whitespace/test/index.js +++ b/packages/postcss-normalize-whitespace/test/index.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { processCSSFactory } = require('../../../util/testHelpers.js'); const plugin = require('../src/index.js'); @@ -99,4 +99,3 @@ test( 'div{border-radius:var(border-rad, )}' ) ); -test.run(); diff --git a/packages/postcss-ordered-values/test/index.js b/packages/postcss-ordered-values/test/index.js index ed68753e0..8fe39a598 100644 --- a/packages/postcss-ordered-values/test/index.js +++ b/packages/postcss-ordered-values/test/index.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { usePostCSSPlugin, processCSSFactory, @@ -797,4 +797,3 @@ test( 'should order list-style 13', passthroughCSS('ul{list-style: unknown unset none}') ); -test.run(); diff --git a/packages/postcss-ordered-values/test/rules.js b/packages/postcss-ordered-values/test/rules.js index 0150330df..20986c07b 100644 --- a/packages/postcss-ordered-values/test/rules.js +++ b/packages/postcss-ordered-values/test/rules.js @@ -1,20 +1,19 @@ 'use strict'; -const { suite } = require('uvu'); -const assert = require('uvu/assert'); +const { test } = require('node:test'); +const assert = require('node:assert/strict'); const valueParser = require('postcss-value-parser'); const normalizeBorder = require('../src/rules/border.js'); const normalizeBoxShadow = require('../src/rules/boxShadow.js'); -const borderOrder = suite('orders borders'); -borderOrder('handles max', () => { - assert.is( +test('border order handles max', () => { + assert.strictEqual( normalizeBorder(valueParser('red max(3em, 48px)')), 'max(3em, 48px) red' ); }); -borderOrder('handles mixed color and width functions', () => { - assert.is( +test('border order handles mixed color and width functions', () => { + assert.strictEqual( normalizeBorder( valueParser('rgba(0, 50, 50, 0.4) solid clamp(3em, 0.5vw, 48px)') ), @@ -22,13 +21,9 @@ borderOrder('handles mixed color and width functions', () => { ); }); -borderOrder.run(); - -const boxShadowOrder = suite('orders box shadows'); -boxShadowOrder('handles functions in box shadows', () => { - assert.is( +test('ordering box shadows handles functions in box shadows', () => { + assert.strictEqual( normalizeBoxShadow(valueParser('inset 0 min(1em, 1px) 0 1px red')), 'inset 0 min(1em, 1px) 0 1px red' ); }); -boxShadowOrder.run(); diff --git a/packages/postcss-reduce-idents/test/index.js b/packages/postcss-reduce-idents/test/index.js index 16b86d94e..c81f4a7bc 100644 --- a/packages/postcss-reduce-idents/test/index.js +++ b/packages/postcss-reduce-idents/test/index.js @@ -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 { usePostCSSPlugin, @@ -534,19 +534,19 @@ test('should not generate same ident when plugin instance is reused', () => { { from: undefined } ), ]).then(([result1, result2, result3, result4]) => { - assert.is( + assert.strictEqual( result1.css, '@keyframes a{0%{color:#fff}to{color:#000}}.one{animation-name:a}' ); - assert.is( + assert.strictEqual( result2.css, '@KEYFRAMES a{0%{color:#fff}to{color:#000}}.one{animation-name:a}' ); - assert.is( + assert.strictEqual( result3.css, '@keyframes b{0%{opacity:1}to{opacity:0}}.two{animation-name:b}' ); - assert.is( + assert.strictEqual( result4.css, '@KEYFRAMES b{0%{opacity:1}to{opacity:0}}.two{animation-name:b}' ); @@ -565,7 +565,7 @@ test('encoder', () => { let indexes = cache.filter((c) => c === encoded); - assert.is(indexes.length, 1); + assert.strictEqual(indexes.length, 1); }); }); @@ -590,9 +590,8 @@ test('encoder gen spec', () => { 13847860: 'aaaaa', }; Object.keys(edgeCaseList).forEach((num) => { - assert.is(encode(null, num), edgeCaseList[num]); + assert.strictEqual(encode(null, num), edgeCaseList[num]); }); }); test('should use the postcss plugin api', usePostCSSPlugin(plugin())); -test.run(); diff --git a/packages/postcss-reduce-initial/script/test/io.mjs b/packages/postcss-reduce-initial/script/test/io.mjs index 6393e18cb..d7660b7f0 100644 --- a/packages/postcss-reduce-initial/script/test/io.mjs +++ b/packages/postcss-reduce-initial/script/test/io.mjs @@ -1,6 +1,6 @@ import fs from 'fs'; -import { test } from 'uvu'; -import * as assert from 'uvu/assert'; +import { test } from 'node:test'; +import * as assert from 'node:assert/strict'; import { mock } from 'node:test'; import { handleError, toJSONString, write, generate } from '../lib/io.mjs'; @@ -17,7 +17,7 @@ test('should produce parsable JSON', () => { 'fred-plugh': 'xyzzy-thud', }; - assert.equal(JSON.parse(toJSONString(rawData)), rawData); + assert.deepStrictEqual(JSON.parse(toJSONString(rawData)), rawData); }); const data = { @@ -33,13 +33,16 @@ for (const [key, path, expected] of [ test(`should write JSON file based on key ${key}`, () => { const fileFunc = mock.fn(); write(fileFunc, paths, data, key); - assert.is(fileFunc.mock.calls[0].arguments[0], path); - assert.is(fileFunc.mock.calls[0].arguments[1], toJSONString(expected)); + assert.strictEqual(fileFunc.mock.calls[0].arguments[0], path); + assert.strictEqual( + fileFunc.mock.calls[0].arguments[1], + toJSONString(expected) + ); }); } test('should handle file operation errors', () => { - assert.not.throws(handleError); + assert.doesNotThrow(handleError); assert.throws(() => handleError(new Error('something went wrong'))); }); @@ -55,7 +58,5 @@ test('should make it through promise chain with sample data and write 2 files', 'https://example.com/properties.json' ); - assert.is(fileFunc.mock.calls.length, 2); + assert.strictEqual(fileFunc.mock.calls.length, 2); }); - -test.run(); diff --git a/packages/postcss-reduce-initial/script/test/mdnCssProps.mjs b/packages/postcss-reduce-initial/script/test/mdnCssProps.mjs index 945be447f..aa537c5ab 100644 --- a/packages/postcss-reduce-initial/script/test/mdnCssProps.mjs +++ b/packages/postcss-reduce-initial/script/test/mdnCssProps.mjs @@ -1,6 +1,6 @@ import fs from 'fs'; -import { suite } from 'uvu'; -import * as assert from 'uvu/assert'; +import { test } from 'node:test'; +import assert from 'node:assert/strict'; import { isUserAgentDependent, isComplexSyntax, @@ -14,8 +14,6 @@ const testData = JSON.parse( fs.readFileSync(new URL('./sampleProperties.json', import.meta.url), 'utf-8') ); -const propertiesTests = suite('Recognize properties and flags'); - for (const [flag, expected] of [ ['dependsOnUserAgent', true], ['noPracticalInitialValue', true], @@ -27,8 +25,8 @@ for (const [flag, expected] of [ ['experimental', false], ['normal', false], ]) { - propertiesTests(`should recognize user agent dependent flag ${flag}`, () => { - assert.is(isUserAgentDependent(flag), expected); + test(`should recognize user agent dependent flag ${flag}`, () => { + assert.strictEqual(isUserAgentDependent(flag), expected); }); } @@ -39,12 +37,9 @@ for (const [initial, key, expected] of [ ['normal', 'word-wrap', false], ['100%', 'text-align', false], ]) { - propertiesTests( - `isComplexSyntax(${initial}, ${key}) expected: ${expected}`, - () => { - assert.is(isComplexSyntax(initial, key), expected); - } - ); + test(`isComplexSyntax(${initial}, ${key}) expected: ${expected}`, () => { + assert.strictEqual(isComplexSyntax(initial, key), expected); + }); } for (const [status, key, expected] of [ @@ -54,12 +49,9 @@ for (const [status, key, expected] of [ ['standard', 'align-items', false], ['experimental', 'aspect-ratio', false], ]) { - propertiesTests( - `isUnpredictable(${status}, ${key}) expected: ${expected}`, - () => { - assert.is(isUnpredictable(status, key), expected); - } - ); + test(`isUnpredictable(${status}, ${key}) expected: ${expected}`, () => { + assert.strictEqual(isUnpredictable(status, key), expected); + }); } for (const [string, expected] of [ @@ -76,74 +68,64 @@ for (const [string, expected] of [ ['100%', '100%'], ['auto', 'auto'], ]) { - propertiesTests( - `strip HTML, but leave relevant chars and separating spaces ${string} expected: ${expected}`, - () => { - assert.is(toPlainText(string), expected); - } - ); + test(`strip HTML, but leave relevant chars and separating spaces ${string} expected: ${expected}`, () => { + assert.strictEqual(toPlainText(string), expected); + }); } -const validationTests = suite('Reduce and validate sample data'); let processedData = ''; -validationTests.before(() => { +test.before(() => { processedData = reduceInitial(testData); }); -validationTests('should reduce to expected object structure', () => { - assert.type(processedData.fromInitial, 'object'); - assert.type(processedData.toInitial, 'object'); +test('should reduce to expected object structure', () => { + assert.strictEqual(typeof processedData.fromInitial, 'object'); + assert.strictEqual(typeof processedData.toInitial, 'object'); }); -validationTests('should reduce to expected number of fromInitial items', () => { - assert.is(Object.keys(processedData.fromInitial).length, 5); +test('should reduce to expected number of fromInitial items', () => { + assert.strictEqual(Object.keys(processedData.fromInitial).length, 5); }); -validationTests('should reduce to expected number of toInitial items', () => { - assert.is(Object.keys(processedData.toInitial).length, 3); +test('should reduce to expected number of toInitial items', () => { + assert.strictEqual(Object.keys(processedData.toInitial).length, 3); }); -validationTests( - 'should validate and return sample data as resolved promise', - async () => { - const result = await validate(processedData); - assert.equal(result, processedData); - } -); +test('should validate and return sample data as resolved promise', async () => { + const result = await validate(processedData); + assert.deepStrictEqual(result, processedData); +}); -validationTests('should fail validation on missing data', async () => { +test('should fail validation on missing data', async () => { try { await validate(undefined); - assert.unreachable(); + assert.ok(true, false, 'Should not be reached'); } catch { assert.ok('Threw an error'); } }); -validationTests('should fail validation on missing fromInitial', async () => { +test('should fail validation on missing fromInitial', async () => { const partialData = JSON.parse(JSON.stringify(processedData)); delete partialData.fromInitial; try { await validate(partialData); - assert.unreachable(); + assert.ok(true, false, 'Should not be reached'); } catch { assert.ok('Threw an error'); } }); -validationTests('should fail validation on missing toInitial', async () => { +test('should fail validation on missing toInitial', async () => { const partialData = JSON.parse(JSON.stringify(processedData)); delete partialData.toInitial; try { await validate(partialData); - assert.unreachable(); + assert.ok(true, false, 'Should not be reached'); } catch { assert.ok('Threw an error'); } }); - -propertiesTests.run(); -validationTests.run(); diff --git a/packages/postcss-reduce-initial/test/index.js b/packages/postcss-reduce-initial/test/index.js index 45a5a5bc1..b9a487eee 100644 --- a/packages/postcss-reduce-initial/test/index.js +++ b/packages/postcss-reduce-initial/test/index.js @@ -1,6 +1,6 @@ 'use strict'; const { join } = require('path'); -const { test } = require('uvu'); +const { test } = require('node:test'); const { usePostCSSPlugin, processCSSFactory, @@ -186,5 +186,3 @@ test( 'should ignore the data present in the ignore options , toInitial #3', passthroughCSS('WRITING-MODE:horizontal-tb', { ignore: ['writing-mode'] }) ); - -test.run(); diff --git a/packages/postcss-reduce-transforms/test/index.js b/packages/postcss-reduce-transforms/test/index.js index 9279ccd1b..2e0ab1020 100644 --- a/packages/postcss-reduce-transforms/test/index.js +++ b/packages/postcss-reduce-transforms/test/index.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { usePostCSSPlugin, processCSSFactory, @@ -482,4 +482,3 @@ test( 'should work with transform:rotate3d(0)', processCSS('h1{transform:rotate3d(0)}', 'h1{transform:rotate3d(0)}') ); -test.run(); diff --git a/packages/postcss-svgo/test/index.js b/packages/postcss-svgo/test/index.js index ef2f4086a..4bbad9cdf 100644 --- a/packages/postcss-svgo/test/index.js +++ b/packages/postcss-svgo/test/index.js @@ -1,7 +1,7 @@ 'use strict'; const { readFileSync: file } = require('fs'); -const assert = require('uvu/assert'); -const { test } = require('uvu'); +const assert = require('node:assert/strict'); +const { test } = require('node:test'); const postcss = require('postcss'); const filters = require('pleeease-filters'); const { @@ -171,7 +171,7 @@ test('should not warn on "escaped-quotes" svgs', async () => { const css = 'h1{background-image:url("data:image/svg+xml,")}'; const result = await postcss(plugin()).process(css, { from: undefined }); - assert.is(result.messages.length, 0); + assert.strictEqual(result.messages.length, 0); }); test( @@ -236,8 +236,8 @@ test('should warn on SVG containing unclosed tags', async () => { const css = 'h1{background:url(data:image/svg+xml;charset=utf-8,style type="text/css"> svg { fill: red; } )}'; const result = await postcss(plugin()).process(css, { from: undefined }); - assert.is(result.messages.length, 1); - assert.is(result.messages[0].type, 'warning'); + assert.strictEqual(result.messages.length, 1); + assert.strictEqual(result.messages[0].type, 'warning'); }); test('should only warn with svg data uri', async () => { @@ -246,7 +246,7 @@ test('should only warn with svg data uri', async () => { url('data:image/svg+xml;charset=utf-8,') format("svg"); }`; const result = await postcss(plugin()).process(css, { from: undefined }); - assert.is(result.messages.length, 0); + assert.strictEqual(result.messages.length, 0); }); test( @@ -283,8 +283,7 @@ test( test('should not crash on malformed urls when encoded', () => { const svg = encode(file(`${__dirname}/border.svg`, 'utf-8')); - assert.not.throws(() => decode(svg)); + assert.doesNotThrow(() => decode(svg)); }); test('should use the postcss plugin api', usePostCSSPlugin(plugin())); -test.run(); diff --git a/packages/postcss-unique-selectors/test/index.js b/packages/postcss-unique-selectors/test/index.js index a00b7a1b5..4abbf8ce9 100644 --- a/packages/postcss-unique-selectors/test/index.js +++ b/packages/postcss-unique-selectors/test/index.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { usePostCSSPlugin, processCSSFactory, @@ -27,4 +27,3 @@ test( ); test('should use the postcss plugin api', usePostCSSPlugin(plugin())); -test.run(); diff --git a/packages/postcss-zindex/test/index.js b/packages/postcss-zindex/test/index.js index 4a31d15a4..df7954c1c 100644 --- a/packages/postcss-zindex/test/index.js +++ b/packages/postcss-zindex/test/index.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const { usePostCSSPlugin, processCSSFactory, @@ -89,4 +89,3 @@ test( ); test('should use the postcss plugin api', usePostCSSPlugin(plugin())); -test.run(); diff --git a/packages/stylehacks/test/_processCSS.js b/packages/stylehacks/test/_processCSS.js index ffd8bbd6e..9be44a98e 100644 --- a/packages/stylehacks/test/_processCSS.js +++ b/packages/stylehacks/test/_processCSS.js @@ -1,6 +1,5 @@ 'use strict'; -const { test } = require('uvu'); -const assert = require('uvu/assert'); +const assert = require('node:assert/strict'); const { processCSSFactory } = require('../../../util/testHelpers.js'); const stylehacks = require('..'); @@ -13,9 +12,8 @@ module.exports = (fixture, expected, { target, unaffected }, warnings = 1) => { processCSS(fixture, expected, { overrideBrowserslist: unaffected }), processor(fixture, { lint: true, overrideBrowserslist: unaffected }).then( (result) => { - assert.is(result.warnings().length, warnings); + assert.strictEqual(result.warnings().length, warnings); } ), ]); }; -test.run(); diff --git a/packages/stylehacks/test/api.js b/packages/stylehacks/test/api.js index d2bc2a915..d2513d882 100644 --- a/packages/stylehacks/test/api.js +++ b/packages/stylehacks/test/api.js @@ -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 stylehacks = require('../'); const packageJson = require('../package.json'); @@ -9,7 +9,7 @@ function processCss(fixture, expected, options) { return () => postcss(stylehacks(options)) .process(fixture, { from: undefined }) - .then(({ css }) => assert.is(css, expected)); + .then(({ css }) => assert.strictEqual(css, expected)); } function passthroughCss(fixture, options) { @@ -23,7 +23,7 @@ test('can be used as a postcss plugin', () => { .use(stylehacks()) .process(css, { from: undefined }) .then((result) => { - assert.is(result.css, 'h1 { }'); + assert.strictEqual(result.css, 'h1 { }'); }); }); @@ -32,7 +32,7 @@ test('can be used as a postcss plugin (2)', () => { return postcss([stylehacks()]) .process(css, { from: undefined }) - .then((result) => assert.is(result.css, 'h1 { }')); + .then((result) => assert.strictEqual(result.css, 'h1 { }')); }); test('can be used as a postcss plugin (3)', () => { @@ -41,12 +41,12 @@ test('can be used as a postcss plugin (3)', () => { return postcss([stylehacks]) .process(css, { from: undefined }) .then((result) => { - assert.is(result.css, 'h1 { }'); + assert.strictEqual(result.css, 'h1 { }'); }); }); test('should use the postcss plugin api', () => { - assert.is(stylehacks().postcssPlugin, packageJson.name); + assert.strictEqual(stylehacks().postcssPlugin, packageJson.name); }); test('should have a separate detect method', () => { @@ -66,7 +66,7 @@ test('should have a separate detect method', () => { return postcss(plugin) .process('h1 { _color: red; =color: black }', { from: undefined }) - .then(() => assert.is(counter, 2)); + .then(() => assert.strictEqual(counter, 2)); }); test('should have a separate detect method (2)', () => { @@ -86,7 +86,7 @@ test('should have a separate detect method (2)', () => { return postcss(plugin) .process('h1 { _color: red; =color: black }', { from: undefined }) - .then(() => assert.is(counter, 0)); + .then(() => assert.strictEqual(counter, 0)); }); test( @@ -137,4 +137,3 @@ test( }` ) ); -test.run(); diff --git a/packages/stylehacks/test/bodyEmpty.js b/packages/stylehacks/test/bodyEmpty.js index 631ffc424..652bc1f7d 100644 --- a/packages/stylehacks/test/bodyEmpty.js +++ b/packages/stylehacks/test/bodyEmpty.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCSS = require('./_processCSS'); test( @@ -17,4 +17,3 @@ test( unaffected: 'Chrome 58', }) ); -test.run(); diff --git a/packages/stylehacks/test/htmlCombinatorCommentBody.js b/packages/stylehacks/test/htmlCombinatorCommentBody.js index b1bd8ade8..6c7b3dbb4 100644 --- a/packages/stylehacks/test/htmlCombinatorCommentBody.js +++ b/packages/stylehacks/test/htmlCombinatorCommentBody.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCSS = require('./_processCSS'); test( @@ -25,4 +25,3 @@ test( unaffected: 'IE 8', }) ); -test.run(); diff --git a/packages/stylehacks/test/htmlFirstChild.js b/packages/stylehacks/test/htmlFirstChild.js index 51c16608b..7e80656d2 100644 --- a/packages/stylehacks/test/htmlFirstChild.js +++ b/packages/stylehacks/test/htmlFirstChild.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCSS = require('./_processCSS'); test( @@ -17,4 +17,3 @@ test( unaffected: 'Chrome 58', }) ); -test.run(); diff --git a/packages/stylehacks/test/important.js b/packages/stylehacks/test/important.js index 69ee22bb1..4b1aae102 100644 --- a/packages/stylehacks/test/important.js +++ b/packages/stylehacks/test/important.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCSS = require('./_processCSS'); test( @@ -17,4 +17,3 @@ test( unaffected: 'IE 8', }) ); -test.run(); diff --git a/packages/stylehacks/test/issue8.js b/packages/stylehacks/test/issue8.js index 3437d6a09..257fe30e2 100644 --- a/packages/stylehacks/test/issue8.js +++ b/packages/stylehacks/test/issue8.js @@ -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 stylehacks = require('..'); @@ -17,6 +17,5 @@ insertZoom.postcss = true; test('should remove star hack from plugins like lost', () => { return postcss([insertZoom(), stylehacks()]) .process('h1{}', { overrideBrowserslist: 'IE 8', from: undefined }) - .then((result) => assert.is(result.css, 'h1{}')); + .then((result) => assert.strictEqual(result.css, 'h1{}')); }); -test.run(); diff --git a/packages/stylehacks/test/leadingStar.js b/packages/stylehacks/test/leadingStar.js index 9ba7f2590..495b5a0d0 100644 --- a/packages/stylehacks/test/leadingStar.js +++ b/packages/stylehacks/test/leadingStar.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCSS = require('./_processCSS'); const opts = { target: 'IE 7', unaffected: 'IE 8' }; @@ -36,4 +36,3 @@ test( 'should also handle @hacks (uppercase)', processCSS('h1 { @COLOR: red }', 'h1 {}', opts) ); -test.run(); diff --git a/packages/stylehacks/test/leadingUnderscore.js b/packages/stylehacks/test/leadingUnderscore.js index 09d247b1f..0cc7f40f9 100644 --- a/packages/stylehacks/test/leadingUnderscore.js +++ b/packages/stylehacks/test/leadingUnderscore.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCSS = require('./_processCSS'); test( @@ -73,4 +73,3 @@ test( 0 ) ); -test.run(); diff --git a/packages/stylehacks/test/mediaSlash0.js b/packages/stylehacks/test/mediaSlash0.js index 7e620df75..7ac6d2818 100644 --- a/packages/stylehacks/test/mediaSlash0.js +++ b/packages/stylehacks/test/mediaSlash0.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCSS = require('./_processCSS'); test( @@ -17,4 +17,3 @@ test( unaffected: 'IE 9', }) ); -test.run(); diff --git a/packages/stylehacks/test/mediaSlash0Slash9.js b/packages/stylehacks/test/mediaSlash0Slash9.js index 89d2e5f24..2d32beb7a 100644 --- a/packages/stylehacks/test/mediaSlash0Slash9.js +++ b/packages/stylehacks/test/mediaSlash0Slash9.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCSS = require('./_processCSS'); test( @@ -17,4 +17,3 @@ test( unaffected: 'IE 9', }) ); -test.run(); diff --git a/packages/stylehacks/test/mediaSlash9.js b/packages/stylehacks/test/mediaSlash9.js index 50a66470e..a2731885e 100644 --- a/packages/stylehacks/test/mediaSlash9.js +++ b/packages/stylehacks/test/mediaSlash9.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCSS = require('./_processCSS'); test( @@ -17,4 +17,3 @@ test( unaffected: 'IE 8', }) ); -test.run(); diff --git a/packages/stylehacks/test/slash9.js b/packages/stylehacks/test/slash9.js index a8e9c7492..55d6ee864 100755 --- a/packages/stylehacks/test/slash9.js +++ b/packages/stylehacks/test/slash9.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCSS = require('./_processCSS'); test( @@ -33,4 +33,3 @@ test( unaffected: 'Chrome 58', }) ); -test.run(); diff --git a/packages/stylehacks/test/starHtml.js b/packages/stylehacks/test/starHtml.js index 1aa88da3d..9ebd9e3f0 100644 --- a/packages/stylehacks/test/starHtml.js +++ b/packages/stylehacks/test/starHtml.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCSS = require('./_processCSS'); test( @@ -47,4 +47,3 @@ test( 0 ) ); -test.run(); diff --git a/packages/stylehacks/test/trailingSlashComma.js b/packages/stylehacks/test/trailingSlashComma.js index 6f5ec5b97..527a20fd5 100644 --- a/packages/stylehacks/test/trailingSlashComma.js +++ b/packages/stylehacks/test/trailingSlashComma.js @@ -1,5 +1,5 @@ 'use strict'; -const { test } = require('uvu'); +const { test } = require('node:test'); const processCSS = require('./_processCSS'); test( @@ -24,4 +24,3 @@ test( 'ie 5.5-7 trailing slash hack (uppercase)', processCSS('H1\\ { COLOR: RED }', '', { target: 'IE 6', unaffected: 'IE 8' }) ); -test.run(); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3008bb2a9..65033888e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -38,9 +38,6 @@ importers: typescript: specifier: ~5.4.5 version: 5.4.5 - uvu: - specifier: ^0.5.6 - version: 0.5.6 packages/cssnano: dependencies: @@ -1036,10 +1033,6 @@ packages: resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} engines: {node: '>= 0.4'} - dequal@2.0.3: - resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} - engines: {node: '>=6'} - detect-indent@6.1.0: resolution: {integrity: sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==} engines: {node: '>=8'} @@ -1642,10 +1635,6 @@ packages: resolution: {integrity: sha512-5H76ANWinB1H3twpJ6JY8uvAtpmFvHNArpilJAjXRKXSDDLPIMoZArw5SH0q9z+lLs8IrMw7Q2VWpWimFKFT1Q==} engines: {node: '>= 8.0.0'} - mri@1.2.0: - resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} - engines: {node: '>=4'} - ms@2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} @@ -1902,10 +1891,6 @@ packages: run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} - sade@1.8.1: - resolution: {integrity: sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==} - engines: {node: '>=6'} - safe-array-concat@1.1.2: resolution: {integrity: sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==} engines: {node: '>=0.4'} @@ -2140,11 +2125,6 @@ packages: util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - uvu@0.5.6: - resolution: {integrity: sha512-+g8ENReyr8YsOc6fv/NVJs2vFdHBnBNdfE49rshrTzDWOlUx4Gq7KOS2GD8eqhy2j+Ejq29+SbKH8yjkAqXqoA==} - engines: {node: '>=8'} - hasBin: true - v8-to-istanbul@9.2.0: resolution: {integrity: sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA==} engines: {node: '>=10.12.0'} @@ -2795,8 +2775,6 @@ snapshots: has-property-descriptors: 1.0.2 object-keys: 1.1.1 - dequal@2.0.3: {} - detect-indent@6.1.0: {} diff@5.2.0: {} @@ -3460,8 +3438,6 @@ snapshots: mixme@0.5.10: {} - mri@1.2.0: {} - ms@2.1.2: {} nanoid@3.3.7: {} @@ -3696,10 +3672,6 @@ snapshots: dependencies: queue-microtask: 1.2.3 - sade@1.8.1: - dependencies: - mri: 1.2.0 - safe-array-concat@1.1.2: dependencies: call-bind: 1.0.7 @@ -3960,13 +3932,6 @@ snapshots: util-deprecate@1.0.2: {} - uvu@0.5.6: - dependencies: - dequal: 2.0.3 - diff: 5.2.0 - kleur: 4.1.5 - sade: 1.8.1 - v8-to-istanbul@9.2.0: dependencies: '@jridgewell/trace-mapping': 0.3.25 diff --git a/util/integrationTestHelpers.js b/util/integrationTestHelpers.js index 60d7e7ca3..443f47743 100644 --- a/util/integrationTestHelpers.js +++ b/util/integrationTestHelpers.js @@ -2,7 +2,7 @@ const path = require('path'); const fs = require('fs'); const postcss = require('postcss'); -const assert = require('uvu/assert'); +const assert = require('node:assert/strict'); const cssnano = require('../packages/cssnano/src/index.js'); const { processCSSFactory } = require('./testHelpers.js'); @@ -31,7 +31,7 @@ function integrationTests(preset, integrations) { postcss([cssnano({ preset })]) .process(css, { from: undefined }) .then((result) => { - assert.is( + assert.strictEqual( result.css, fs.readFileSync(`${integrations}/${framework}.css`, 'utf8') ); diff --git a/util/testHelpers.js b/util/testHelpers.js index 56ca31c14..9a474dfa7 100644 --- a/util/testHelpers.js +++ b/util/testHelpers.js @@ -1,6 +1,6 @@ 'use strict'; const postcss = require('postcss'); -const assert = require('uvu/assert'); +const assert = require('node:assert/strict'); function usePostCSSPlugin(plugin) { return () => { @@ -21,7 +21,7 @@ function processCSSFactory(plugin) { processCSS = (fixture, expected, options) => { return () => processor(fixture, options).then((result) => { - assert.is(result.css, expected); + assert.strictEqual(result.css, expected); return result; }); }; @@ -40,7 +40,7 @@ function processCSSFactory(plugin) { processCSS = (fixture, expected, options) => { return () => processor(fixture, options).then((result) => { - assert.is(result.css, expected); + assert.strictEqual(result.css, expected); return result; }); };