@@ -6,12 +6,12 @@ import { getSvelteAST } from '$lib/parser/ast.js';
6
6
import { StorybookSvelteCSFError } from '$lib/utils/error.js' ;
7
7
8
8
describe ( extractModuleNodes . name , ( ) => {
9
- it ( 'fails when module tag not found' , ( { expect } ) => {
9
+ it ( 'fails when module tag not found' , async ( { expect } ) => {
10
10
const { module } = getSvelteAST ( {
11
11
code : `<script></script>` ,
12
12
} ) ;
13
13
14
- expect ( extractModuleNodes ( { module } ) ) . rejects . toThrowErrorMatchingInlineSnapshot ( `
14
+ await expect ( extractModuleNodes ( { module } ) ) . rejects . toThrowErrorMatchingInlineSnapshot ( `
15
15
[SB_SVELTE_CSF_PARSER_EXTRACT_SVELTE_0001 (MissingModuleTagError): The file '<path not specified>'
16
16
does not have a module context (<script module> ... </script>).
17
17
@@ -28,12 +28,12 @@ describe(extractModuleNodes.name, () => {
28
28
` ) ;
29
29
} ) ;
30
30
31
- it ( "fails when 'defineMeta' not imported" , ( { expect } ) => {
31
+ it ( "fails when 'defineMeta' not imported" , async ( { expect } ) => {
32
32
const { module } = getSvelteAST ( {
33
33
code : `<script module></script>` ,
34
34
} ) ;
35
35
36
- expect ( extractModuleNodes ( { module } ) ) . rejects . toThrowErrorMatchingInlineSnapshot ( `
36
+ await expect ( extractModuleNodes ( { module } ) ) . rejects . toThrowErrorMatchingInlineSnapshot ( `
37
37
[SB_SVELTE_CSF_PARSER_EXTRACT_SVELTE_0003 (MissingDefineMetaImportError): The file '<path not specified>'
38
38
does not import defineMeta from "@storybook/addon-svelte-csf" inside the module context.
39
39
@@ -50,7 +50,7 @@ describe(extractModuleNodes.name, () => {
50
50
` ) ;
51
51
} ) ;
52
52
53
- it ( "fails when 'defineMeta' not used" , ( { expect } ) => {
53
+ it ( "fails when 'defineMeta' not used" , async ( { expect } ) => {
54
54
const { module } = getSvelteAST ( {
55
55
code : `
56
56
<script module>
@@ -59,7 +59,7 @@ describe(extractModuleNodes.name, () => {
59
59
` ,
60
60
} ) ;
61
61
62
- expect ( extractModuleNodes ( { module } ) ) . rejects . toThrowErrorMatchingInlineSnapshot ( `
62
+ await expect ( extractModuleNodes ( { module } ) ) . rejects . toThrowErrorMatchingInlineSnapshot ( `
63
63
[SB_SVELTE_CSF_PARSER_EXTRACT_SVELTE_0004 (MissingDefineMetaVariableDeclarationError): The file '<path not specified>'
64
64
does not store the result of calling defineMeta(). While defineMeta() might have been called,
65
65
it's return value needs to be stored and destructured for the parsing to succeed, eg.:
@@ -75,7 +75,7 @@ describe(extractModuleNodes.name, () => {
75
75
` ) ;
76
76
} ) ;
77
77
78
- it ( "fails when 'Story' is not destructured" , ( { expect } ) => {
78
+ it ( "fails when 'Story' is not destructured" , async ( { expect } ) => {
79
79
const { module } = getSvelteAST ( {
80
80
code : `
81
81
<script module>
@@ -84,7 +84,7 @@ describe(extractModuleNodes.name, () => {
84
84
</script>` ,
85
85
} ) ;
86
86
87
- expect ( extractModuleNodes ( { module } ) ) . rejects . toThrowErrorMatchingInlineSnapshot ( `
87
+ await expect ( extractModuleNodes ( { module } ) ) . rejects . toThrowErrorMatchingInlineSnapshot ( `
88
88
[SB_SVELTE_CSF_PARSER_EXTRACT_SVELTE_0004 (MissingDefineMetaVariableDeclarationError): The file '<path not specified>'
89
89
does not store the result of calling defineMeta(). While defineMeta() might have been called,
90
90
it's return value needs to be stored and destructured for the parsing to succeed, eg.:
@@ -100,7 +100,7 @@ describe(extractModuleNodes.name, () => {
100
100
` ) ;
101
101
} ) ;
102
102
103
- it ( 'works when it has valid required entry snippet' , ( { expect } ) => {
103
+ it ( 'works when it has valid required entry snippet' , async ( { expect } ) => {
104
104
const { module } = getSvelteAST ( {
105
105
code : `
106
106
<script module>
@@ -109,10 +109,10 @@ describe(extractModuleNodes.name, () => {
109
109
</script>` ,
110
110
} ) ;
111
111
112
- expect ( extractModuleNodes ( { module } ) ) . resolves . not . toThrow ( ) ;
112
+ await expect ( extractModuleNodes ( { module } ) ) . resolves . not . toThrow ( ) ;
113
113
} ) ;
114
114
115
- it ( 'works when meta was destructured too' , ( { expect } ) => {
115
+ it ( 'works when meta was destructured too' , async ( { expect } ) => {
116
116
const { module } = getSvelteAST ( {
117
117
code : `
118
118
<script module>
@@ -122,7 +122,7 @@ describe(extractModuleNodes.name, () => {
122
122
` ,
123
123
} ) ;
124
124
125
- expect ( extractModuleNodes ( { module } ) ) . resolves . not . toThrow ( ) ;
125
+ await expect ( extractModuleNodes ( { module } ) ) . resolves . not . toThrow ( ) ;
126
126
} ) ;
127
127
128
128
it ( 'extracts module nodes' , async ( { expect } ) => {
0 commit comments