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

Upgrade to Svelte 4.2.0 #69

Open
wants to merge 5 commits into
base: main
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ yarn add svelte svelte-frappe-charts
npm i -S svelte svelte-frappe-charts
```

> **Note**: Assumes you are using `>= svelte@3.0.0`.
> **Note**: Assumes you are using `>= svelte@4.0.0`.

### Usage

Expand Down
10 changes: 0 additions & 10 deletions jest.config.js

This file was deleted.

29 changes: 16 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,33 @@
"scripts": {
"build": "rollup -c -m --bundleConfigAsCjs",
"prepublishOnly": "npm run build",
"test": "jest",
"test:watch": "jest --watch",
"test": "vitest run",
"test:ui": "vitest --ui",
"test:watch": "vitest",
"release": "np --no-yarn"
},
"dependencies": {
"frappe-charts": "^1.6.2",
"svelte": "^3.53.1"
"svelte": "^4.2.0"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^23.0.2",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.0.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/svelte": "^3.2.2",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"jest-transform-svelte": "^2.1.1",
"np": "^7.6.2",
"rollup": "^3.4.0",
"rollup-plugin-svelte": "^7.1.0"
"@sveltejs/vite-plugin-svelte": "^3.0.2",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/svelte": "^4.1.0",
"@vitest/ui": "^1.4.0",
"jsdom": "^24.0.0",
"np": "^10.0.2",
"rollup": "^4.13.2",
"rollup-plugin-svelte": "^7.1.0",
"vitest": "^1.4.0"
},
"peerDependencies": {
"svelte": "^3.0.0"
"svelte": "^4.0.0"
},
"module": "lib/index.mjs",
"type": "module",
"main": "lib/index.js",
"svelte": "src/index.js",
"files": [
Expand Down
7 changes: 0 additions & 7 deletions setupTests.js

This file was deleted.

17 changes: 6 additions & 11 deletions src/__tests__/Base.test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
require('@testing-library/jest-dom/extend-expect');
const { cleanup, render } = require('@testing-library/svelte');
const App = require('../__fixtures__/Base.fixture.svelte');
import { test } from 'vitest';
import { cleanup, render } from '@testing-library/svelte';
import App from '../__fixtures__/Base.fixture.svelte';


beforeEach(cleanup);

describe('BaseChart', () => {
it('renders the chart without crashing', () => {
const { getByText } = render(App);
expect(getByText('Chart')).toBeInTheDocument();
});
test('BaseChart renders the chart without crashing', ({ expect }) => {
const { getByText } = render(App);
expect(getByText('Chart')).toBeDefined();
});
16 changes: 16 additions & 0 deletions vitest-setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { cleanup } from '@testing-library/svelte';
import '@testing-library/svelte/vitest'
import '@testing-library/jest-dom/vitest'
import { beforeEach, vi } from 'vitest';

const ResizeObserverMock = vi.fn(() => ({
observe: vi.fn(),
unobserve: vi.fn(),
disconnect: vi.fn(),
}));

vi.stubGlobal('ResizeObserver', ResizeObserverMock);

beforeEach(() => {
cleanup();
})
13 changes: 13 additions & 0 deletions vitest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {defineConfig} from 'vitest/config'
import {svelte} from '@sveltejs/vite-plugin-svelte'

export default defineConfig(({mode}) => ({
plugins: [svelte()],
resolve: {
conditions: mode === 'test' ? ['browser'] : [],
},
test: {
environment: 'jsdom',
setupFiles: ['./vitest-setup.js'],
},
}))
Loading