From: Eduardo San Martin Morote Date: Wed, 16 Oct 2019 19:37:36 +0000 (+0200) Subject: test(e2e): add starting page X-Git-Tag: v4.0.0-alpha.0~187 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77c117f8c5b117f62eb2f3b6e08e6f6842c48ae3;p=thirdparty%2Fvuejs%2Frouter.git test(e2e): add starting page --- diff --git a/.gitignore b/.gitignore index 91212286..1198041c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ local.log .DS_Store e2e/reports e2e/screenshots +examples/__build__ diff --git a/examples/index.html b/examples/index.html new file mode 100644 index 00000000..57296fd7 --- /dev/null +++ b/examples/index.html @@ -0,0 +1,22 @@ + + + + + + + Vue Router Examples + + +
+

Vue Router Examples

+ + +
+ + + + diff --git a/examples/index.ts b/examples/index.ts new file mode 100644 index 00000000..c63a4d32 --- /dev/null +++ b/examples/index.ts @@ -0,0 +1,17 @@ +import Vue from 'vue' + +const context = require.context('.', true, /^.{2,}\/index\.ts$/) +const DIR_RE = /^\.\/([^/]+)\// + +const examples: string[] = [] +context.keys().forEach(path => { + const match = DIR_RE.exec(path) + if (match) examples.push(match[1]) + return name +}) +examples.sort() + +new Vue({ + el: '#app', + data: { examples }, +}) diff --git a/examples/tsconfig.json b/examples/tsconfig.json index 6cbbe090..dbdce62e 100644 --- a/examples/tsconfig.json +++ b/examples/tsconfig.json @@ -1,5 +1,5 @@ { - "include": ["*/*ts"], + "include": ["index.ts", "*/*ts"], "compilerOptions": { "target": "es5", "module": "commonjs", diff --git a/examples/webpack.config.js b/examples/webpack.config.js index a8820926..10d4b794 100644 --- a/examples/webpack.config.js +++ b/examples/webpack.config.js @@ -23,39 +23,24 @@ module.exports = { mode: process.env.NODE_ENV || 'development', - // devtool: 'inline-source-map', + devtool: 'inline-source-map', devServer: { - // contentBase: outputPath, historyApiFallback: { rewrites: examples.map(name => ({ from: new RegExp(`^/${name}(?:\\/?|/.*)$`), to: `/${name}.html`, })), - // rewrites: [ - // { from: /^\/encoding(?:\/?|\/.*)$/, to: '/encoding.html' }, - // { from: /^\/hash(?:\/?|\/.*)$/, to: '/hash.html' }, - // ], }, - // hot: true, + hot: true, }, - entry: examples.reduce((entries, name) => { - entries[name] = resolve(__dirname, name, 'index.ts') - return entries - }, {}), - // entry: { - // encoding: resolve(__dirname, 'encoding/index.ts'), - // hash: resolve(__dirname, 'hash/index.ts'), - // }, - // entry: fs.readdirSync(__dirname).reduce((entries, dir) => { - // const fullDir = path.join(__dirname, dir) - // const entry = path.join(fullDir, 'index.ts') - // if (fs.statSync(fullDir).isDirectory() && fs.existsSync(entry)) { - // entries[dir] = ['es6-promise/auto', entry] - // } - - // return entries - // }, {}), + entry: examples.reduce( + (entries, name) => { + entries[name] = resolve(__dirname, name, 'index.ts') + return entries + }, + { index: resolve(__dirname, 'index.ts') } + ), output: { path: join(__dirname, '__build__'), @@ -89,6 +74,11 @@ module.exports = { template: resolve(__dirname, name, 'index.html'), }) ), + new HtmlWebpackPlugin({ + filename: 'index.html', + chunks: ['index'], + template: resolve(__dirname, 'index.html'), + }), new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify(process.env.NODE_ENV), diff --git a/package.json b/package.json index 87967edb..7e639cf7 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,8 @@ "devDependencies": { "@types/jest": "^24.0.18", "@types/jsdom": "^12.2.4", + "@types/webpack": "^4.39.3", + "@types/webpack-env": "^1.14.1", "@vue/test-utils": "^1.0.0-beta.29", "axios": "^0.19.0", "browserstack-local": "^1.4.2", diff --git a/yarn.lock b/yarn.lock index 6caaf0d6..720869a1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -286,6 +286,11 @@ "@types/istanbul-reports" "^1.1.1" "@types/yargs" "^13.0.0" +"@types/anymatch@*": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a" + integrity sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA== + "@types/babel__core@^7.1.0": version "7.1.3" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.3.tgz#e441ea7df63cd080dfcd02ab199e6d16a735fc30" @@ -396,16 +401,59 @@ dependencies: "@types/node" "*" +"@types/source-list-map@*": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9" + integrity sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA== + "@types/stack-utils@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== +"@types/tapable@*": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.4.tgz#b4ffc7dc97b498c969b360a41eee247f82616370" + integrity sha512-78AdXtlhpCHT0K3EytMpn4JNxaf5tbqbLcbIRoQIHzpTIyjpxLQKRoxU55ujBXAtg3Nl2h/XWvfDa9dsMOd0pQ== + "@types/tough-cookie@*": version "2.3.5" resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-2.3.5.tgz#9da44ed75571999b65c37b60c9b2b88db54c585d" integrity sha512-SCcK7mvGi3+ZNz833RRjFIxrn4gI1PPR3NtuIS+6vMkvmsGjosqTJwRt5bAEFLRz+wtJMWv8+uOnZf2hi2QXTg== +"@types/uglify-js@*": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-3.0.4.tgz#96beae23df6f561862a830b4288a49e86baac082" + integrity sha512-SudIN9TRJ+v8g5pTG8RRCqfqTMNqgWCKKd3vtynhGzkIIjxaicNAMuY5TRadJ6tzDu3Dotf3ngaMILtmOdmWEQ== + dependencies: + source-map "^0.6.1" + +"@types/webpack-env@^1.14.1": + version "1.14.1" + resolved "https://registry.yarnpkg.com/@types/webpack-env/-/webpack-env-1.14.1.tgz#0d8a53f308f017c53a5ddc3d07f4d6fa76b790d7" + integrity sha512-0Ki9jAAhKDSuLDXOIMADg54Hu60SuBTEsWaJGGy5cV+SSUQ63J2a+RrYYGrErzz39fXzTibhKrAQJAb8M7PNcA== + +"@types/webpack-sources@*": + version "0.1.5" + resolved "https://registry.yarnpkg.com/@types/webpack-sources/-/webpack-sources-0.1.5.tgz#be47c10f783d3d6efe1471ff7f042611bd464a92" + integrity sha512-zfvjpp7jiafSmrzJ2/i3LqOyTYTuJ7u1KOXlKgDlvsj9Rr0x7ZiYu5lZbXwobL7lmsRNtPXlBfmaUD8eU2Hu8w== + dependencies: + "@types/node" "*" + "@types/source-list-map" "*" + source-map "^0.6.1" + +"@types/webpack@^4.39.3": + version "4.39.3" + resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-4.39.3.tgz#1d55f8fce117a325368bf7612950552ee4ed4467" + integrity sha512-afGNNuTfKk1YfHrQ+IwF0QhDkSSMIMMt8BRRErTKaGVvWTMABDjT22/4kJ4bRoSzir9LVgxuuceyZ4Z5I82Cyg== + dependencies: + "@types/anymatch" "*" + "@types/node" "*" + "@types/tapable" "*" + "@types/uglify-js" "*" + "@types/webpack-sources" "*" + source-map "^0.6.0" + "@types/yargs-parser@*": version "13.1.0" resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.1.0.tgz#c563aa192f39350a1d18da36c5a8da382bbd8228"