@@ -6,24 +6,29 @@ import { encodeBase64 } from "@std/encoding/base64"
6
6
; ( Report as testing ) . testing ( )
7
7
8
8
const base = new URL ( "testing/" , import . meta. url )
9
+ const rules = {
10
+ "at-rule-no-deprecated" : false ,
11
+ "declaration-property-value-no-unknown" : false ,
12
+ "declaration-property-value-keyword-no-deprecated" : false ,
13
+ }
9
14
10
15
test ( "`report.for()` detects features" , async ( ) => {
11
- const css = await bundle ( new URL ( "test_compatibility.css" , base ) )
16
+ const css = await bundle ( new URL ( "test_compatibility.css" , base ) , { rules } )
12
17
const result = new Report ( "defaults, ie > 8" , { loglevel : - 1 } ) . for ( css )
13
18
expect ( result . features . list ) . toContain ( "properties/backdrop-filter" )
14
19
expect ( result . browsers . ie [ "9" ] . support . unsupported ) . toHaveProperty ( "properties/backdrop-filter" )
15
- } , { permissions : { read : true } } )
20
+ } , { permissions : { read : true , env : true } } )
16
21
17
22
test ( "`report.for()` supports advanced usecases" , async ( ) => {
18
- const css = await bundle ( new URL ( "test_compatibility_complex.css" , base ) )
23
+ const css = await bundle ( new URL ( "test_compatibility_complex.css" , base ) , { rules } )
19
24
expect ( ( ) => new Report ( "> 0%" , { loglevel : - 1 } ) . for ( css ) ) . not . toThrow ( )
20
- } , { permissions : { read : true } } )
25
+ } , { permissions : { read : true , env : true } } )
21
26
22
27
test ( "`report.print()` formats and outputs results" , async ( ) => {
23
28
const report = new Report ( "> 0%" , { loglevel : - 1 } )
24
29
const _ = console . log
25
30
try {
26
- const css = await bundle ( new URL ( "test_compatibility.css" , base ) )
31
+ const css = await bundle ( new URL ( "test_compatibility.css" , base ) , { rules } )
27
32
let text = ""
28
33
const log = fn ( ( message : string ) => text = message )
29
34
Object . assign ( console , { log } )
@@ -51,7 +56,9 @@ test("`report.print()` formats and outputs results", async () => {
51
56
}
52
57
// Force coverage of colors
53
58
for ( const pass of [ 7 , 8 , 9 , 10 , NaN ] ) {
54
- const css = Number . isNaN ( pass ) ? await bundle ( new URL ( "test_compatibility_print.css" , base ) ) : `:root { ${ new Array ( pass ) . fill ( null ) . map ( ( _ , i ) => `-debug-pass-${ i } : 1px` ) . join ( ";" ) } ; ${ new Array ( 10 - pass ) . fill ( null ) . map ( ( _ , i ) => `-debug-fail-${ i } : 1px` ) . join ( ";" ) } }`
59
+ const css = Number . isNaN ( pass )
60
+ ? await bundle ( new URL ( "test_compatibility_print.css" , base ) , { rules } )
61
+ : `:root { ${ new Array ( pass ) . fill ( null ) . map ( ( _ , i ) => `-debug-pass-${ i } : 1px` ) . join ( ";" ) } ; ${ new Array ( 10 - pass ) . fill ( null ) . map ( ( _ , i ) => `-debug-fail-${ i } : 1px` ) . join ( ";" ) } }`
55
62
for ( const output of [ "console" , "html" ] as const ) {
56
63
const report = new Report ( Number . isNaN ( pass ) ? "> 0%" : "last 2 chrome versions" , { loglevel : - 1 } )
57
64
report . for ( css ) . print ( { output, view : "browsers" , verbose : true } )
@@ -60,7 +67,7 @@ test("`report.print()` formats and outputs results", async () => {
60
67
} finally {
61
68
Object . assign ( console , { log : _ } )
62
69
}
63
- } , { permissions : { read : true } } )
70
+ } , { permissions : { read : true , env : true } } )
64
71
65
72
test ( "`compatibility()` supports printing reports" , async ( ) => {
66
73
const input = "body { color: salmon; }"
@@ -75,4 +82,4 @@ test("`compatibility()` supports printing reports", async () => {
75
82
} finally {
76
83
Object . assign ( console , { log : _ } )
77
84
}
78
- } , { permissions : { read : true } } )
85
+ } , { permissions : { read : true , env : true } } )
0 commit comments