Skip to content

feat: updates sveltekit starter dependencies and testing strategy #4310

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

# UNRELEASED

### feat: updates sveltekit starter dependencies and testing strategy

Now uses `@testing-library/svelte` and requires less setup logic in the "frontend tests"

# 0.28.0

### fix: deps deploy works with Canister ID out of the ranges of the pocket-ic subnets
Expand Down
1 change: 1 addition & 0 deletions e2e_project_sveltekit
Submodule e2e_project_sveltekit added at a6d51b
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
"format": "prettier --write \"src/**/*.{json,js,jsx,ts,tsx,css,scss}\""
},
"dependencies": {
"@dfinity/agent": "^2.1.3",
"@dfinity/candid": "^2.1.3",
"@dfinity/principal": "^2.1.3"
"@dfinity/agent": "^2.4.1",
"@dfinity/candid": "^2.4.1",
"@dfinity/principal": "^2.4.1"
},
"devDependencies": {
"@sveltejs/adapter-static": "^3.0.4",
"@sveltejs/kit": "^2.5.26",
"@sveltejs/vite-plugin-svelte": "^3.1.2",
"dotenv": "^16.3.1",
"sass": "^1.63.6",
"svelte": "^4.2.19",
"svelte-check": "^4.0.1",
"typescript": "^5.6.2",
"vite": "^5.4.3",
"@sveltejs/adapter-static": "^3.0.8",
"@sveltejs/kit": "^2.22.4",
"@sveltejs/vite-plugin-svelte": "^5.1.0",
"dotenv": "^17.2.0",
"sass": "^1.89.2",
"svelte": "^5.35.5",
"svelte-check": "^4.2.2",
"typescript": "^5.8.3",
"vite": "^6.3.5",
"vite-plugin-environment": "^1.1.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import dotenv from 'dotenv';

dotenv.config({ path: '../../.env' });

export default defineConfig({
export default defineConfig(({mode}) => ({
build: {
emptyOutDir: true,
},
Expand Down Expand Up @@ -41,4 +41,4 @@ export default defineConfig({
],
dedupe: ['@dfinity/agent'],
},
});
}));
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
{
"op": "add",
"path": "/devDependencies/@testing-library~1jest-dom",
"value": "^5.16.5"
"value": "^6.6.3"
},
{
"op": "add",
"path": "/devDependencies/cross-fetch",
"value": "^3.1.6"
"path": "/devDependencies/@testing-library~1svelte",
"value": "^5.2.1"
},
{
"op": "add",
"path": "/devDependencies/jsdom",
"value": "^22.1.0"
"value": "^26.1.0"
},
{
"op": "add",
"path": "/devDependencies/vitest",
"value": "^2.0.5"
"value": "^3.2.4"
},
{
"op": "add",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import { test, expect, afterEach } from 'vitest';
import {render, screen} from '@testing-library/svelte'
import { test, expect } from 'vitest';
import App from '../routes/+page.svelte';

let host;

afterEach(() => {
host.remove();
});

test('mount component', async () => {
host = document.createElement('div');
host.setAttribute('id', 'host');
document.body.appendChild(host);
const instance = new App({ target: host, props: {} });
expect(instance).toBeTruthy();
expect(host.innerHTML).toMatchInlineSnapshot(
render(App,{ target: host, props: {} });

const main = screen.getByRole('main');
expect(main.outerHTML).toMatchInlineSnapshot(
'"<main><img src="/logo2.svg" alt="DFINITY logo"> <br> <br> <form action="#"><label for="name">Enter your name: &nbsp;</label> <input id="name" alt="Name" type="text"> <button type="submit">Click Me!</button></form> <section id="greeting"></section></main>"'
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
@@ -33,1 +33,5 @@
+ test: {
+ environment: 'jsdom',
+ setupFiles: 'src/setupTests.js',
+ },
resolve: {
+ conditions: mode === 'test' ? ['browser'] : [],
Loading