Skip to content

Commit 0f2ae13

Browse files
author
Vieltojarvi
committed
updated success message
1 parent 241d6e6 commit 0f2ae13

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

packages/cli/src/commands/sandbox/sandbox-seed/sandbox_seed_command.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ void describe('sandbox seed command', () => {
108108

109109
assert.ok(output !== undefined);
110110
assert.strictEqual(
111-
output.trimEnd(),
112-
'✅ seed has successfully completed'
111+
// removes line endings and any output from the spinner from output
112+
output.trimEnd().split('\n')[1].trimStart(),
113+
`${format.success('✔')} seed has successfully completed`
113114
);
114115
assert.strictEqual(mockHandleProfile.mock.callCount(), 1);
115116
});

packages/cli/src/commands/sandbox/sandbox-seed/sandbox_seed_command.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { execa } from 'execa';
55
import { SandboxBackendIdResolver } from '../sandbox_id_resolver.js';
66
import { AmplifyUserError } from '@aws-amplify/platform-core';
77
import { SandboxCommandGlobalOptions } from '../option_types.js';
8-
import { printer } from '@aws-amplify/cli-core';
8+
import { format, printer } from '@aws-amplify/cli-core';
99

1010
/**
1111
* Command that runs seed in sandbox environment
@@ -39,15 +39,21 @@ export class SandboxSeedCommand implements CommandModule<object> {
3939
printer.startSpinner('runSeedSpinner', '');
4040
const backendID = await this.backendIDResolver.resolve();
4141
const seedPath = path.join('amplify', 'seed', 'seed.ts');
42-
await execa('tsx', [seedPath], {
43-
cwd: process.cwd(),
44-
stdio: 'inherit',
45-
env: {
46-
AMPLIFY_BACKEND_IDENTIFIER: JSON.stringify(backendID),
47-
},
48-
});
42+
try {
43+
await execa('tsx', [seedPath], {
44+
cwd: process.cwd(),
45+
stdio: 'inherit',
46+
env: {
47+
AMPLIFY_BACKEND_IDENTIFIER: JSON.stringify(backendID),
48+
},
49+
});
50+
} catch (err) {
51+
printer.stopSpinner('runSeedSpinner');
52+
throw err;
53+
}
4954
printer.stopSpinner('runSeedSpinner');
50-
printer.print('✅ seed has successfully completed');
55+
printer.printNewLine();
56+
printer.print(`${format.success('✔')} seed has successfully completed`);
5157
};
5258

5359
/**

0 commit comments

Comments
 (0)