Skip to content

Commit 3784745

Browse files
authored
chore: include available profiles in 'Missing build profile' error (#3141)
* chore: include available profiles in 'Missing build profile' error * address review
1 parent 72be7e8 commit 3784745

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

packages/eas-json/src/__tests__/buildProfiles-test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,9 @@ test('valid eas.json with missing profile', async () => {
610610

611611
const accessor = EasJsonAccessor.fromProjectPath('/project');
612612
const promise = EasJsonUtils.getBuildProfileAsync(accessor, Platform.ANDROID, 'debug');
613-
await expect(promise).rejects.toThrowError('Missing build profile in eas.json: debug');
613+
await expect(promise).rejects.toThrowError(
614+
'Missing build profile in eas.json: "debug". Available profiles: ["production"]'
615+
);
614616
});
615617

616618
test('invalid eas.json when using wrong buildType', async () => {
@@ -633,7 +635,9 @@ test('empty json', async () => {
633635

634636
const accessor = EasJsonAccessor.fromProjectPath('/project');
635637
const promise = EasJsonUtils.getBuildProfileAsync(accessor, Platform.ANDROID, 'production');
636-
await expect(promise).rejects.toThrowError('Missing build profile in eas.json: production');
638+
await expect(promise).rejects.toThrowError(
639+
'Missing build profile in eas.json: "production". Available profiles: []'
640+
);
637641
});
638642

639643
test('invalid semver value', async () => {

packages/eas-json/src/build/resolver.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,16 @@ function resolveProfile({
4646
const profile = easJson.build?.[profileName];
4747
if (!profile) {
4848
if (depth === 0) {
49-
throw new MissingProfileError(`Missing build profile in eas.json: ${profileName}`);
49+
throw new MissingProfileError(
50+
`Missing build profile in eas.json: "${profileName}". Available profiles: [${Object.keys(
51+
easJson.build ?? {}
52+
)
53+
.map(profile => `"${profile}"`)
54+
.join(', ')}]`
55+
);
5056
} else {
5157
throw new MissingParentProfileError(
52-
`Extending non-existent build profile in eas.json: ${profileName}`
58+
`Extending non-existent build profile in eas.json: "${profileName}"`
5359
);
5460
}
5561
}

yarn.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)