import packageJSON from '../package.json' ; interface Dependencies { [ key ] : string ; } const dependencies = Object . entries ( { ... ( packageJSON . dependencies as Dependencies ) , ... ( packageJSON . devDependencies as Dependencies ) } ) ; const nonExactPrefixes = /^(~|\^|>|>=|<|<=)/ ; describe ( 'package.json' , ( ) => { it . each ( dependencies ) ( '%s should have an exact version' , ( _ , depVersion ) => { expect ( depVersion ) . not . toMatch ( nonExactPrefixes ) ; } ) ; } ) ;