Skip to content

Commit e5954e7

Browse files
committed
Update dev-dependencies
1 parent 3f241ee commit e5954e7

File tree

3 files changed

+45
-103
lines changed

3 files changed

+45
-103
lines changed

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
coverage/
2+
*.json
3+
*.md

package.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@
3939
"is-hidden": "^1.0.0",
4040
"negate": "^1.0.0",
4141
"nyc": "^15.0.0",
42-
"prettier": "^1.0.0",
43-
"remark-cli": "^7.0.0",
44-
"remark-preset-wooorm": "^6.0.0",
45-
"tape": "^4.0.0",
46-
"xo": "^0.27.0"
42+
"prettier": "^2.0.0",
43+
"remark-cli": "^8.0.0",
44+
"remark-preset-wooorm": "^7.0.0",
45+
"tape": "^5.0.0",
46+
"xo": "^0.32.0"
4747
},
4848
"scripts": {
49-
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
49+
"format": "remark . -qfo && prettier . --write && xo --fix",
5050
"test-api": "node test",
5151
"test-coverage": "nyc --reporter lcov tape test/index.js",
5252
"test": "npm run format && npm run test-coverage"
@@ -69,6 +69,8 @@
6969
"prettier": true,
7070
"esnext": false,
7171
"rules": {
72+
"unicorn/no-fn-reference-in-iterator": "off",
73+
"unicorn/prefer-optional-catch-binding": "off",
7274
"complexity": "off"
7375
}
7476
},

test/index.js

Lines changed: 35 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,16 @@ var fromXml = require('..')
99

1010
var join = path.join
1111

