Skip to content

Commit 5447672

Browse files
committed
await async expectations
1 parent 7b91893 commit 5447672

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/compiler/post-transform/remove-export-default.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe(removeExportDefault.name, () => {
2929
nodes: compiledASTNodes,
3030
});
3131

32-
expect(
32+
await expect(
3333
extractCompiledASTNodes({
3434
ast: parseAst(code.toString()),
3535
})

src/compiler/pre-transform/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ describe(codemodLegacyNodes.name, () => {
239239
<Story name="NextOne" />
240240
`;
241241
const ast = getSvelteAST({ code });
242-
expect(codemodLegacyNodes({ ast })).rejects.toThrowErrorMatchingInlineSnapshot(`
242+
await expect(codemodLegacyNodes({ ast })).rejects.toThrowErrorMatchingInlineSnapshot(`
243243
[SB_SVELTE_CSF_LEGACY_API_0003 (DuplicatedUnidentifiedTemplateError): Stories file: undefined
244244
has two '<Template />' components without provided prop 'id'. This leads to unwanted runtime behavior.
245245

src/parser/extract/svelte/module-nodes.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import { getSvelteAST } from '$lib/parser/ast.js';
66
import { StorybookSvelteCSFError } from '$lib/utils/error.js';
77

88
describe(extractModuleNodes.name, () => {
9-
it('fails when module tag not found', ({ expect }) => {
9+
it('fails when module tag not found', async ({ expect }) => {
1010
const { module } = getSvelteAST({
1111
code: `<script></script>`,
1212
});
1313

14-
expect(extractModuleNodes({ module })).rejects.toThrowErrorMatchingInlineSnapshot(`
14+
await expect(extractModuleNodes({ module })).rejects.toThrowErrorMatchingInlineSnapshot(`
1515
[SB_SVELTE_CSF_PARSER_EXTRACT_SVELTE_0001 (MissingModuleTagError): The file '<path not specified>'
1616
does not have a module context (<script module> ... </script>).
1717
@@ -28,12 +28,12 @@ describe(extractModuleNodes.name, () => {
2828
`);
2929
});
3030

31-
it("fails when 'defineMeta' not imported", ({ expect }) => {
31+
it("fails when 'defineMeta' not imported", async ({ expect }) => {
3232
const { module } = getSvelteAST({
3333
code: `<script module></script>`,
3434
});
3535

36-
expect(extractModuleNodes({ module })).rejects.toThrowErrorMatchingInlineSnapshot(`
36+
await expect(extractModuleNodes({ module })).rejects.toThrowErrorMatchingInlineSnapshot(`
3737
[SB_SVELTE_CSF_PARSER_EXTRACT_SVELTE_0003 (MissingDefineMetaImportError): The file '<path not specified>'
3838
does not import defineMeta from "@storybook/addon-svelte-csf" inside the module context.
3939
@@ -50,7 +50,7 @@ describe(extractModuleNodes.name, () => {
5050
`);
5151
});
5252

53-
it("fails when 'defineMeta' not used", ({ expect }) => {
53+
it("fails when 'defineMeta' not used", async ({ expect }) => {
5454
const { module } = getSvelteAST({
5555
code: `
5656
<script module>
@@ -59,7 +59,7 @@ describe(extractModuleNodes.name, () => {
5959
`,
6060
});
6161

62-
expect(extractModuleNodes({ module })).rejects.toThrowErrorMatchingInlineSnapshot(`
62+
await expect(extractModuleNodes({ module })).rejects.toThrowErrorMatchingInlineSnapshot(`
6363
[SB_SVELTE_CSF_PARSER_EXTRACT_SVELTE_0004 (MissingDefineMetaVariableDeclarationError): The file '<path not specified>'
6464
does not store the result of calling defineMeta(). While defineMeta() might have been called,
6565
it's return value needs to be stored and destructured for the parsing to succeed, eg.:
@@ -75,7 +75,7 @@ describe(extractModuleNodes.name, () => {
7575
`);
7676
});
7777

78-
it("fails when 'Story' is not destructured", ({ expect }) => {
78+
it("fails when 'Story' is not destructured", async ({ expect }) => {
7979
const { module } = getSvelteAST({
8080
code: `
8181
<script module>
@@ -84,7 +84,7 @@ describe(extractModuleNodes.name, () => {
8484
</script>`,
8585
});
8686

87-
expect(extractModuleNodes({ module })).rejects.toThrowErrorMatchingInlineSnapshot(`
87+
await expect(extractModuleNodes({ module })).rejects.toThrowErrorMatchingInlineSnapshot(`
8888
[SB_SVELTE_CSF_PARSER_EXTRACT_SVELTE_0004 (MissingDefineMetaVariableDeclarationError): The file '<path not specified>'
8989
does not store the result of calling defineMeta(). While defineMeta() might have been called,
9090
it's return value needs to be stored and destructured for the parsing to succeed, eg.:
@@ -100,7 +100,7 @@ describe(extractModuleNodes.name, () => {
100100
`);
101101
});
102102

103-
it('works when it has valid required entry snippet', ({ expect }) => {
103+
it('works when it has valid required entry snippet', async ({ expect }) => {
104104
const { module } = getSvelteAST({
105105
code: `
106106
<script module>
@@ -109,10 +109,10 @@ describe(extractModuleNodes.name, () => {
109109
</script>`,
110110
});
111111

112-
expect(extractModuleNodes({ module })).resolves.not.toThrow();
112+
await expect(extractModuleNodes({ module })).resolves.not.toThrow();
113113
});
114114

115-
it('works when meta was destructured too', ({ expect }) => {
115+
it('works when meta was destructured too', async ({ expect }) => {
116116
const { module } = getSvelteAST({
117117
code: `
118118
<script module>
@@ -122,7 +122,7 @@ describe(extractModuleNodes.name, () => {
122122
`,
123123
});
124124

125-
expect(extractModuleNodes({ module })).resolves.not.toThrow();
125+
await expect(extractModuleNodes({ module })).resolves.not.toThrow();
126126
});
127127

128128
it('extracts module nodes', async ({ expect }) => {

0 commit comments

Comments
 (0)