Skip to content

Commit 3347015

Browse files
committed
test: improve tslint test case (test fixing vue files)
1 parent 1ded378 commit 3347015

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/@vue/cli-plugin-typescript/__tests__/tsPluginLint.spec.js

+12
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,22 @@ test('should work', async () => {
1313
const { read, write, run } = project
1414
const main = await read('src/main.ts')
1515
expect(main).toMatch(';')
16+
const app = await read('src/App.vue')
17+
expect(main).toMatch(';')
1618
// remove semicolons
1719
const updatedMain = main.replace(/;/g, '')
1820
await write('src/main.ts', updatedMain)
21+
// for Vue file, only remove semis in script section
22+
const updatedApp = app.replace(/<script(.|\n)*\/script>/, $ => {
23+
return $.replace(/;/g, '')
24+
})
25+
await write('src/App.vue', updatedApp)
1926
// lint
2027
await run('vue-cli-service lint')
2128
expect(await read('src/main.ts')).toMatch(';')
29+
30+
const lintedApp = await read('src/App.vue')
31+
expect(lintedApp).toMatch(';')
32+
// test if tslint is fixing vue files properly
33+
expect(lintedApp).toBe(app)
2234
})

0 commit comments

Comments
 (0)