Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Renovate Bot
renovate
Commits
7e069f4a
Unverified
Commit
7e069f4a
authored
3 years ago
by
Rhys Arkins
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(config): massage package.json>renovate string (#12150)
parent
e3ae7b68
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/workers/repository/init/merge.spec.ts
+19
-0
19 additions, 0 deletions
lib/workers/repository/init/merge.spec.ts
lib/workers/repository/init/merge.ts
+4
-0
4 additions, 0 deletions
lib/workers/repository/init/merge.ts
with
23 additions
and
0 deletions
lib/workers/repository/init/merge.spec.ts
+
19
−
0
View file @
7e069f4a
...
...
@@ -58,6 +58,25 @@ describe('workers/repository/init/merge', () => {
expect
(
await
detectRepoFileConfig
()).
toMatchSnapshot
();
expect
(
await
detectRepoFileConfig
()).
toMatchSnapshot
();
});
it
(
'
massages package.json renovate string
'
,
async
()
=>
{
git
.
getFileList
.
mockResolvedValue
([
'
package.json
'
]);
const
pJson
=
JSON
.
stringify
({
name
:
'
something
'
,
renovate
:
'
github>renovatebot/renovate
'
,
});
fs
.
readLocalFile
.
mockResolvedValue
(
pJson
);
platform
.
getJsonFile
.
mockResolvedValueOnce
(
pJson
);
expect
(
await
detectRepoFileConfig
()).
toMatchInlineSnapshot
(
`
Object {
"configFileName": "package.json",
"configFileParsed": Object {
"extends": Array [
"github>renovatebot/renovate",
],
},
}
`
);
});
it
(
'
returns error if cannot parse
'
,
async
()
=>
{
git
.
getFileList
.
mockResolvedValue
([
'
package.json
'
,
'
renovate.json
'
]);
fs
.
readLocalFile
.
mockResolvedValue
(
'
cannot parse
'
);
...
...
This diff is collapsed.
Click to expand it.
lib/workers/repository/init/merge.ts
+
4
−
0
View file @
7e069f4a
...
...
@@ -68,6 +68,10 @@ export async function detectRepoFileConfig(): Promise<RepoFileConfig> {
configFileParsed
=
JSON
.
parse
(
await
readLocalFile
(
'
package.json
'
,
'
utf8
'
)
).
renovate
;
if
(
is
.
string
(
configFileParsed
))
{
logger
.
debug
(
'
Massaging string renovate config to extends array
'
);
configFileParsed
=
{
extends
:
[
configFileParsed
]
};
}
logger
.
debug
({
config
:
configFileParsed
},
'
package.json>renovate config
'
);
}
else
{
let
rawFileContents
=
await
readLocalFile
(
configFileName
,
'
utf8
'
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment