Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion plugins/plugin-tools/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@ const junoConfigSatelliteId = async ({mode}: ConfigArgs): Promise<string> => {
const satelliteId = ids?.[mode] ?? id ?? deprecatedSatelliteId;

if (satelliteId === undefined) {
if (mode === MODE_DEVELOPMENT) {
throw new JunoPluginError(
`Your configuration is invalid. A Satellite ID for ${mode} must be provided.`
);
}

throw new JunoPluginError(
`Your configuration is invalid. A satellite ID for ${mode} must be set in your configuration file.`
`Your project needs a Satellite for ${mode}. Create one at https://console.juno.build and set its ID in your configuration file.`
);
}

Expand Down
25 changes: 22 additions & 3 deletions plugins/plugin-tools/src/init.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,35 @@ describe('init', () => {
},
mode: MODE_DEVELOPMENT
})
).rejects.toThrow(/A satellite ID for development must be set/);
).rejects.toThrow(
'Your configuration is invalid. A Satellite ID for development must be provided.'
);
});

it('throws if satelliteId is missing in config in development', async () => {
vi.spyOn(configLoader, 'readJunoConfig').mockResolvedValueOnce({
satellite: {}
} as unknown as JunoConfig);

await expect(
initConfig({
params: {
container: false
},
mode: MODE_DEVELOPMENT
})
).rejects.toThrow(
'Your configuration is invalid. A Satellite ID for development must be provided.'
);
});

it('throws if satelliteId is missing in config', async () => {
it('throws if satelliteId is missing in config in production', async () => {
vi.spyOn(configLoader, 'readJunoConfig').mockResolvedValueOnce({
satellite: {}
} as unknown as JunoConfig);

await expect(initConfig(args)).rejects.toThrow(
/Your configuration is invalid. A satellite ID for production must be set in your configuration file./
'Your project needs a Satellite for production. Create one at https://console.juno.build and set its ID in your configuration file.'
);
});
});