@@ -2,7 +2,7 @@ const test = require('ava').default;
2
2
const ts = require ( 'typescript' ) ;
3
3
const { prettify } = require ( './_utils' ) ;
4
4
5
- test ( 'works with TypeScript code inside Vue files' , ( t ) => {
5
+ test ( 'works with TypeScript code inside Vue files' , async ( t ) => {
6
6
const code = `
7
7
<script lang="ts">
8
8
import {defineComponent,compile} from 'vue';
@@ -11,25 +11,25 @@ test('works with TypeScript code inside Vue files', (t) => {
11
11
</script>
12
12
` ;
13
13
14
- const formattedCode = prettify ( code , { filepath : 'file.vue' } ) ;
14
+ const formattedCode = await prettify ( code , { filepath : 'file.vue' } ) ;
15
15
16
16
t . is ( formattedCode . split ( '\n' ) [ 1 ] , `import { compile, defineComponent } from "vue";` ) ;
17
17
} ) ;
18
18
19
- test ( 'works with Vue setup scripts' , ( t ) => {
19
+ test ( 'works with Vue setup scripts' , async ( t ) => {
20
20
const code = `
21
21
<script setup lang="ts">
22
22
import {defineComponent,compile} from 'vue';
23
23
export default defineComponent({});
24
24
</script>
25
25
` ;
26
26
27
- const formattedCode = prettify ( code , { filepath : 'file.vue' } ) ;
27
+ const formattedCode = await prettify ( code , { filepath : 'file.vue' } ) ;
28
28
29
29
t . is ( formattedCode . split ( '\n' ) [ 1 ] , `import { defineComponent } from "vue";` ) ;
30
30
} ) ;
31
31
32
- test ( 'preserves new lines and comments in Vue files' , ( t ) => {
32
+ test ( 'preserves new lines and comments in Vue files' , async ( t ) => {
33
33
const code = `<script lang="ts">
34
34
import { defineComponent, ref } from "vue";
35
35
export default defineComponent({
@@ -45,12 +45,12 @@ export default defineComponent({
45
45
<style></style>
46
46
` ;
47
47
48
- const formattedCode = prettify ( code , { filepath : 'file.vue' } ) ;
48
+ const formattedCode = await prettify ( code , { filepath : 'file.vue' } ) ;
49
49
50
50
t . is ( formattedCode , code ) ;
51
51
} ) ;
52
52
53
- test ( 'does not remove imports when Vue components use kebab case' , ( t ) => {
53
+ test ( 'does not remove imports when Vue components use kebab case' , async ( t ) => {
54
54
const code = `<template>
55
55
<div>
56
56
<n-divider />
@@ -62,12 +62,12 @@ import { NDivider } from "naive-ui";
62
62
</script>
63
63
` ;
64
64
65
- const formattedCode = prettify ( code , { filepath : 'file.vue' } ) ;
65
+ const formattedCode = await prettify ( code , { filepath : 'file.vue' } ) ;
66
66
67
67
t . is ( formattedCode , code ) ;
68
68
} ) ;
69
69
70
- test ( 'works with pug templates in Vue files' , ( t ) => {
70
+ test ( 'works with pug templates in Vue files' , async ( t ) => {
71
71
const code = `<script setup lang="ts">
72
72
import { Foo, Bar } from "@/components";
73
73
</script>
86
86
</template>
87
87
` ;
88
88
89
- const formattedCode = prettify ( code , { filepath : 'file.vue' } ) ;
89
+ const formattedCode = await prettify ( code , { filepath : 'file.vue' } ) ;
90
90
91
91
t . is ( formattedCode , expected ) ;
92
92
} ) ;
93
93
94
- test . serial ( 'works with Volar language plugins when not running from the project root' , ( t ) => {
94
+ test . serial ( 'works with Volar language plugins when not running from the project root' , async ( t ) => {
95
95
const originalGetCurrentDir = ts . sys . getCurrentDirectory ;
96
96
97
97
ts . sys . getCurrentDirectory = ( ) => '/' ;
114
114
</template>
115
115
` ;
116
116
117
- const formattedCode = prettify ( code , { filepath : 'file.vue' } ) ;
117
+ const formattedCode = await prettify ( code , { filepath : 'file.vue' } ) ;
118
118
119
119
t . is ( formattedCode , expected ) ;
120
120
0 commit comments