Skip to content

Commit 5498e23

Browse files
committed
fix(e2e-webdriverio): ensure EOL in existing tsconfig.json
1 parent 95ac06b commit 5498e23

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
jest.setTimeout(process.env.APPVEYOR ? 120000 : 60000)
2+
3+
const create = require('@vue/cli-test-utils/createTestProject')
4+
5+
test('should add types to existing tsconfig.json', async () => {
6+
const { dir, read, write } = await create('e2e-webdriverio-tsconfig', {
7+
plugins: {
8+
'@vue/cli-plugin-typescript': {},
9+
'@vue/cli-plugin-e2e-webdriverio': {
10+
webdrivers: ['chrome']
11+
}
12+
}
13+
})
14+
await write('tsconfig.json', JSON.stringify({ compilerOptions: { types: ['some-type'] }}))
15+
16+
const invoke = require('@vue/cli/lib/invoke')
17+
await invoke('e2e-webdriverio', { webdrivers: ['chrome'] }, dir)
18+
19+
const tsconfig = await read('tsconfig.json')
20+
expect(tsconfig).toMatch(/\r?\n$/)
21+
expect(JSON.parse(tsconfig)['compilerOptions']['types'])
22+
.toEqual(['some-type', 'mocha', '@wdio/mocha-framework', '@wdio/sync'])
23+
})

packages/@vue/cli-plugin-e2e-webdriverio/generator/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const applyTS = module.exports.applyTS = (api, invoking) => {
2121
}
2222
}
2323
}
24-
files['tsconfig.json'] = JSON.stringify(parsed, null, 2)
24+
files['tsconfig.json'] = JSON.stringify(parsed, null, 2) + '\n'
2525
}
2626
})
2727
}

0 commit comments

Comments
 (0)