Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] TypeError: SvelteRangeSliderPips is not a constructor #70

Open
lpoupet opened this issue May 24, 2022 · 2 comments
Open

[question] TypeError: SvelteRangeSliderPips is not a constructor #70

lpoupet opened this issue May 24, 2022 · 2 comments
Labels
invalid This doesn't seem right question Further information is requested

Comments

@lpoupet
Copy link

lpoupet commented May 24, 2022

Describe the bug
Testing a svelte component that include RangeSlider does not works. I have an error :
TypeError: SvelteRangeSliderPips is not a constructor.

I'm testing a "classic" implementation with :

<script>
  import RangeSlider from "svelte-range-slider-pips";
</script>

<RangeSlider values={[50]} pips />

If I try to fork project and implement some tests with jest and testing library, I don't manage to make it works. Getting error :
Unrecognized option 'sourcemap'.

To Reproduce
Just try to test RangeSlider component in a svelte app.
For the second problem, you can fork : https://github.com/lpoupet/svelte-range-slider-pips

Steps to reproduce the behavior:
Run npm run test

Expected behavior
No error

@lpoupet lpoupet added bug Something isn't working investigating Not quite sure if it's valid, yet labels May 24, 2022
@simeydotme
Copy link
Owner

hi @lpoupet

I don't quite follow what you mean by "classic". Are you meaning that you simply trying to import into a Svelte project? And if so, Svelte 2 or Svelte 3, or SvelteKit ?

Anyway, I cannot replicate, see; https://stackblitz.com/edit/vitejs-vite-4gezgs?file=src%2FApp.svelte&terminal=dev for example.
Please can you produce a reduced test case for me?


Secondly, I'm not sure what your issue is with sourcemap, but I think it's unrelated to this component and is an issue with the way you're loading Svelte. as sourcemap is a Svelte option, not a RangeSlider option. (https://svelte.dev/docs#compile-time-svelte-compile)

@simeydotme simeydotme added invalid This doesn't seem right question Further information is requested and removed bug Something isn't working investigating Not quite sure if it's valid, yet labels May 25, 2022
@simeydotme simeydotme changed the title [bug] TypeError: SvelteRangeSliderPips is not a constructor [question] TypeError: SvelteRangeSliderPips is not a constructor May 25, 2022
@Tlahey
Copy link

Tlahey commented May 31, 2022

Hello,

The issue is, when we use the testing-library with a component importing the svelte-range-slider-pips

<script>
    import RangeSlider from 'svelte-range-slider-pips';
</script>

We have an error TypeError: RangeSlider is not a constructor.

The workaround is specify the /src path on the import

<script>
    import RangeSlider from 'svelte-range-slider-pips/src';
</script>

Because the testing-library will target the main path on the package.json.

@simeydotme simeydotme added this to the Svelte 4+ , Typescript milestone Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants