generated from storybookjs/addon-kit
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace
estree-util-to-js
with esrap
- Loading branch information
Showing
14 changed files
with
202 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
10 changes: 5 additions & 5 deletions
10
src/compiler/transform/appendix/create-export-default.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 11 additions & 6 deletions
17
src/compiler/transform/appendix/create-export-order.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,28 @@ | ||
import type { Program } from 'estree'; | ||
import { toJs } from 'estree-util-to-js'; | ||
import { print } from 'esrap'; | ||
import { describe, it } from 'vitest'; | ||
|
||
import { createExportOrderVariable } from './create-export-order'; | ||
|
||
describe(createExportOrderVariable.name, () => { | ||
it('correctly creates a variable with named exports order', ({ expect }) => { | ||
const stringified = toJs( | ||
const stringified = print( | ||
createExportOrderVariable({ | ||
storyIdentifiers: [ | ||
{ exportName: 'Default', name: 'Default' }, | ||
{ exportName: 'SomeComponent', name: 'Some Component' }, | ||
{ exportName: 'ThisNameIsWeird', name: 'This-Name-Is-Weird' }, | ||
], | ||
}) as unknown as Program | ||
).value; | ||
}) | ||
).code; | ||
|
||
expect(stringified).toMatchInlineSnapshot( | ||
`"export const __namedExportsOrder = ["Default", "SomeComponent", "ThisNameIsWeird"];"` | ||
` | ||
"export const __namedExportsOrder = [ | ||
"Default", | ||
"SomeComponent", | ||
"ThisNameIsWeird" | ||
];" | ||
` | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
import type { Program } from 'estree'; | ||
import { toJs } from 'estree-util-to-js'; | ||
import { print } from 'esrap'; | ||
import { describe, it } from 'vitest'; | ||
|
||
import { createRuntimeStoriesImport } from './create-import'; | ||
|
||
describe(createRuntimeStoriesImport.name, () => { | ||
it('creates import correctly', ({ expect }) => { | ||
const stringified = toJs(createRuntimeStoriesImport() as unknown as Program).value; | ||
const stringified = print(createRuntimeStoriesImport()).code; | ||
|
||
expect(stringified).toMatchInlineSnapshot( | ||
`"import {createRuntimeStories} from \"@storybook/addon-svelte-csf/internal/create-runtime-stories\";"` | ||
`"import { createRuntimeStories } from "@storybook/addon-svelte-csf/internal/create-runtime-stories";"` | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.