mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
fix(pip): reset regex before each search
This commit is contained in:
parent
05260a5b16
commit
775b2979eb
4 changed files with 9 additions and 1 deletions
|
@ -18,6 +18,7 @@ function extractDependencies(content) {
|
|||
const deps = content
|
||||
.split('\n')
|
||||
.map((line, lineNumber) => {
|
||||
regex.lastIndex = 0;
|
||||
const matches = regex.exec(line);
|
||||
return (
|
||||
matches && {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
--index-url http://example.com/private-pypi/
|
||||
# simple comment
|
||||
some-package==0.3.1
|
||||
some-other-package==1.0.0
|
||||
not_semver==1.9
|
||||
|
||||
|
|
|
@ -8,5 +8,11 @@ Array [
|
|||
"lineNumber": 2,
|
||||
"versionScheme": "pep440",
|
||||
},
|
||||
Object {
|
||||
"currentValue": "1.0.0",
|
||||
"depName": "some-other-package",
|
||||
"lineNumber": 3,
|
||||
"versionScheme": "pep440",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
|
|
@ -20,7 +20,7 @@ describe('lib/manager/pip_requirements/extract', () => {
|
|||
it('extracts dependencies', () => {
|
||||
const res = extractDependencies(requirements, config).deps;
|
||||
expect(res).toMatchSnapshot();
|
||||
expect(res).toHaveLength(1);
|
||||
expect(res).toHaveLength(2);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue