Skip to content

Commit a42e092

Browse files
committed
Update dev-dependencies
1 parent 777a325 commit a42e092

File tree

5 files changed

+59
-53
lines changed

5 files changed

+59
-53
lines changed

package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,23 @@
3535
"vfile-location": "^3.0.0"
3636
},
3737
"devDependencies": {
38-
"browserify": "^16.0.0",
38+
"browserify": "^17.0.0",
3939
"is-hidden": "^1.0.0",
4040
"negate": "^1.0.0",
4141
"nyc": "^15.0.0",
4242
"parse-dutch": "^4.0.0",
4343
"parse-english": "^4.0.0",
4444
"parse-latin": "^4.0.0",
4545
"prettier": "^2.0.0",
46-
"remark": "^12.0.0",
47-
"remark-cli": "^8.0.0",
48-
"remark-frontmatter": "^2.0.0",
49-
"remark-preset-wooorm": "^7.0.0",
46+
"remark": "^13.0.0",
47+
"remark-cli": "^9.0.0",
48+
"remark-frontmatter": "^3.0.0",
49+
"remark-gfm": "^1.0.0",
50+
"remark-preset-wooorm": "^8.0.0",
5051
"tape": "^5.0.0",
51-
"tinyify": "^2.0.0",
52-
"vfile": "^4.0.0",
53-
"xo": "^0.32.0"
52+
"tinyify": "^3.0.0",
53+
"to-vfile": "^6.1.0",
54+
"xo": "^0.34.0"
5455
},
5556
"scripts": {
5657
"format": "remark *.md -qfo && prettier . --write && xo --fix",

test/fixtures/blocks/options.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"useRemarkFrontmatter": true
3+
}

test/fixtures/ignore/options.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"useRemarkGfm": true
3+
}

test/fixtures/list/output.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -533,9 +533,9 @@
533533
"value": "\n\n",
534534
"position": {
535535
"start": {
536-
"line": 5,
537-
"column": 1,
538-
"offset": 60
536+
"line": 4,
537+
"column": 17,
538+
"offset": 59
539539
},
540540
"end": {
541541
"line": 6,

test/index.js

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,81 +4,75 @@ var fs = require('fs')
44
var path = require('path')
55
var test = require('tape')
66
var remark = require('remark')
7+
var gfm = require('remark-gfm')
78
var frontmatter = require('remark-frontmatter')
8-
var vfile = require('vfile')
9+
var vfile = require('to-vfile')
910
var Latin = require('parse-latin')
1011
var Dutch = require('parse-dutch')
1112
var English = require('parse-english')
1213
var negate = require('negate')
1314
var hidden = require('is-hidden')
14-
var toNLCST = require('..')
15-
16-
var read = fs.readFileSync
17-
var join = path.join
18-
19-
var ROOT = join(__dirname, 'fixtures')
20-
21-
var fixtures = fs.readdirSync(ROOT)
15+
var toNlcst = require('..')
2216

2317
test('mdast-util-to-nlcst', function (t) {
2418
t.throws(
2519
function () {
26-
toNLCST()
20+
toNlcst()
2721
},
2822
/mdast-util-to-nlcst expected node/,
2923
'should fail when not given an AST'
3024
)
3125

3226
t.throws(
3327
function () {
34-
toNLCST({})
28+
toNlcst({})
3529
},
3630
/mdast-util-to-nlcst expected node/,
3731
'should fail when not given an AST (#2)'
3832
)
3933

4034
t.throws(
4135
function () {
42-
toNLCST({type: 'foo'})
36+
toNlcst({type: 'foo'})
4337
},
4438
/mdast-util-to-nlcst expected file/,
4539
'should fail when not given a file'
4640
)
4741

4842
t.throws(
4943
function () {
50-
toNLCST({type: 'foo'})
44+
toNlcst({type: 'foo'})
5145
},
5246
/mdast-util-to-nlcst expected file/,
5347
'should fail when not given a file (#2)'
5448
)
5549

5650
t.throws(
5751
function () {
58-
toNLCST({type: 'text', value: 'foo'}, {foo: 'bar'})
52+
toNlcst({type: 'text', value: 'foo'}, {foo: 'bar'})
5953
},
6054
/mdast-util-to-nlcst expected file/,
6155
'should fail when not given a file (#3)'
6256
)
6357

6458
t.throws(
6559
function () {
66-
toNLCST({type: 'text', value: 'foo'}, vfile('foo'))
60+
toNlcst({type: 'text', value: 'foo'}, vfile({contents: 'foo'}))
6761
},
6862
/mdast-util-to-nlcst expected parser/,
6963
'should fail without parser'
7064
)
7165

7266
t.throws(
7367
function () {
74-
toNLCST({type: 'text', value: 'foo'}, vfile(), Latin)
68+
toNlcst({type: 'text', value: 'foo'}, vfile(), Latin)
7569
},
7670
/mdast-util-to-nlcst expected position on nodes/,
7771
'should fail when not given positional information'
7872
)
7973

8074
t.doesNotThrow(function () {
81-
toNLCST(
75+
toNlcst(
8276
{
8377
type: 'text',
8478
value: 'foo',
@@ -90,7 +84,7 @@ test('mdast-util-to-nlcst', function (t) {
9084
}, 'should accept a parser constructor')
9185

9286
t.doesNotThrow(function () {
93-
toNLCST(
87+
toNlcst(
9488
{
9589
type: 'text',
9690
value: 'foo',
@@ -103,7 +97,7 @@ test('mdast-util-to-nlcst', function (t) {
10397

10498
t.throws(
10599
function () {
106-
toNLCST(
100+
toNlcst(
107101
{
108102
type: 'text',
109103
value: 'foo',
@@ -118,13 +112,13 @@ test('mdast-util-to-nlcst', function (t) {
118112
)
119113

120114
t.test('should accept nodes without offsets', function (st) {
121-
var node = toNLCST(
115+
var node = toNlcst(
122116
{
123117
type: 'text',
124118
value: 'foo',
125119
position: {start: {line: 1, column: 1}, end: {line: 1, column: 4}}
126120
},
127-
vfile('foo'),
121+
vfile({contents: 'foo'}),
128122
Latin
129123
)
130124

@@ -138,27 +132,32 @@ test('mdast-util-to-nlcst', function (t) {
138132
})
139133

140134
test('Fixtures', function (t) {
141-
fixtures.filter(negate(hidden)).forEach(function (fixture) {
142-
var filepath = join(ROOT, fixture)
143-
var output = read(join(filepath, 'output.json'), 'utf-8')
144-
var input = read(join(filepath, 'input.md'), 'utf-8')
145-
var options
146-
147-
try {
148-
options = JSON.parse(read(join(filepath, 'options.json')))
149-
} catch (_) {}
150-
151-
t.deepEqual(
152-
toNLCST(
153-
remark().use(frontmatter).parse(input),
154-
vfile(input),
155-
Latin,
156-
options
157-
),
158-
JSON.parse(output),
159-
'should work on `' + fixture + '`'
160-
)
161-
})
135+
var base = path.join(__dirname, 'fixtures')
136+
137+
fs.readdirSync(base)
138+
.filter(negate(hidden))
139+
.forEach(function (name) {
140+
var input = vfile.readSync(path.join(base, name, 'input.md'))
141+
var expected = JSON.parse(
142+
vfile.readSync(path.join(base, name, 'output.json'))
143+
)
144+
var options
145+
146+
try {
147+
options = JSON.parse(
148+
vfile.readSync(path.join(base, name, 'options.json'))
149+
)
150+
} catch (_) {}
151+
152+
var mdast = remark()
153+
.use(options && options.useRemarkGfm ? gfm : [])
154+
.use(options && options.useRemarkFrontmatter ? frontmatter : [])
155+
.parse(input)
156+
157+
var actual = toNlcst(mdast, input, Latin, options)
158+
159+
t.deepEqual(actual, expected, 'should work on `' + name + '`')
160+
})
162161

163162
t.end()
164163
})

0 commit comments

Comments
 (0)