12-
test('xast-util-from-xml', function(t) {
12+
test('xast-util-from-xml', function (t) {
1313
t.equal(typeof fromXml, 'function', 'should expose a function')
1414

1515
try {
1616
fromXml('<root unquoted=attribute>')
1717
t.fail('should fail (1)')
1818
} catch (error) {
19-
t.deepEqual(
20-
error,
21-
{
22-
message: 'Unquoted attribute value',
23-
name: '1:17',
24-
reason: 'Unquoted attribute value',
25-
line: 1,
26-
column: 17,
27-
location: {
28-
start: {line: 1, column: 17, offset: 16},
29-
end: {line: null, column: null}
30-
},
31-
source: 'xast-util-from-xml',
32-
ruleId: 'sax'
33-
},
19+
t.equal(
20+
String(error),
21+
'1:17: Unquoted attribute value',
3422
'should throw messages'
3523
)
3624
}
@@ -39,21 +27,9 @@ test('xast-util-from-xml', function(t) {
3927
fromXml('<!ENTITY>')
4028
t.fail('should fail (2)')
4129
} catch (error) {
42-
t.deepEqual(
43-
error,
44-
{
45-
message: 'Unexpected SGML declaration',
46-
name: '1:10',
47-
reason: 'Unexpected SGML declaration',
48-
line: 1,
49-
column: 10,
50-
location: {
51-
start: {line: 1, column: 10, offset: 9},
52-
end: {line: null, column: null}
53-
},
54-
source: 'xast-util-from-xml',
55-
ruleId: 'unexpected-sgml'
56-
},
30+
t.deepLooseEqual(
31+
String(error),
32+
'1:10: Unexpected SGML declaration',
5733
'should throw for SGML directives'
5834
)
5935
}
@@ -62,21 +38,9 @@ test('xast-util-from-xml', function(t) {
6238
fromXml('<root>&foo;</root>')
6339
t.fail('should fail (3)')
6440
} catch (error) {
65-
t.deepEqual(
66-
error,
67-
{
68-
message: 'Invalid character entity',
69-
name: '1:12',
70-
reason: 'Invalid character entity',
71-
line: 1,
72-
column: 12,
73-
location: {
74-
start: {line: 1, column: 12, offset: 11},
75-
end: {line: null, column: null}
76-
},
77-
source: 'xast-util-from-xml',
78-
ruleId: 'sax'
79-
},
41+
t.deepLooseEqual(
42+
String(error),
43+
'1:12: Invalid character entity',
8044
'should throw for unknown entities (1)'
8145
)
8246
}
@@ -85,21 +49,9 @@ test('xast-util-from-xml', function(t) {
8549
fromXml('<root>&copy;</root>')
8650
t.fail('should fail (4)')
8751
} catch (error) {
88-
t.deepEqual(
89-
error,
90-
{
91-
message: 'Invalid character entity',
92-
name: '1:13',
93-
reason: 'Invalid character entity',
94-
line: 1,
95-
column: 13,
96-
location: {
97-
start: {line: 1, column: 13, offset: 12},
98-
end: {line: null, column: null}
99-
},
100-
source: 'xast-util-from-xml',
101-
ruleId: 'sax'
102-
},
52+
t.deepLooseEqual(
53+
String(error),
54+
'1:13: Invalid character entity',
10355
'should throw for unknown entities (2)'
10456
)
10557
}
@@ -108,155 +60,143 @@ test('xast-util-from-xml', function(t) {
10860
fromXml('<root><a><b><c/></a></b></root>')
10961
t.fail('should fail (5)')
11062
} catch (error) {
111-
t.deepEqual(
112-
error,
113-
{
114-
message: 'Unexpected close tag',
115-
name: '1:21',
116-
reason: 'Unexpected close tag',
117-
line: 1,
118-
column: 21,
119-
location: {
120-
start: {line: 1, column: 21, offset: 20},
121-
end: {line: null, column: null}
122-
},
123-
source: 'xast-util-from-xml',
124-
ruleId: 'sax'
125-
},
63+
t.deepLooseEqual(
64+
String(error),
65+
'1:21: Unexpected close tag',
12666
'should throw on invalid nesting'
12767
)
12868
}
12969

13070
t.throws(
131-
function() {
71+
function () {
13272
fromXml('<!doctype>')
13373
},
13474
/1:11: Expected doctype name/,
13575
'should throw on missing doctype name'
13676
)
13777

13878
t.throws(
139-
function() {
79+
function () {
14080
fromXml('<!doctype !>')
14181
},
14282
/1:13: Expected start of doctype name/,
14383
'should throw on invalid doctype name'
14484
)
14585

14686
t.throws(
147-
function() {
87+
function () {
14888
fromXml('<!DOCTYPE name[<!ELEMENT greeting (#PCDATA)>]>')
14989
},
15090
/1:47: Unexpected internal subset/,
15191
'should throw on internal subset directly after doctype name'
15292
)
15393

15494
t.throws(
155-
function() {
95+
function () {
15696
fromXml('<!DOCTYPE name [<!ELEMENT greeting (#PCDATA)>]>')
15797
},
15898
/1:48: Unexpected internal subset/,
15999
'should throw on internal subset after doctype name'
160100
)
161101

162102
t.throws(
163-
function() {
103+
function () {
164104
fromXml('<!DOCTYPE name!>')
165105
},
166106
/1:17: Expected doctype name character, whitespace, or doctype end/,
167107
'should throw on invalid character directly after doctype'
168108
)
169109

170110
t.throws(
171-
function() {
111+
function () {
172112
fromXml('<!DOCTYPE name !>')
173113
},
174114
/1:18: Expected external identifier \(`PUBLIC` or `SYSTEM`\), whitespace, or doctype end/,
175115
'should throw on invalid character after doctype'
176116
)
177117

178118
t.throws(
179-
function() {
119+
function () {
180120
fromXml('<!DOCTYPE name PUB>')
181121
},
182122
/1:20: Expected external identifier \(`PUBLIC` or `SYSTEM`\)/,
183123
'should throw on invalid external identifier (1)'
184124
)
185125

186126
t.throws(
187-
function() {
127+
function () {
188128
fromXml('<!DOCTYPE name SYSTEm>')
189129
},
190130
/1:23: Expected external identifier \(`PUBLIC` or `SYSTEM`\)/,
191131
'should throw on invalid external identifier (2)'
192132
)
193133

194134
t.throws(
195-
function() {
135+
function () {
196136
fromXml('<!DOCTYPE name PUBLIC>')
197137
},
198138
/1:23: Expected whitespace after `PUBLIC`/,
199139
'should throw on missing whitespace after public identifier'
200140
)
201141

202142
t.throws(
203-
function() {
143+
function () {
204144
fromXml('<!DOCTYPE name PUBLIC !>')
205145
},
206146
/1:25: Expected quote or apostrophe to start public literal/,
207147
'should throw on invalid character after public identifier'
208148
)
209149

210150
t.throws(
211-
function() {
151+
function () {
212152
fromXml('<!DOCTYPE name PUBLIC "🤔">')
213153
},
214154
/1:28: Expected pubid character in public literal/,
215155
'should throw on invalid character in public identifier'
216156
)
217157

218158
t.throws(
219-
function() {
159+
function () {
220160
fromXml('<!DOCTYPE name PUBLIC "literal"!>')
221161
},
222162
/1:34: Expected whitespace after public literal/,
223163
'should throw on invalid character after public literal'
224164
)
225165

226166
t.throws(
227-
function() {
167+
function () {
228168
fromXml('<!DOCTYPE name SYSTEM>')
229169
},
230170
/1:23: Expected whitespace after `SYSTEM`/,
231171
'should throw on missing whitespace after system identifier'
232172
)
233173

234174
t.throws(
235-
function() {
175+
function () {
236176
fromXml('<!DOCTYPE name SYSTEM !>')
237177
},
238178
/1:25: Expected quote or apostrophe to start system literal/,
239179
'should throw on invalid character after system identifier'
240180
)
241181

242182
t.throws(
243-
function() {
183+
function () {
244184
fromXml('<!DOCTYPE name SYSTEM "asd>')
245185
},
246186
/1:28: Unexpected end/,
247187
'should throw on unended system literal'
248188
)
249189

250190
t.throws(
251-
function() {
191+
function () {
252192
fromXml('<!DOCTYPE name SYSTEM "asd" [<!ELEMENT greeting (#PCDATA)>]>')
253193
},
254194
/1:61: Unexpected internal subset/,
255195
'should throw on internal subset after external id'
256196
)
257197

258198
t.throws(
259-
function() {
199+
function () {
260200
fromXml('<!DOCTYPE name SYSTEM "asd" !>')
261201
},
262202
/1:31: Expected whitespace or end of doctype/,
@@ -266,12 +206,10 @@ test('xast-util-from-xml', function(t) {
266206
t.end()
267207
})
268208

269-
test('fixtures', function(t) {
209+
test('fixtures', function (t) {
270210
var base = join('test', 'fixtures')
271211

272-
fs.readdirSync(base)
273-
.filter(negate(hidden))
274-
.forEach(each)
212+
fs.readdirSync(base).filter(negate(hidden)).forEach(each)
275213

276214
t.end()
277215

0 commit comments

Comments
 (0)