@@ -37,43 +37,46 @@ describe('versions export', () => {
3737 } ) ;
3838
3939 describe ( 'bundledVersions consistency' , ( ) => {
40- it ( 'should contain all core bundledVersions' , ( ) => {
40+ it ( 'should contain all core bundledVersions' , async ( ) => {
4141 const corePkg = JSON . parse ( fs . readFileSync ( corePkgPath , 'utf-8' ) ) ;
42- const content = fs . readFileSync ( path . join ( distDir , 'versions.js' ) , 'utf-8' ) ;
42+ const mod = await import ( '../../dist/versions.js' ) ;
43+ const versions = mod . versions as Record < string , string > ;
4344 for ( const [ key , value ] of Object . entries (
4445 corePkg . bundledVersions as Record < string , string > ,
4546 ) ) {
46- expect ( content ) . toContain ( `${ key } :` ) ;
47- expect ( content ) . toContain ( `'${ value } '` ) ;
47+ expect ( versions [ key ] , `versions.${ key } should match core bundledVersions` ) . toBe ( value ) ;
4848 }
4949 } ) ;
5050
51- it ( 'should contain all test bundledVersions' , ( ) => {
51+ it ( 'should contain all test bundledVersions' , async ( ) => {
5252 const testPkg = JSON . parse ( fs . readFileSync ( testPkgPath , 'utf-8' ) ) ;
53- const content = fs . readFileSync ( path . join ( distDir , 'versions.js' ) , 'utf-8' ) ;
53+ const mod = await import ( '../../dist/versions.js' ) ;
54+ const versions = mod . versions as Record < string , string > ;
5455 for ( const [ key , value ] of Object . entries (
5556 testPkg . bundledVersions as Record < string , string > ,
5657 ) ) {
57- expect ( content ) . toContain ( `${ key } :` ) ;
58- expect ( content ) . toContain ( `'${ value } '` ) ;
58+ expect ( versions [ key ] , `versions.${ key } should match test bundledVersions` ) . toBe ( value ) ;
5959 }
6060 } ) ;
6161 } ) ;
6262
6363 describe ( 'dependency tool versions' , ( ) => {
64- it ( 'should contain oxlint version' , ( ) => {
65- const content = fs . readFileSync ( path . join ( distDir , 'versions.js' ) , 'utf-8' ) ;
66- expect ( content ) . toContain ( 'oxlint:' ) ;
64+ it ( 'should contain oxlint version' , async ( ) => {
65+ const mod = await import ( '../../dist/versions.js' ) ;
66+ const versions = mod . versions as Record < string , string > ;
67+ expect ( versions . oxlint ) . toBeTypeOf ( 'string' ) ;
6768 } ) ;
6869
69- it ( 'should contain oxfmt version' , ( ) => {
70- const content = fs . readFileSync ( path . join ( distDir , 'versions.js' ) , 'utf-8' ) ;
71- expect ( content ) . toContain ( 'oxfmt:' ) ;
70+ it ( 'should contain oxfmt version' , async ( ) => {
71+ const mod = await import ( '../../dist/versions.js' ) ;
72+ const versions = mod . versions as Record < string , string > ;
73+ expect ( versions . oxfmt ) . toBeTypeOf ( 'string' ) ;
7274 } ) ;
7375
74- it ( 'should contain oxlint-tsgolint version' , ( ) => {
75- const content = fs . readFileSync ( path . join ( distDir , 'versions.js' ) , 'utf-8' ) ;
76- expect ( content ) . toContain ( 'oxlint-tsgolint' ) ;
76+ it ( 'should contain oxlint-tsgolint version' , async ( ) => {
77+ const mod = await import ( '../../dist/versions.js' ) ;
78+ const versions = mod . versions as Record < string , string > ;
79+ expect ( versions [ 'oxlint-tsgolint' ] ) . toBeTypeOf ( 'string' ) ;
7780 } ) ;
7881 } ) ;
7982
0 commit comments