File tree 7 files changed +1139
-1
lines changed
7 files changed +1139
-1
lines changed Original file line number Diff line number Diff line change
1
+ node_modules
2
+ yarn-error.log
Original file line number Diff line number Diff line change 1
- # vue-compat-composition-api-bug-repo
1
+ # vue-compat-composition-api-bug-repo
2
+
3
+ Reproduction for @vue/compat mode issue with composition API.
4
+
5
+ ` yarn test:vue3 `
6
+
7
+ ` yarn test:vue-compat `
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " vue-compat-composition-api-bug-repo" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " " ,
5
+ "main" : " index.js" ,
6
+ "scripts" : {
7
+ "test:vue3" : " vitest run" ,
8
+ "test:vue-compat" : " vitest run --config vite.config.compat.js"
9
+ },
10
+ "repository" : {
11
+ "type" : " git" ,
12
+ "url" : " git+https://github.com/Weetbix/vue-compat-composition-api-bug-repo.git"
13
+ },
14
+ "author" : " " ,
15
+ "license" : " MIT" ,
16
+ "bugs" : {
17
+ "url" : " https://github.com/Weetbix/vue-compat-composition-api-bug-repo/issues"
18
+ },
19
+ "homepage" : " https://github.com/Weetbix/vue-compat-composition-api-bug-repo#readme" ,
20
+ "dependencies" : {
21
+ "@testing-library/vue" : " ^6.6.0" ,
22
+ "@vue/compat" : " ^3.2.37" ,
23
+ "vitest" : " ^0.17.1" ,
24
+ "vue" : " ^3.2.37"
25
+ },
26
+ "devDependencies" : {
27
+ "jsdom" : " ^20.0.0"
28
+ }
29
+ }
Original file line number Diff line number Diff line change
1
+
2
+
3
+ import { ref , onMounted , defineComponent } from 'vue' ;
4
+ import { it } from 'vitest' ;
5
+ import { render } from '@testing-library/vue' ;
6
+
7
+ function sleep ( ms ) {
8
+ return new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
9
+ }
10
+
11
+ const TestAsync = defineComponent ( {
12
+ template : '<div><div>{{ mountText }}</div><div>{{ asyncText }}</div></div>' ,
13
+
14
+ setup ( ) {
15
+ const mountText = ref ( ) ;
16
+ const asyncText = ref ( ) ;
17
+
18
+ onMounted ( ( ) => {
19
+ mountText . value = 'mounted' ;
20
+ } ) ;
21
+
22
+ sleep ( 0 ) . then ( ( ) => {
23
+ asyncText . value = 'async' ;
24
+ } ) ;
25
+
26
+ return {
27
+ mountText,
28
+ asyncText,
29
+ } ;
30
+ } ,
31
+ } ) ;
32
+
33
+ it ( 'should show onMount text' , async ( ) => {
34
+ const { findByText} = render ( TestAsync ) ;
35
+ await findByText ( 'mounted' ) ;
36
+ } ) ;
37
+
38
+ it ( 'should show async text' , async ( ) => {
39
+ const { findByText} = render ( TestAsync ) ;
40
+ await findByText ( 'async' ) ;
41
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import { defineConfig } from 'vite'
2
+
3
+ export default defineConfig ( {
4
+ test : {
5
+ environment : 'jsdom' ,
6
+ } ,
7
+ resolve : {
8
+ alias : {
9
+ vue : '@vue/compat' ,
10
+ }
11
+ }
12
+ } )
Original file line number Diff line number Diff line change
1
+ import { defineConfig } from 'vite'
2
+
3
+ export default defineConfig ( {
4
+ test : {
5
+ environment : 'jsdom' ,
6
+ } ,
7
+ } )
You can’t perform that action at this time.
0 commit comments