@@ -32,6 +32,34 @@ export = {
32
32
test . done ( ) ;
33
33
} ,
34
34
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
+
35
63
'version reporting finds no version with no associated package.json' ( test : Test ) {
36
64
const pkgdir = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , 'runtime-info-find-npm-package-fixture' ) ) ;
37
65
const mockVersion = '1.2.3' ;
0 commit comments