Skip to content

Commit

Permalink
Update dev-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 5, 2021
1 parent 4847fc7 commit 7c82195
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 25 deletions.
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,14 @@
},
"devDependencies": {
"c8": "^7.0.0",
"dtslint": "^4.0.0",
"is-hidden": "^1.0.0",
"not": "^0.1.0",
"is-hidden": "^2.0.0",
"prettier": "^2.0.0",
"remark": "^13.0.0",
"remark-cli": "^9.0.0",
"remark": "^14.0.0",
"remark-cli": "^10.0.0",
"remark-preset-wooorm": "^8.0.0",
"tape": "^5.0.0",
"to-vfile": "^6.0.0",
"unified": "^9.0.0",
"to-vfile": "^7.0.0",
"unified": "^10.0.0",
"xo": "^0.37.0"
},
"scripts": {
Expand Down
33 changes: 15 additions & 18 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,37 @@
import fs from 'fs'
import path from 'path'
import test from 'tape'
import vfile from 'to-vfile'
import unified from 'unified'
import remark from 'remark'
import not from 'not'
import hidden from 'is-hidden'
import frontmatter from '../index.js'
import {readSync} from 'to-vfile'
import {unified} from 'unified'
import {remark} from 'remark'
import {isHidden} from 'is-hidden'
import remarkFrontmatter from '../index.js'

var join = path.join
var read = fs.readFileSync
var write = fs.writeFileSync
var dir = fs.readdirSync

test('frontmatter()', function (t) {
t.equal(typeof frontmatter, 'function', 'should be a function')

test('remarkFrontmatter', function (t) {
t.doesNotThrow(function () {
remark().use(frontmatter).freeze()
remark().use(remarkFrontmatter).freeze()
}, 'should not throw if not passed options')

t.doesNotThrow(function () {
unified().use(frontmatter).freeze()
unified().use(remarkFrontmatter).freeze()
}, 'should not throw if without parser or compiler')

t.throws(
function () {
unified().use(frontmatter, [1]).freeze()
unified().use(remarkFrontmatter, [1]).freeze()
},
/^Error: Expected matter to be an object, not `1`/,
'should throw if not given a preset or a matter'
)

t.throws(
function () {
unified().use(frontmatter, ['jsonml']).freeze()
unified().use(remarkFrontmatter, ['jsonml']).freeze()
},
/^Error: Missing matter definition for `jsonml`/,
'should throw if given an unknown preset'
Expand All @@ -43,7 +40,7 @@ test('frontmatter()', function (t) {
t.throws(
function () {
unified()
.use(frontmatter, [{marker: '*'}])
.use(remarkFrontmatter, [{marker: '*'}])
.freeze()
},
/^Error: Missing `type` in matter `{"marker":"\*"}`/,
Expand All @@ -53,7 +50,7 @@ test('frontmatter()', function (t) {
t.throws(
function () {
unified()
.use(frontmatter, [{type: 'jsonml'}])
.use(remarkFrontmatter, [{type: 'jsonml'}])
.freeze()
},
/^Error: Missing `marker` or `fence` in matter `{"type":"jsonml"}`/,
Expand All @@ -65,15 +62,15 @@ test('frontmatter()', function (t) {

test('fixtures', function (t) {
var base = join('test', 'fixtures')
var entries = dir(base).filter(not(hidden))
var entries = dir(base).filter((d) => !isHidden(d))

t.plan(entries.length)

entries.forEach(each)

function each(fixture) {
t.test(fixture, function (st) {
var input = vfile.readSync(join(base, fixture, 'input.md'))
var input = readSync(join(base, fixture, 'input.md'))
var treePath = join(base, fixture, 'tree.json')
var outputPath = join(base, fixture, 'output.md')
var output
Expand All @@ -86,7 +83,7 @@ test('fixtures', function (t) {
config = JSON.parse(read(join(base, fixture, 'config.json')))
} catch (_) {}

proc = remark().use(frontmatter, config)
proc = remark().use(remarkFrontmatter, config)
actual = JSON.parse(JSON.stringify(proc.parse(input)))

try {
Expand Down

0 comments on commit 7c82195

Please sign in to comment.