@@ -7,7 +7,10 @@ import assert from 'node:assert/strict';
77
88import { Logger } from '../utils.js' ;
99
10- import test , { checkExperimental } from './test-status.js' ;
10+ import test , {
11+ checkExperimental ,
12+ standardTrackExceptions ,
13+ } from './test-status.js' ;
1114
1215describe ( 'checkExperimental' , ( ) => {
1316 it ( 'should return true when data is not experimental' , ( ) => {
@@ -211,68 +214,81 @@ describe('checkStatus', () => {
211214 assert . ok ( logger . messages [ 0 ] . message . includes ( 'should be set to' ) ) ;
212215 } ) ;
213216
214- it ( 'should not log error for features in exception list missing spec_url' , ( ) => {
215- /** @type {CompatStatement } */
216- const data = {
217- status : {
218- experimental : false ,
219- standard_track : true ,
220- deprecated : false ,
221- } ,
222- support : { } ,
223- } ;
217+ describe ( 'standard-track-exceptions' , ( ) => {
218+ beforeEach ( ( ) => {
219+ standardTrackExceptions . add ( 'api.Foo' ) ;
220+ } ) ;
224221
225- // This feature is in the exception list
226- test . check ( logger , {
227- data,
228- path : { category : 'api' , full : 'api.AudioProcessingEvent' } ,
222+ afterEach ( ( ) => {
223+ standardTrackExceptions . delete ( 'api.Foo' ) ;
229224 } ) ;
230225
231- assert . equal ( logger . messages . length , 0 ) ;
232- } ) ;
226+ it ( 'should not log error for features in exception list missing spec_url' , ( ) => {
227+ /** @type {CompatStatement } */
228+ const data = {
229+ status : {
230+ experimental : false ,
231+ standard_track : true ,
232+ deprecated : false ,
233+ } ,
234+ support : { } ,
235+ } ;
233236
234- it ( 'should log warning when exception no longer applies (has spec_url)' , ( ) => {
235- /** @type {CompatStatement } */
236- const data = {
237- status : {
238- experimental : false ,
239- standard_track : true ,
240- deprecated : false ,
241- } ,
242- spec_url : 'https://example.com/spec' ,
243- support : { } ,
244- } ;
237+ test . check ( logger , {
238+ data,
239+ path : { category : 'api' , full : 'api.Foo' } ,
240+ } ) ;
245241
246- // This feature is in the exception list but now has spec_url
247- test . check ( logger , {
248- data,
249- path : { category : 'api' , full : 'api.AudioProcessingEvent' } ,
242+ // Feature is in the exception list.
243+
244+ assert . equal ( logger . messages . length , 0 ) ;
250245 } ) ;
251246
252- assert . equal ( logger . messages . length , 1 ) ;
253- assert . equal ( logger . messages [ 0 ] . level , 'warning' ) ;
254- assert . ok ( logger . messages [ 0 ] . message . includes ( 'exception list' ) ) ;
255- } ) ;
247+ it ( 'should log warning when exception no longer applies (has spec_url)' , ( ) => {
248+ /** @type {CompatStatement } */
249+ const data = {
250+ status : {
251+ experimental : false ,
252+ standard_track : true ,
253+ deprecated : false ,
254+ } ,
255+ spec_url : 'https://example.com/spec' ,
256+ support : { } ,
257+ } ;
256258
257- it ( 'should log warning when exception no longer applies (standard_track false)' , ( ) => {
258- /** @type {CompatStatement } */
259- const data = {
260- status : {
261- experimental : false ,
262- standard_track : false ,
263- deprecated : false ,
264- } ,
265- support : { } ,
266- } ;
259+ test . check ( logger , {
260+ data,
261+ path : { category : 'api' , full : 'api.Foo' } ,
262+ } ) ;
267263
268- // This feature is in the exception list but standard_track is now false
269- test . check ( logger , {
270- data,
271- path : { category : 'api' , full : 'api.AudioProcessingEvent' } ,
264+ // Feature is in the exception list but now has `spec_url`.
265+
266+ assert . equal ( logger . messages . length , 1 ) ;
267+ assert . equal ( logger . messages [ 0 ] . level , 'warning' ) ;
268+ assert . ok ( logger . messages [ 0 ] . message . includes ( 'exception list' ) ) ;
272269 } ) ;
273270
274- assert . equal ( logger . messages . length , 1 ) ;
275- assert . equal ( logger . messages [ 0 ] . level , 'warning' ) ;
276- assert . ok ( logger . messages [ 0 ] . message . includes ( 'exception list' ) ) ;
271+ it ( 'should log warning when exception no longer applies (standard_track false)' , ( ) => {
272+ /** @type {CompatStatement } */
273+ const data = {
274+ status : {
275+ experimental : false ,
276+ standard_track : false ,
277+ deprecated : false ,
278+ } ,
279+ support : { } ,
280+ } ;
281+
282+ test . check ( logger , {
283+ data,
284+ path : { category : 'api' , full : 'api.Foo' } ,
285+ } ) ;
286+
287+ // Feature is in the exception list but `standard_track` is now false.
288+
289+ assert . equal ( logger . messages . length , 1 ) ;
290+ assert . equal ( logger . messages [ 0 ] . level , 'warning' ) ;
291+ assert . ok ( logger . messages [ 0 ] . message . includes ( 'exception list' ) ) ;
292+ } ) ;
277293 } ) ;
278294} ) ;
0 commit comments