File tree Expand file tree Collapse file tree 5 files changed +1236
-5
lines changed Expand file tree Collapse file tree 5 files changed +1236
-5
lines changed Original file line number Diff line number Diff line change 5
5
"scripts" : {
6
6
"dev" : " vite" ,
7
7
"build" : " vite build" ,
8
- "preview" : " vite preview"
8
+ "preview" : " vite preview" ,
9
+ "test" : " vitest"
9
10
},
10
11
"devDependencies" : {
11
- "vite" : " ^6.0.0" ,
12
- "vite-plugin-solid" : " workspace:*"
12
+ "@solidjs/testing-library" : " ^0.8.10" ,
13
+ "@testing-library/jest-dom" : " ^6.6.3" ,
14
+ "@testing-library/user-event" : " ^14.6.1" ,
15
+ "jsdom" : " ^26.0.0" ,
16
+ "vite" : " ^6.2.0" ,
17
+ "vite-plugin-solid" : " workspace:*" ,
18
+ "vitest" : " ^3.0.7"
13
19
},
14
20
"dependencies" : {
15
21
"solid-js" : " catalog:"
Original file line number Diff line number Diff line change
1
+ import { expect , test } from 'vitest' ;
2
+ import { render } from '@solidjs/testing-library' ;
3
+ import user from '@testing-library/user-event' ;
4
+
5
+ import App from '../src/App.jsx' ;
6
+
7
+ test ( 'App' , async ( ) => {
8
+ const { getByText } = render ( ( ) => < App /> ) ;
9
+
10
+ const counterTitle = getByText ( 'Counter' ) ;
11
+
12
+ const count = counterTitle . nextElementSibling as HTMLElement ;
13
+ expect ( count ) . instanceOf ( HTMLElement ) ;
14
+ expect ( count . innerHTML ) . toContain ( 'Count: 0' ) ;
15
+
16
+ const incrementButton = getByText ( 'Increment' ) ;
17
+ await user . click ( incrementButton ) ;
18
+ expect ( count . innerHTML ) . toContain ( 'Count: 1' ) ;
19
+
20
+ const decrementButton = getByText ( 'Decrement' ) ;
21
+ await user . click ( decrementButton ) ;
22
+ expect ( count . innerHTML ) . toContain ( 'Count: 0' ) ;
23
+ } ) ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "extends" : " ../tsconfig.json" ,
3
+ "compilerOptions" : {
4
+ "types" : [
5
+ " @testing-library/jest-dom"
6
+ ]
7
+ },
8
+ "include" : [
9
+ " **/*.ts" ,
10
+ " **/*.tsx"
11
+ ]
12
+ }
Original file line number Diff line number Diff line change
1
+ import { defineConfig } from 'vitest/config' ;
2
+ import solidPlugin from '../../src/index.js' ;
3
+
4
+ export default defineConfig ( {
5
+ plugins : [ solidPlugin ( ) ] ,
6
+ resolve : {
7
+ conditions : [ 'development' , 'browser' ] ,
8
+ } ,
9
+ } ) ;
You can’t perform that action at this time.
0 commit comments