fix(storybook): emit a value from storybook executor so that e2e tests work (#4845)
This commit is contained in:
parent
0fc729c5ad
commit
35049dcdef
@ -44,11 +44,10 @@ describe('@nrwl/storybook:storybook', () => {
|
||||
};
|
||||
});
|
||||
|
||||
it('should provide options to storybook', (done) => {
|
||||
storybookExecutor(options, context);
|
||||
setTimeout(() => {
|
||||
expect(buildDevStandalone).toHaveBeenCalled();
|
||||
done();
|
||||
}, 0);
|
||||
it('should provide options to storybook', async () => {
|
||||
const iterator = storybookExecutor(options, context);
|
||||
const { value } = await iterator.next();
|
||||
expect(value).toEqual({ success: true });
|
||||
expect(buildDevStandalone).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@ -33,7 +33,7 @@ try {
|
||||
require('dotenv').config();
|
||||
} catch (e) {}
|
||||
|
||||
export default async function storybookExecutor(
|
||||
export default async function* storybookExecutor(
|
||||
options: StorybookExecutorOptions,
|
||||
context: ExecutorContext
|
||||
) {
|
||||
@ -43,8 +43,10 @@ export default async function storybookExecutor(
|
||||
const option = storybookOptionMapper(options, frameworkOptions, context);
|
||||
await runInstance(option);
|
||||
|
||||
yield { success: true };
|
||||
|
||||
// This Promise intentionally never resolves, leaving the process running
|
||||
return new Promise<{ success: boolean }>(() => {});
|
||||
await new Promise<{ success: boolean }>(() => {});
|
||||
}
|
||||
|
||||
function runInstance(options: StorybookExecutorOptions) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user