Skip to content

Commit

Permalink
Cancel upload as well and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ghengeveld committed Sep 20, 2023
1 parent b4b33fb commit fa3a277
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion node-src/runBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export async function runBuild(ctx: Context) {
setExitCode(ctx, exitCodes.BUILD_NO_STORIES);
throw rewriteErrorMessage(err, missingStories(ctx));
}
if (ctx.extraOptions.experimental_abortSignal?.aborted) {
if (ctx.options.experimental_abortSignal?.aborted) {
setExitCode(ctx, exitCodes.BUILD_WAS_CANCELED, true);
throw rewriteErrorMessage(err, buildCanceled());
}
Expand Down
1 change: 1 addition & 0 deletions node-src/tasks/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ describe('buildStorybook', () => {
spawnParams: { command: 'npm run build:storybook --script-args' },
env: { STORYBOOK_BUILD_TIMEOUT: 1000 },
log: { debug: jest.fn() },
options: {},
} as any;
await buildStorybook(ctx);
expect(ctx.buildLogFile).toMatch(/build-storybook\.log$/);
Expand Down
2 changes: 1 addition & 1 deletion node-src/tasks/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const buildStorybook = async (ctx: Context) => {
logFile.on('error', reject);
});

const { experimental_abortSignal: abortSignal } = ctx.extraOptions;
const { experimental_abortSignal: abortSignal } = ctx.options;

try {
const { command } = ctx.spawnParams;
Expand Down
1 change: 1 addition & 0 deletions node-src/tasks/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ export const uploadStorybook = async (ctx: Context, task: Task) => {
const percentage = Math.round((progress / total) * 100);
task.output = uploading({ percentage }).output;

ctx.options.experimental_abortSignal?.throwIfAborted();
ctx.options.experimental_onTaskProgress?.({ ...ctx }, { progress, total, unit: 'bytes' });
},
// Avoid spamming the logs with progress updates in non-interactive mode
Expand Down

0 comments on commit fa3a277

Please sign in to comment.