@@ -8,6 +8,10 @@ const loader = require('../');
8
8
chai . use ( sinonChai ) ;
9
9
const { expect } = chai ;
10
10
11
+ function d ( [ str ] ) {
12
+ return str . replace ( / ^ \t + / gm, '' ) . trim ( ) ;
13
+ }
14
+
11
15
describe ( 'loader' , ( ) => {
12
16
function testLoader ( fileName , callback , query , version = 2 ) {
13
17
return ( ) => {
@@ -52,11 +56,11 @@ describe('loader', () => {
52
56
) {
53
57
expect ( err ) . to . exist ;
54
58
55
- expect ( err . message ) . to . eql (
56
- ' ParseError: Expected }}}\n' +
57
- ' 1: <p>Count: {{{count}}</p>\n' +
58
- ' ^\n' +
59
- " 2: <button on:click='set({ count: count + 1 })'>+1</button>"
59
+ expect ( err . message ) . to . eql ( d `
60
+ ParseError: Expected }}}
61
+ 1: <p>Count: {{{count}}</p>
62
+ ^
63
+ 2: <button on:click='set({ count: count + 1 })'>+1</button>`
60
64
) ;
61
65
62
66
expect ( code ) . not . to . exist ;
@@ -74,14 +78,14 @@ describe('loader', () => {
74
78
) {
75
79
expect ( err ) . to . exist ;
76
80
77
- expect ( err . message ) . to . eql (
78
- ' ParseError: Unexpected token\n' +
79
- ' 3: <script>\n' +
80
- ' 4: export {\n' +
81
- " 5: foo: 'BAR'\n" +
82
- ' ^\n' +
83
- ' 6: };\n' +
84
- ' 7: </script>'
81
+ expect ( err . message ) . to . eql ( d `
82
+ ParseError: Unexpected token
83
+ 3: <script>
84
+ 4: export {
85
+ 5: foo: 'BAR'
86
+ ^
87
+ 6: };
88
+ 7: </script>`
85
89
) ;
86
90
87
91
expect ( code ) . not . to . exist ;
@@ -99,14 +103,14 @@ describe('loader', () => {
99
103
) {
100
104
expect ( err ) . to . exist ;
101
105
102
- expect ( err . message ) . to . eql (
103
- ' ValidationError: Computed properties can be function expressions or arrow function expressions\n' +
104
- ' 4: export default {\n' +
105
- ' 5: computed: {\n' +
106
- " 6: foo: 'BAR'\n" +
107
- ' ^\n' +
108
- ' 7: }\n' +
109
- ' 8: };'
106
+ expect ( err . message ) . to . eql ( d `
107
+ ValidationError: Computed properties can be function expressions or arrow function expressions
108
+ 4: export default {
109
+ 5: computed: {
110
+ 6: foo: 'BAR'
111
+ ^
112
+ 7: }
113
+ 8: };`
110
114
) ;
111
115
112
116
expect ( code ) . not . to . exist ;
@@ -125,7 +129,7 @@ describe('loader', () => {
125
129
expect ( map ) . to . exist ;
126
130
127
131
// es2015 statements remain
128
- expect ( code ) . to . contain ( " import { hello } from './utils';" ) ;
132
+ expect ( code ) . to . contain ( ` import { hello } from './utils';` ) ;
129
133
expect ( code ) . to . contain ( 'data() {' ) ;
130
134
} )
131
135
) ;
@@ -136,7 +140,7 @@ describe('loader', () => {
136
140
expect ( err ) . not . to . exist ;
137
141
138
142
// es2015 statements remain
139
- expect ( code ) . to . contain ( " import Nested from './nested';" ) ;
143
+ expect ( code ) . to . contain ( ` import Nested from './nested';` ) ;
140
144
141
145
expect ( code ) . to . exist ;
142
146
expect ( map ) . to . exist ;
0 commit comments