mirror of
https://git.yoctoproject.org/poky
synced 2026-04-04 23:02:22 +02:00
bitbake: tests: fetch: add npmsw test case for bundled dependencies
The npm package lock and shrinkwrap file list bundled dependencies which are supplied together with the parent dependency. The bundled dependencies are marked by a flag. The flag and thereby test depends on the lock file version. The old lock file version uses a `bundled` flag and stores dependencies in the `dependencies` list. The new lock file version uses an `inBundle` flag and stores dependencies in the `packages` list. (Bitbake rev: 34fd8ea6abe755e04220fe70b082aa620ae15f86) Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
02f8ea6865
commit
f1745ce249
@@ -3112,6 +3112,32 @@ class NPMTest(FetcherTest):
|
||||
fetcher.download()
|
||||
self.assertTrue(os.path.exists(ud.localpath))
|
||||
|
||||
@skipIfNoNetwork()
|
||||
def test_npmsw_bundled(self):
|
||||
for packages_key, package_prefix, bundled_key in [
|
||||
('dependencies', '', 'bundled'),
|
||||
('packages', 'node_modules/', 'inBundle')
|
||||
]:
|
||||
swfile = self.create_shrinkwrap_file({
|
||||
packages_key: {
|
||||
package_prefix + 'array-flatten': {
|
||||
'version': '1.1.1',
|
||||
'resolved': 'https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz',
|
||||
'integrity': 'sha1-ml9pkFGx5wczKPKgCJaLZOopVdI='
|
||||
},
|
||||
package_prefix + 'content-type': {
|
||||
'version': '1.0.4',
|
||||
'resolved': 'https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz',
|
||||
'integrity': 'sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==',
|
||||
bundled_key: True
|
||||
}
|
||||
}
|
||||
})
|
||||
fetcher = bb.fetch.Fetch(['npmsw://' + swfile], self.d)
|
||||
fetcher.download()
|
||||
self.assertTrue(os.path.exists(os.path.join(self.dldir, 'npm2', 'array-flatten-1.1.1.tgz')))
|
||||
self.assertFalse(os.path.exists(os.path.join(self.dldir, 'npm2', 'content-type-1.0.4.tgz')))
|
||||
|
||||
class GitSharedTest(FetcherTest):
|
||||
def setUp(self):
|
||||
super(GitSharedTest, self).setUp()
|
||||
|
||||
Reference in New Issue
Block a user