Skip to content

Commit

Permalink
resolve path for config
Browse files Browse the repository at this point in the history
  • Loading branch information
samchungy committed Aug 15, 2023
1 parent 2303815 commit 029267e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/cli/configure/patchRenovateConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,27 @@ it('patches a JSON config for a SEEK-Jobs project', async () => {
`);
});

it('patches a JSON config for a new SEEK-Jobs project', async () => {
getOwnerAndRepo.mockResolvedValue({ owner: 'SEEK-Jobs', repo: 'VersionNet' });

vol.fromJSON({ 'foo/.git': null, 'foo/renovate.json': JSON });

await expect(tryPatchRenovateConfig('foo')).resolves.toBeUndefined();

expect(volToJson()).toMatchInlineSnapshot(`
{
"foo/.git": null,
"foo/renovate.json": "{
"extends": [
"local>seek-jobs/renovate-config",
"github>seek-oss/rynovate:third-party-major"
]
}
",
}
`);
});

it('patches a JSON5 config for a seekasia project', async () => {
getOwnerAndRepo.mockResolvedValue({
owner: 'sEEkAsIa',
Expand Down
3 changes: 2 additions & 1 deletion src/cli/configure/patchRenovateConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable new-cap */

import path from 'path';
import { inspect } from 'util';

import fs from 'fs-extra';
Expand Down Expand Up @@ -131,7 +132,7 @@ const patchRenovateConfig = async (dir: string) => {
const patchFile = patchByFiletype[filetype];

await patchFile({
filepath: config.filepath,
filepath: path.resolve(dir, config.filepath),
input: config.input,
presetToAdd,
});
Expand Down

0 comments on commit 029267e

Please sign in to comment.