@@ -32,6 +32,34 @@ export = {
3232 test . done ( ) ;
3333 } ,
3434
35+ 'version reporting finds aws-rfdk package' ( test : Test ) {
36+ const pkgdir = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , 'runtime-info-rfdk' ) ) ;
37+ const mockVersion = '1.2.3' ;
38+
39+ fs . writeFileSync ( path . join ( pkgdir , 'index.js' ) , 'module.exports = \'this is foo\';' ) ;
40+ fs . writeFileSync ( path . join ( pkgdir , 'package.json' ) , JSON . stringify ( {
41+ name : 'aws-rfdk' ,
42+ version : mockVersion ,
43+ } ) ) ;
44+
45+ // eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies
46+ require ( pkgdir ) ;
47+
48+ const runtimeInfo = collectRuntimeInformation ( ) ;
49+
50+ // eslint-disable-next-line @typescript-eslint/no-require-imports
51+ const version = require ( '../package.json' ) . version ;
52+ test . deepEqual ( runtimeInfo . libraries , {
53+ '@aws-cdk/core' : version ,
54+ '@aws-cdk/cx-api' : version ,
55+ '@aws-cdk/cloud-assembly-schema' : version ,
56+ '@aws-solutions-konstruk/foo' : mockVersion , // picks up the module from the other test.
57+ 'aws-rfdk' : mockVersion ,
58+ 'jsii-runtime' : `node.js/${ process . version } ` ,
59+ } ) ;
60+ test . done ( ) ;
61+ } ,
62+
3563 'version reporting finds no version with no associated package.json' ( test : Test ) {
3664 const pkgdir = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , 'runtime-info-find-npm-package-fixture' ) ) ;
3765 const mockVersion = '1.2.3' ;
0 commit comments