tsunit example with webpack + typescript + vue
- download source code
cd "yourPath/example-tsunit/"
npm install
npm run dev
example-tsunit/
|- /src/
|- components
|- Aaa.vue // component need to test
|- /test/
|- test.ts // test entry
|- BllTest.ts // one test file
|- TestView.vue // ui test file
|- App.vue // index main components
|- MainHome.ts // index page entry
|- /vbuild/ // webpack config file
|- index.html // main page
|- test.html // test page
...
tsconfig.json
{
"compilerOptions": {
"sourceMap": true,
"experimentalDecorators": true,
}
...
}
webpack dev config
ignore the config in production
mode
{
entry: {
test: "./src/test/test.ts",
},
plugins: [
new HtmlWebpackPlugin({
filename: path.resolve(__dirname, "../dist/web/test.html"),
template: "test.html",
inject: true,
chunks: ['manifest', 'polyfill', 'vendors', 'test']
})
]
...
}