Skip to content

Commit

Permalink
fix(typescript): fix invalid tsconfig.json (#1036)
Browse files Browse the repository at this point in the history
  • Loading branch information
elevatebart authored and yyx990803 committed Apr 25, 2018
1 parent d184638 commit c49eeb7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
21 changes: 19 additions & 2 deletions packages/@vue/cli-plugin-typescript/__tests__/tsGenerator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ test('classComponent', async () => {

expect(files['tsconfig.json']).toMatch(`"experimentalDecorators": true`)
expect(files['tsconfig.json']).toMatch(`"emitDecoratorMetadata": true`)
expect(files['src/App.vue']).toMatch(`export default class App extends Vue {`)
expect(files['src/components/HelloWorld.vue']).toMatch(`export default class HelloWorld extends Vue {`)
expect(files['src/App.vue']).toMatch(
`export default class App extends Vue {`
)
expect(files['src/components/HelloWorld.vue']).toMatch(
`export default class HelloWorld extends Vue {`
)
})

test('use with Babel', async () => {
Expand Down Expand Up @@ -96,6 +100,19 @@ test('lint with no lintOnSave', async () => {
expect(pkg.vue).toEqual({ lintOnSave: false })
})

test('tsconfig.json should be valid json', async () => {
const { files } = await generateWithPlugin([
{
id: 'ts',
apply: require('../generator'),
options: {}
}
])
expect(() => {
JSON.parse(files['tsconfig.json'])
}).not.toThrow()
})

test('compat with unit-mocha', async () => {
const { pkg } = await generateWithPlugin([
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
"sourceMap": true,
"baseUrl": ".",
"types": [
"node",
<%_ if (hasMocha) { _%>
"node"<%_ if (hasMocha) { _%>,
"mocha",
"chai"
<%_ } else if (hasJest) { _%>
<%_ } else if (hasJest) { _%>,
"jest"
<%_ } _%>
],
Expand Down

0 comments on commit c49eeb7

Please sign in to comment.