Skip to content

Commit b053134

Browse files
committed
Update dev-dependencies
1 parent 49bb245 commit b053134

File tree

3 files changed

+40
-35
lines changed

3 files changed

+40
-35
lines changed

lib/contents.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = contents
77
// Transform a list of heading objects to a markdown list.
88
function contents(map, tight, prefix, ordered) {
99
var table = {type: 'list', ordered: ordered, spread: false, children: []}
10-
var minDepth = Infinity
10+
var minDepth = Number.POSITIVE_INFINITY
1111
var index = -1
1212

1313
// Find minimum depth.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"typescript": "^4.0.0",
5959
"unified": "^9.0.0",
6060
"unist-builder": "^2.0.0",
61-
"xo": "^0.34.0"
61+
"xo": "^0.38.0"
6262
},
6363
"scripts": {
6464
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",

test/index.js

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -26,39 +26,44 @@ test('mdast-util-toc', function (t) {
2626

2727
test('Fixtures', function (t) {
2828
var root = join(__dirname, 'fixtures')
29-
30-
fs.readdirSync(root)
31-
.filter(function (filepath) {
32-
return filepath.indexOf('.') !== 0
33-
})
34-
.forEach(function (name) {
35-
var input = fs.readFileSync(join(root, name, 'input.md'))
36-
var output = fs.readFileSync(join(root, name, 'output.json'))
37-
var config = {}
38-
var expected = JSON.parse(output)
39-
var actual
40-
var processor = unified()
41-
42-
try {
43-
config = JSON.parse(fs.readFileSync(join(root, name, 'config.json')))
44-
} catch (_) {}
45-
46-
processor.use(remarkParse).use(remarkGfm)
47-
48-
if (config.useRemarkFootnotes) {
49-
processor.use(remarkFootnotes, {inlineNotes: true})
50-
}
51-
52-
if (config.useRemarkAttr) {
53-
// To do: add remark attr back when it’s updated for the new parser.
54-
// `processor.use(remarkAttr)`
55-
return
56-
}
57-
58-
actual = toc(processor.parse(input), config)
59-
60-
t.deepEqual(actual, expected, name)
61-
})
29+
var files = fs.readdirSync(root)
30+
var index = -1
31+
var name
32+
var input
33+
var expected
34+
var actual
35+
var config
36+
var processor
37+
38+
while (++index < files.length) {
39+
name = files[index]
40+
41+
if (name.indexOf('.') === 0) continue
42+
43+
input = fs.readFileSync(join(root, name, 'input.md'))
44+
expected = JSON.parse(fs.readFileSync(join(root, name, 'output.json')))
45+
processor = unified().use(remarkParse).use(remarkGfm)
46+
47+
try {
48+
config = JSON.parse(fs.readFileSync(join(root, name, 'config.json')))
49+
} catch (_) {
50+
config = {}
51+
}
52+
53+
if (config.useRemarkFootnotes) {
54+
processor.use(remarkFootnotes, {inlineNotes: true})
55+
}
56+
57+
if (config.useRemarkAttr) {
58+
// To do: add remark attr back when it’s updated for the new parser.
59+
// `processor.use(remarkAttr)`
60+
continue
61+
}
62+
63+
actual = toc(processor.parse(input), config)
64+
65+
t.deepEqual(actual, expected, name)
66+
}
6267

6368
t.end()
6469
})

0 commit comments

Comments
 (0)