1
- 'use strict'
2
-
3
- var test = require ( 'tape' )
4
- var chalk = require ( 'chalk' )
5
- var strip = require ( 'strip-ansi' )
6
- var u = require ( 'unist-builder' )
7
- var h = require ( 'hastscript' )
8
- var x = require ( 'xastscript' )
9
- var retext = require ( 'retext' )
10
- var fromXml = require ( 'xast-util-from-xml' )
11
- var inspect = require ( '.' )
1
+ import test from 'tape'
2
+ import chalk from 'chalk'
3
+ import strip from 'strip-ansi'
4
+ import u from 'unist-builder'
5
+ import h from 'hastscript'
6
+ import x from 'xastscript'
7
+ import retext from 'retext'
8
+ import fromXml from 'xast-util-from-xml'
9
+ import { inspect , inspectColor , inspectNoColor } from './index.js'
12
10
13
11
var chalkEnabled = new chalk . Instance ( { level : 1 } )
14
12
@@ -17,16 +15,6 @@ var paragraph = 'Some simple text. Other “sentence”.'
17
15
test ( 'inspect' , function ( t ) {
18
16
t . equal ( typeof inspect , 'function' , 'should be a `function`' )
19
17
20
- t . test ( 'should have `color` and `noColor` properties' , function ( st ) {
21
- st . equal ( typeof inspect . color , 'function' )
22
- st . equal ( typeof inspect . noColor , 'function' )
23
-
24
- st . equal ( typeof inspect . color . noColor , 'function' )
25
- st . equal ( typeof inspect . noColor . color , 'function' )
26
-
27
- st . end ( )
28
- } )
29
-
30
18
t . end ( )
31
19
} )
32
20
@@ -69,7 +57,7 @@ test('inspect()', function (t) {
69
57
t . test ( 'should work on non-nodes' , function ( st ) {
70
58
st . equal ( strip ( inspect ( 'foo' ) ) , '"foo"' )
71
59
st . equal ( strip ( inspect ( null ) ) , 'null' )
72
- st . equal ( strip ( inspect ( NaN ) ) , 'null' )
60
+ st . equal ( strip ( inspect ( Number . NaN ) ) , 'null' )
73
61
st . equal ( strip ( inspect ( 3 ) ) , '3' )
74
62
75
63
st . end ( )
@@ -340,9 +328,9 @@ test('inspect()', function (t) {
340
328
t . end ( )
341
329
} )
342
330
343
- test ( 'inspect.noColor ()' , function ( t ) {
331
+ test ( 'inspectNoColor ()' , function ( t ) {
344
332
t . equal (
345
- inspect . noColor ( retext ( ) . parse ( paragraph ) . children [ 0 ] . children [ 0 ] ) ,
333
+ inspectNoColor ( retext ( ) . parse ( paragraph ) . children [ 0 ] . children [ 0 ] ) ,
346
334
[
347
335
'SentenceNode[6] (1:1-1:18, 0-17)' ,
348
336
'├─0 WordNode[1] (1:1-1:5, 0-4)' ,
@@ -361,9 +349,9 @@ test('inspect.noColor()', function (t) {
361
349
t . end ( )
362
350
} )
363
351
364
- test ( 'inspect.color ()' , function ( t ) {
352
+ test ( 'inspectColor ()' , function ( t ) {
365
353
t . equal (
366
- inspect . color ( retext ( ) . parse ( paragraph ) . children [ 0 ] . children [ 0 ] ) ,
354
+ inspectColor ( retext ( ) . parse ( paragraph ) . children [ 0 ] . children [ 0 ] ) ,
367
355
[
368
356
chalkEnabled . bold ( 'SentenceNode' ) +
369
357
chalkEnabled . dim ( '[' ) +
0 commit comments