@@ -115,16 +115,16 @@ function restartTestTitleNumbering() {
115115function pluginTester ( options : PluginTesterOptions = { } ) {
116116 debug1 ( 'executing main babel-plugin-tester function' ) ;
117117
118- const globalContextHasExpectFn = 'expect' in globalThis && typeof expect == 'function' ;
119- const globalContextHasTestFn = 'it' in globalThis && typeof it == 'function' ;
118+ const globalContextHasExpectFn = 'expect' in globalThis && typeof expect === 'function' ;
119+ const globalContextHasTestFn = 'it' in globalThis && typeof it === 'function' ;
120120
121121 const globalContextHasDescribeFn =
122- 'describe' in globalThis && typeof describe == 'function' ;
122+ 'describe' in globalThis && typeof describe === 'function' ;
123123
124124 const globalContextExpectFnHasToMatchSnapshot = ( ( ) => {
125125 try {
126126 return globalContextHasExpectFn
127- ? typeof expect ( undefined ) ?. toMatchSnapshot == 'function'
127+ ? typeof expect ( undefined ) ?. toMatchSnapshot === 'function'
128128 : false ;
129129 } catch {
130130 /* istanbul ignore next */
@@ -133,11 +133,11 @@ function pluginTester(options: PluginTesterOptions = {}) {
133133 } ) ( ) ;
134134
135135 const globalContextTestFnHasSkip = globalContextHasTestFn
136- ? typeof it . skip == 'function'
136+ ? typeof it . skip === 'function'
137137 : false ;
138138
139139 const globalContextTestFnHasOnly = globalContextHasTestFn
140- ? typeof it . only == 'function'
140+ ? typeof it . only === 'function'
141141 : false ;
142142
143143 if ( ! globalContextHasDescribeFn ) {
@@ -253,7 +253,7 @@ function pluginTester(options: PluginTesterOptions = {}) {
253253 throw new TypeError ( ErrorMessage . BadConfigInvalidTestsArrayItemType ( ndx ) ) ;
254254 }
255255
256- const result = typeof test == 'string' || Boolean ( test ) ;
256+ const result = typeof test === 'string' || Boolean ( test ) ;
257257
258258 if ( ! result ) {
259259 debug2 ( `test item \`%O\` at index ${ ndx } was skipped` , test ) ;
@@ -275,7 +275,7 @@ function pluginTester(options: PluginTesterOptions = {}) {
275275 ) ;
276276 }
277277
278- const result = typeof test == 'string' || Boolean ( test ) ;
278+ const result = typeof test === 'string' || Boolean ( test ) ;
279279
280280 if ( ! result ) {
281281 debug2 ( `test property "${ title } " with value \`%O\` was skipped` , test ) ;
@@ -369,7 +369,7 @@ function pluginTester(options: PluginTesterOptions = {}) {
369369 functionName,
370370 // ? Just in case the script name/path has colons
371371 filePath : filePath
372- . split ( `file://${ process . platform == 'win32' ? '/' : '' } ` )
372+ . split ( `file://${ process . platform === 'win32' ? '/' : '' } ` )
373373 . at ( - 1 ) !
374374 . split ( ':' )
375375 . slice ( 0 , - 2 )
@@ -406,19 +406,19 @@ function pluginTester(options: PluginTesterOptions = {}) {
406406 return [
407407 reversedCallStack . findIndex ( ( { functionName, filePath } ) => {
408408 return (
409- functionName == 'defaultPluginTester' &&
409+ functionName === 'defaultPluginTester' &&
410410 parseScriptFilepathRegExp . test ( filePath )
411411 ) ;
412412 } ) ,
413413 reversedCallStack . findIndex ( ( { functionName, filePath } ) => {
414414 return (
415- functionName == 'pluginTester' &&
415+ functionName === 'pluginTester' &&
416416 /* istanbul ignore next */ parseScriptFilepathRegExp . test ( filePath )
417417 ) ;
418418 } ) ,
419419 reversedCallStack . findIndex ( ( { functionName, filePath } ) => {
420420 return (
421- functionName == 'resolveBaseConfig' &&
421+ functionName === 'resolveBaseConfig' &&
422422 parseScriptFilepathRegExp . test ( filePath )
423423 ) ;
424424 } )
@@ -469,7 +469,7 @@ function pluginTester(options: PluginTesterOptions = {}) {
469469 throw new TypeError (
470470 ErrorMessage . BadEnvironmentVariableRange ( name , s , range )
471471 ) ;
472- } else if ( start == end ) {
472+ } else if ( start === end ) {
473473 return start ;
474474 }
475475
@@ -494,10 +494,11 @@ function pluginTester(options: PluginTesterOptions = {}) {
494494 const testConfigs : PluginTesterTestConfig [ ] = [ ] ;
495495
496496 const useFixtureTitleNumbering =
497- baseConfig . titleNumbering == 'all' || baseConfig . titleNumbering == 'fixtures-only' ;
497+ baseConfig . titleNumbering === 'all' ||
498+ baseConfig . titleNumbering === 'fixtures-only' ;
498499
499500 const useTestObjectTitleNumbering =
500- baseConfig . titleNumbering == 'all' || baseConfig . titleNumbering == 'tests-only' ;
501+ baseConfig . titleNumbering === 'all' || baseConfig . titleNumbering = == 'tests-only' ;
501502
502503 if ( fixturesAbsolutePath ) {
503504 debug2 (
@@ -509,7 +510,7 @@ function pluginTester(options: PluginTesterOptions = {}) {
509510 debug2 ( 'generating test objects from fixtures path' ) ;
510511
511512 const describeBlock =
512- typeof describeBlockTitle == 'string'
513+ typeof describeBlockTitle === 'string'
513514 ? createAndPushDescribeConfig ( `${ describeBlockTitle } fixtures` )
514515 : undefined ;
515516
@@ -524,7 +525,7 @@ function pluginTester(options: PluginTesterOptions = {}) {
524525 } else {
525526 debug2 ( 'not generating test objects from fixtures path: path is not a directory' ) ;
526527 }
527- } else if ( typeof fixtures == 'string' ) {
528+ } else if ( typeof fixtures === 'string' ) {
528529 throw new TypeError (
529530 ErrorMessage . UnableToDeriveAbsolutePath (
530531 filepath ,
@@ -541,7 +542,7 @@ function pluginTester(options: PluginTesterOptions = {}) {
541542 debug2 ( 'generating test objects from tests' ) ;
542543
543544 const describeBlock =
544- typeof describeBlockTitle == 'string'
545+ typeof describeBlockTitle === 'string'
545546 ? createAndPushDescribeConfig ( describeBlockTitle )
546547 : undefined ;
547548
@@ -561,7 +562,7 @@ function pluginTester(options: PluginTesterOptions = {}) {
561562 ...entries . map ( ( [ title , test ] ) => {
562563 return createTestConfig ( {
563564 title,
564- ...( typeof test == 'string' ? { code : test } : test )
565+ ...( typeof test === 'string' ? { code : test } : test )
565566 } ) ;
566567 } )
567568 ) ;
@@ -988,7 +989,7 @@ function pluginTester(options: PluginTesterOptions = {}) {
988989 debug2 ( `registering ${ tests . length } blocks with testing framework` ) ;
989990
990991 tests . forEach ( ( testConfig ) => {
991- if ( testConfig [ $type ] == 'describe-block' ) {
992+ if ( testConfig [ $type ] === 'describe-block' ) {
992993 debug2 (
993994 `registering describe block "${ testConfig . describeBlockTitle } " and its sub-blocks`
994995 ) ;
@@ -1228,7 +1229,7 @@ function pluginTester(options: PluginTesterOptions = {}) {
12281229 // @ts -expect-error: not sure from the docs if this is a type error
12291230 microtaskMode : 'afterEvaluate'
12301231 } ) ;
1231- } else if ( testConfig [ $type ] == 'test-object' && testConfig . snapshot ) {
1232+ } else if ( testConfig [ $type ] === 'test-object' && testConfig . snapshot ) {
12321233 debug2 ( 'expecting output from babel transform function to match snapshot' ) ;
12331234
12341235 assert (
@@ -1250,7 +1251,7 @@ function pluginTester(options: PluginTesterOptions = {}) {
12501251 output ,
12511252 ErrorMessage . ExpectedOutputToEqualActual ( testConfig )
12521253 ) ;
1253- } else if ( testConfig [ $type ] == 'fixture-object' && outputFixture ) {
1254+ } else if ( testConfig [ $type ] === 'fixture-object' && outputFixture ) {
12541255 debug2 ( 'writing output from babel transform function to new output file' ) ;
12551256 fs . writeFileSync ( outputFixture , result ) ;
12561257 } else {
@@ -1313,7 +1314,7 @@ function pluginTester(options: PluginTesterOptions = {}) {
13131314 }
13141315 }
13151316
1316- if ( testConfig [ $type ] == 'test-object' && testConfig . snapshot ) {
1317+ if ( testConfig [ $type ] === 'test-object' && testConfig . snapshot ) {
13171318 if ( ! globalContextExpectFnHasToMatchSnapshot ) {
13181319 throwTypeErrorWithDebugOutput ( ErrorMessage . TestEnvironmentNoSnapshotSupport ( ) ) ;
13191320 }
@@ -1422,10 +1423,10 @@ function getAbsolutePathUsingFilepathDirname(filepath?: string, basename?: strin
14221423 const result = ! basename
14231424 ? undefined
14241425 : path . isAbsolute ( basename )
1425- ? basename
1426- : filepath
1427- ? path . join ( path . dirname ( filepath ) , basename )
1428- : undefined ;
1426+ ? basename
1427+ : filepath
1428+ ? path . join ( path . dirname ( filepath ) , basename )
1429+ : undefined ;
14291430
14301431 verbose2 ( `dirname(${ filepath } ) + ${ basename } => ${ result } ` ) ;
14311432 return result ;
@@ -1479,7 +1480,7 @@ function readCode(filepath: string | undefined, basename?: string): string | und
14791480 const { verbose : verbose2 } = getDebuggers ( 'read-code' , debug1 ) ;
14801481
14811482 const codePath =
1482- arguments . length == 1
1483+ arguments . length === 1
14831484 ? filepath
14841485 : getAbsolutePathUsingFilepathDirname ( filepath , basename ) ;
14851486
@@ -1635,10 +1636,10 @@ function numericPrefixInRanges(
16351636 numericPrefix : number | undefined ,
16361637 ranges : ( number | Range ) [ ]
16371638) {
1638- if ( typeof numericPrefix == 'number' ) {
1639+ if ( typeof numericPrefix === 'number' ) {
16391640 return ranges . some ( ( range ) => {
1640- return typeof range == 'number'
1641- ? numericPrefix == range
1641+ return typeof range === 'number'
1642+ ? numericPrefix === range
16421643 : numericPrefix >= range . start && numericPrefix <= range . end ;
16431644 } ) ;
16441645 }
0 commit comments