/
filter-impossible-packages-only-required.test
55 lines (50 loc) · 1.63 KB
/
filter-impossible-packages-only-required.test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
--TEST--
When filtering packages from the pool that cannot meet the fixed/locked requirements, ensure that the requirements for a package that is not required anywhere is not used to filter, as it will be ultimately be removed.
(The locked third/pkg is not required by any package so will be removed, so should not restrict the versions of fourth/pkg)
--REQUEST--
{
"require": {
"first/pkg": "*",
"second/pkg": "1.1.0"
},
"locked": [
{"name": "first/pkg", "version": "1.0.0", "require": {"second/pkg": "^1.0"}},
{"name": "second/pkg", "version": "1.0.0", "require": {"third/pkg": "1.0.0"}},
{"name": "third/pkg", "version": "1.0.0", "require": {"fourth/pkg": "1.0.0"}},
{"name": "fourth/pkg", "version": "1.0.0"}
],
"allowList": [
"first/pkg"
],
"allowTransitiveDeps": true
}
--FIXED--
[
]
--PACKAGE-REPOS--
[
[
{"name": "first/pkg", "version": "1.0.0", "require": {"second/pkg": "*"}},
{"name": "second/pkg", "version": "1.0.0", "require": {"third/pkg": "1.0.0"}},
{"name": "second/pkg", "version": "1.1.0", "require": {"fourth/pkg": "2.0.0"}},
{"name": "third/pkg", "version": "1.0.0", "require": {"fourth/pkg": "1.0.0"}},
{"name": "fourth/pkg", "version": "1.0.0"},
{"name": "fourth/pkg", "version": "2.0.0"}
]
]
--EXPECT--
[
"third/pkg-1.0.0.0 (locked)",
"first/pkg-1.0.0.0",
"second/pkg-1.1.0.0",
"fourth/pkg-1.0.0.0",
"fourth/pkg-2.0.0.0"
]
--EXPECT-OPTIMIZED--
[
"third/pkg-1.0.0.0 (locked)",
"first/pkg-1.0.0.0",
"second/pkg-1.1.0.0",
"fourth/pkg-1.0.0.0",
"fourth/pkg-2.0.0.0"
]