@@ -51,7 +51,7 @@ test('should remove exports if noEmitExports is true', async (t) => {
51
51
await run ( t , '@value red blue;' , '' , { noEmitExports : true } ) ;
52
52
} ) ;
53
53
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 ) => {
55
55
const input = '@value red blue\n@value green yellow' ;
56
56
const processor = postcss ( [ plugin ] ) ;
57
57
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) => {
61
61
t . expect ( warnings [ 0 ] . text ) . toBe ( 'Invalid value definition: red blue\n@value green yellow' ) ;
62
62
} ) ;
63
63
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
+
64
74
test ( 'gives an error when path to imported file is wrong' , async ( t ) => {
65
75
const input = '@value red from "./non-existent-file.css"' ;
66
76
const processor = postcss ( [ plugin ] ) ;
67
77
await t . expect ( processor . process ( input , parserOpts ) ) . rejects . toThrow ( "Can't resolve './non-existent-file.css'" ) ;
68
78
} ) ;
69
79
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 ) => {
71
81
const input = '@value , from "./colors.css"' ;
72
82
const processor = postcss ( [ plugin ] ) ;
73
83
await t . expect ( processor . process ( input , parserOpts ) ) . rejects . toThrow ( '@value statement "" is invalid!' ) ;
0 commit comments