Skip to content

Commit

Permalink
Add formatting and test coverage to npm test
Browse files Browse the repository at this point in the history
  • Loading branch information
richardTowers committed Sep 13, 2024
1 parent 9a14da7 commit c64b1f5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
node:
- lts/hydrogen
- lts/iron
- node
- node
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"format": "prettier . -w --log-level warn && xo --fix",
"test-dev": "node --conditions development --test",
"test-prod": "node --conditions production --test",
"test": "npm run test-dev && npm run test-prod"
"test-api": "npm run test-dev && npm run test-prod",
"test-coverage": "c8 --100 --reporter lcov npm run test-api",
"test": "npm run format && npm run test-coverage"
},
"prettier": {
"bracketSpacing": false,
Expand Down
27 changes: 15 additions & 12 deletions test/lib/micromark-extension-abbr/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,21 @@ await test('micromark-extension-abbr', async (t) => {
assert.deepEqual(abbrDefinitions, [])
})

await t.test('does not parse definitions with parens instead of square brackets', async () => {
const input = `*(HTML): Hyper Text Markup Language`
const events = postprocess(
parse({extensions: [micromarkAbbr]})
.document()
.write(preprocess()(input, null, true)),
)
const abbrDefinitions = events.filter(
(event) => event[1].type === micromarkAbbrTypes.abbrDefinition,
)
assert.deepEqual(abbrDefinitions, [])
})
await t.test(
'does not parse definitions with parens instead of square brackets',
async () => {
const input = `*(HTML): Hyper Text Markup Language`
const events = postprocess(
parse({extensions: [micromarkAbbr]})
.document()
.write(preprocess()(input, null, true)),
)
const abbrDefinitions = events.filter(
(event) => event[1].type === micromarkAbbrTypes.abbrDefinition,
)
assert.deepEqual(abbrDefinitions, [])
},
)

await t.test('does not parse definitions without colons', async () => {
const input = `*[HTML]; Hyper Text Markup Language`
Expand Down

0 comments on commit c64b1f5

Please sign in to comment.