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

Move to Jest and add Svelte Testing Library for component tests #276

Merged
merged 10 commits into from
Apr 9, 2024

Conversation

Juholei
Copy link
Collaborator

@Juholei Juholei commented Mar 27, 2024

No description provided.

@Juholei Juholei changed the title AE-2005: Add jest etp-front, switch test, tdd and coverage commands t… AE-2005: Move to Jest and add testing-library/svelte for component tests Mar 27, 2024
@Juholei Juholei changed the title AE-2005: Move to Jest and add testing-library/svelte for component tests AE-2005: Move to Jest and add Svelte Testing Library for component tests Mar 27, 2024
Juholei added 5 commits April 8, 2024 09:34
- Testing-library-svelte requires es modules whereas Jest doesn't fully support them which meant that we needed to enable experimental support through node.js flag
- Component tests need to be run in jsdom environment, which is set in test file, see H1.test.mjs
- Jsdom could be set as the primary test environment, but that broke existing tests that tested code depending on fetch, as that's not available by default in jsdom
- Because other test files are rolled through Babel but these component tests need to be es modules, the component test files need to have the extension .mjs to separate them
- Jest config needs to now then be common js, so the extension is now .cjs
@Juholei Juholei force-pushed the jest-test branch 2 times, most recently from 3f566a9 to 48de300 Compare April 8, 2024 08:33
@Juholei Juholei changed the title AE-2005: Move to Jest and add Svelte Testing Library for component tests Move to Jest and add Svelte Testing Library for component tests Apr 8, 2024
@Juholei
Copy link
Collaborator Author

Juholei commented Apr 8, 2024

Windows-käyttäjät voisivat testata muuttuneet npm-skriptit, että toimivathan ne Windowsillakin.

@Juholei Juholei marked this pull request as ready for review April 8, 2024 08:51
Copy link
Contributor

@muep muep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tarkistin nuo uudet package.jsonin skriptit, että toimivat Windowsilla.

etp-front/package.json Show resolved Hide resolved
- Tests shouldn't be present in coverage themselves, also exclude stories
@Juholei Juholei merged commit 85da29e into main Apr 9, 2024
12 checks passed
@Juholei Juholei deleted the jest-test branch April 9, 2024 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants