-
Notifications
You must be signed in to change notification settings - Fork 1
/
router-app.spec.ts
80 lines (76 loc) · 2.03 KB
/
router-app.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import { expect, it } from 'vitest';
import { findManualMigrations } from 'vue-metamorph';
import { routerAppPlugin } from './router-app';
it('should report when router.app is used', () => {
const input = `
<template>
<div>{{ $router.app.$data.title }}</div>
</template>
<script>
import router from '@/router';
export default {
created() {
router.app.$data.title;
this.$router.app.$data.title;
},
};
</script>
`;
expect(findManualMigrations(input, 'file.vue', [routerAppPlugin])).toMatchInlineSnapshot(`
[
{
"columnEnd": 21,
"columnStart": 11,
"file": "file.vue",
"lineEnd": 3,
"lineStart": 3,
"message": "router.app was removed.
See: https://router.vuejs.org/guide/migration/#Removal-of-router-app",
"pluginName": "vue-router-router.app",
"snippet": "1 |
2 | <template>
3 | <div>{{ $router.app.$data.title }}</div>
| ^^^^^^^^^^^
4 | </template>
5 |
6 | <script>",
},
{
"columnEnd": 14,
"columnStart": 5,
"file": "file.vue",
"lineEnd": 11,
"lineStart": 11,
"message": "router.app was removed.
See: https://router.vuejs.org/guide/migration/#Removal-of-router-app",
"pluginName": "vue-router-router.app",
"snippet": " 8 |
9 | export default {
10 | created() {
11 | router.app.$data.title;
| ^^^^^^^^^^
12 | this.$router.app.$data.title;
13 | },
14 | };",
},
{
"columnEnd": 20,
"columnStart": 5,
"file": "file.vue",
"lineEnd": 12,
"lineStart": 12,
"message": "router.app was removed.
See: https://router.vuejs.org/guide/migration/#Removal-of-router-app",
"pluginName": "vue-router-router.app",
"snippet": " 9 | export default {
10 | created() {
11 | router.app.$data.title;
12 | this.$router.app.$data.title;
| ^^^^^^^^^^^^^^^^
13 | },
14 | };
15 | </script>",
},
]
`);
});