1+ let { deepStrictEqual, equal, throws } = require ( 'node:assert' )
12let { readdirSync, readFileSync } = require ( 'node:fs' )
23let { extname, join } = require ( 'node:path' )
4+ let { test } = require ( 'node:test' )
35let { jsonify } = require ( 'postcss-parser-tests' )
4- let { test } = require ( 'uvu' )
5- let { equal, throws } = require ( 'uvu/assert' )
66
77let parse = require ( '../parse' )
88
@@ -14,55 +14,55 @@ test('detects indent', () => {
1414test ( 'throws on first indent' , ( ) => {
1515 throws ( ( ) => {
1616 parse ( ' @charset "UTF-8"' )
17- } , ' <css input>:1:1: First line should not have indent' )
17+ } , / < c s s i n p u t > : 1 : 1 : F i r s t l i n e s h o u l d n o t h a v e i n d e n t / )
1818} )
1919
2020test ( 'throws on too big indent' , ( ) => {
2121 throws ( ( ) => {
2222 parse ( '@supports\n @media\n // test' )
23- } , ' <css input>:3:1: Expected 4 indent, but get 6' )
23+ } , / < c s s i n p u t > : 3 : 1 : E x p e c t e d 4 i n d e n t , b u t g e t 6 / )
2424} )
2525
2626test ( 'throws on wrong indent step' , ( ) => {
2727 throws ( ( ) => {
2828 parse ( '@supports\n @media\n @media' )
29- } , ' <css input>:3:1: Expected 0 or 2 indent, but get 1' )
29+ } , / < c s s i n p u t > : 3 : 1 : E x p e c t e d 0 o r 2 i n d e n t , b u t g e t 1 / )
3030} )
3131
3232test ( 'throws on decl without property' , ( ) => {
3333 throws ( ( ) => {
3434 parse ( ': black' )
35- } , ' <css input>:1:1: Declaration without name' )
35+ } , / < c s s i n p u t > : 1 : 1 : D e c l a r a t i o n w i t h o u t n a m e / )
3636} )
3737
3838test ( 'throws on space between property' , ( ) => {
3939 throws ( ( ) => {
4040 parse ( 'one two: black' )
41- } , ' <css input>:1:5: Unexpected separator in property' )
41+ } , / < c s s i n p u t > : 1 : 5 : U n e x p e c t e d s e p a r a t o r i n p r o p e r t y / )
4242} )
4343
4444test ( 'throws on semicolon in declaration' , ( ) => {
4545 throws ( ( ) => {
4646 parse ( 'a\n color: black;' )
47- } , ' <css input>:2:15: Unnecessary semicolon' )
47+ } , / < c s s i n p u t > : 2 : 1 5 : U n n e c e s s a r y s e m i c o l o n / )
4848} )
4949
5050test ( 'throws on semicolon in at-rule' , ( ) => {
5151 throws ( ( ) => {
5252 parse ( '@charset "UTF-8";' )
53- } , ' <css input>:1:17: Unnecessary semicolon' )
53+ } , / < c s s i n p u t > : 1 : 1 7 : U n n e c e s s a r y s e m i c o l o n / )
5454} )
5555
5656test ( 'throws on curly in rule' , ( ) => {
5757 throws ( ( ) => {
5858 parse ( 'a {\n color: black' )
59- } , ' <css input>:1:3: Unnecessary curly bracket' )
59+ } , / < c s s i n p u t > : 1 : 3 : U n n e c e s s a r y c u r l y b r a c k e t / )
6060} )
6161
6262test ( 'throws on curly in at-rule' , ( ) => {
6363 throws ( ( ) => {
6464 parse ( '@media (screen) {\n color: black' )
65- } , ' <css input>:1:17: Unnecessary curly bracket' )
65+ } , / < c s s i n p u t > : 1 : 1 7 : U n n e c e s s a r y c u r l y b r a c k e t / )
6666} )
6767
6868test ( 'keeps trailing spaces' , ( ) => {
@@ -90,7 +90,7 @@ test('generates correct source maps on trailing spaces', () => {
9090} )
9191
9292test ( 'sets end position for root' , ( ) => {
93- equal ( parse ( 'a\n b: 1\n' ) . source . end , { column : 6 , line : 2 } )
93+ deepStrictEqual ( parse ( 'a\n b: 1\n' ) . source . end , { column : 6 , line : 2 } )
9494} )
9595
9696let tests = readdirSync ( join ( __dirname , 'cases' ) ) . filter (
@@ -114,8 +114,6 @@ for (let name of tests) {
114114 }
115115 } )
116116 equal ( result . css , css )
117- equal ( jsonify ( root ) , JSON . parse ( json . trim ( ) ) )
117+ deepStrictEqual ( jsonify ( root ) , JSON . parse ( json . trim ( ) ) )
118118 } )
119119}
120-
121- test . run ( )
0 commit comments