@@ -51,7 +51,7 @@ test('should remove exports if noEmitExports is true', async (t) => {
5151 await run ( t , '@value red blue;' , '' , { noEmitExports : true } ) ;
5252} ) ;
5353
54- test ( 'gives an error when there is no semicolon between lines' , async ( t ) => {
54+ test ( 'gives a warning when there is no semicolon between lines' , async ( t ) => {
5555 const input = '@value red blue\n@value green yellow' ;
5656 const processor = postcss ( [ plugin ] ) ;
5757 const result = await processor . process ( input , { from : undefined } ) ;
@@ -61,13 +61,23 @@ test('gives an error when there is no semicolon between lines', async (t) => {
6161 t . expect ( warnings [ 0 ] . text ) . toBe ( 'Invalid value definition: red blue\n@value green yellow' ) ;
6262} ) ;
6363
64+ test ( 'gives a warning when @value definition is invalid' , async ( t ) => {
65+ const input = '@value oops:;' ;
66+ const processor = postcss ( [ plugin ] ) ;
67+ const result = await processor . process ( input , { from : undefined } ) ;
68+ const warnings = result . warnings ( ) ;
69+
70+ t . expect ( warnings . length ) . toBe ( 1 ) ;
71+ t . expect ( warnings [ 0 ] . text ) . toBe ( 'Invalid value definition: oops:' ) ;
72+ } ) ;
73+
6474test ( 'gives an error when path to imported file is wrong' , async ( t ) => {
6575 const input = '@value red from "./non-existent-file.css"' ;
6676 const processor = postcss ( [ plugin ] ) ;
6777 await t . expect ( processor . process ( input , parserOpts ) ) . rejects . toThrow ( "Can't resolve './non-existent-file.css'" ) ;
6878} ) ;
6979
70- test ( 'gives an error when @value statement is invalid' , async ( t ) => {
80+ test ( 'gives an error when @value import statement is invalid' , async ( t ) => {
7181 const input = '@value , from "./colors.css"' ;
7282 const processor = postcss ( [ plugin ] ) ;
7383 await t . expect ( processor . process ( input , parserOpts ) ) . rejects . toThrow ( '@value statement "" is invalid!' ) ;
0 commit comments