@@ -129,6 +129,39 @@ suite('testing the javascript-npm data provider', async () => {
129129 let providedDataForComponent = provider . provideComponent ( manifestPath ) ;
130130
131131 compareSboms ( providedDataForComponent . content , expectedSbom ) ;
132+ } ) . timeout ( 15000 ) ;
133+
134+ [
135+ { providerName : 'npm' , testCase : 'workspace_member' } ,
136+ ] . forEach ( ( { providerName, testCase } ) => {
137+ /// Verifies that stack analysis resolves transitive dependencies for a workspace member.
138+ test ( `verify workspace member data provided for ${ providerName } - stack analysis` , async ( ) => {
139+ // Given a workspace member manifest and mock listing from the workspace root
140+ const listing = fs . readFileSync ( `test/providers/tst_manifests/${ providerName } /${ testCase } /listing_stack.json` ) . toString ( ) ;
141+ const expectedSbom = fs . readFileSync ( `test/providers/tst_manifests/${ providerName } /${ testCase } /stack_expected_sbom.json` ) . toString ( ) ;
142+ const provider = await createMockProvider ( providerName , listing ) ;
143+ const manifestPath = `test/providers/tst_manifests/${ providerName } /${ testCase } /packages/member-a/package.json` ;
144+
145+ // When running stack analysis on the workspace member
146+ const result = provider . provideStack ( manifestPath ) ;
147+
148+ // Then the SBOM should contain the member's transitive dependencies
149+ compareSboms ( result . content , expectedSbom ) ;
150+ } ) . timeout ( 30000 ) ;
151+
152+ /// Verifies that component analysis resolves direct dependencies for a workspace member.
153+ test ( `verify workspace member data provided for ${ providerName } - component analysis` , async ( ) => {
154+ // Given a workspace member manifest and mock listing from the workspace root
155+ const listing = fs . readFileSync ( `test/providers/tst_manifests/${ providerName } /${ testCase } /listing_component.json` ) . toString ( ) ;
156+ const expectedSbom = fs . readFileSync ( `test/providers/tst_manifests/${ providerName } /${ testCase } /component_expected_sbom.json` ) . toString ( ) ;
157+ const provider = await createMockProvider ( providerName , listing ) ;
158+ const manifestPath = `test/providers/tst_manifests/${ providerName } /${ testCase } /packages/member-a/package.json` ;
159+
160+ // When running component analysis on the workspace member
161+ const result = provider . provideComponent ( manifestPath ) ;
162+
163+ // Then the SBOM should contain only the member's direct dependencies
164+ compareSboms ( result . content , expectedSbom ) ;
132165 } ) . timeout ( 15000 ) ;
133166 } ) ;
134167
0 commit comments