Skip to content

Commit

Permalink
Use native Node test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
stormwarning committed Aug 23, 2024
1 parent fc22848 commit 286fe45
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 649 deletions.
22 changes: 14 additions & 8 deletions __tests__/index.js → __tests__/index.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import test from 'ava'
import assert from 'node:assert/strict'
import { test } from 'node:test'

import stylelint from 'stylelint'

import config from '../index.js'
Expand All @@ -13,20 +15,24 @@ const runStylelint = async (code) => {
return data.results[0]
}

test('with incorrect property order', async (t) => {
test('with incorrect property order', async () => {
let output = await runStylelint(incorrectOrder)

t.truthy(output.errored, 'indicates linting errors')
t.is(
assert.ok(output.errored, 'it indicates linting errors')
assert.strictEqual(
output.warnings[0].text.trim(),
'Expected "box-sizing" to come before "background-color" (order/properties-order)',
'indicates a properties-order error',
'it indicates a properties-order error',
)
})

test('with correct property order', async (t) => {
test('with correct property order', async () => {
let output = await runStylelint(correctOrder)

t.falsy(output.errored, 'indicates no errors')
t.is(output.warnings.length, 0)
assert.ok(!output.errored, 'it indicates no linting errors')
assert.strictEqual(
output.warnings.length,
0,
'it indicates no specific errors',
)
})
9 changes: 1 addition & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"lint": "eslint '**/*.js'",
"prepare": "husky",
"release": "changeset publish",
"test": "ava"
"test": "node --test"
},
"lint-staged": {
"*.js": [
Expand All @@ -41,11 +41,6 @@
"package.json": "prettier --write"
},
"prettier": "@zazen/prettier-config",
"ava": {
"require": [
"esm"
]
},
"dependencies": {
"stylelint-order": "^6.0.4"
},
Expand All @@ -54,9 +49,7 @@
"@zazen/changesets-changelog": "2.0.3",
"@zazen/eslint-config": "6.8.0",
"@zazen/prettier-config": "1.1.0",
"ava": "5.2.0",
"eslint": "8.57.0",
"esm": "3.2.25",
"husky": "9.1.5",
"lint-staged": "15.2.9",
"prettier": "3.3.3",
Expand Down
Loading

0 comments on commit 286fe45

Please sign in to comment.