Skip to content

Cannot import from context="module" #87

Open
@jacobbogers

Description

@jacobbogers

Hello
I export component specific information from svelte components, but I can not import them in any svelte test using svelte-jester

I am using typescript

<script lang="ts" context="module">
	export const prerender = false;
	export const ARROW_STATE = {
		NONE: 1,
		SHOW: 2,
		DOWN: 4
	};
</script>

// other code from the component

I need to import ARROW_STATE from this component for testing

import Arrow, { ARROW_STATE } from '../Arrow.svelte';
import { render, fireEvent } from '@testing-library/svelte'

// rest of the code 

Error log

   src/lib/components/__test__/Arrow.test.ts:1:17 - error TS2614: Module '"*.svelte"' has no exported member 'ARROW_STATE'. Did you mean to use 'import ARROW_STATE from "*.svelte"' instead?

    1 import Arrow, { ARROW_STATE } from '../Arrow.svelte';

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions