mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
修改 unit test 的配置 (#10)
* change require vue to Vue && waterfall.md * use vue in amd & commonjs, use Vue in root * change webpack config * fix some config
This commit is contained in:
parent
50f359a420
commit
2b5d306628
@ -47,7 +47,6 @@
|
|||||||
"vue": "2.1.8"
|
"vue": "2.1.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"2webpack2": "^1.2.1",
|
|
||||||
"autoprefixer": "^6.7.5",
|
"autoprefixer": "^6.7.5",
|
||||||
"avoriaz": "^1.11.1",
|
"avoriaz": "^1.11.1",
|
||||||
"babel-cli": "^6.14.0",
|
"babel-cli": "^6.14.0",
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const to2 = require('2webpack2');
|
const webpack = require('webpack');
|
||||||
// const webpack = require('webpack');
|
|
||||||
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
||||||
const getPostcssPlugin = require('../../build/utils/postcss_pipe');
|
const getPostcssPlugin = require('../../build/utils/postcss_pipe');
|
||||||
|
|
||||||
@ -9,23 +8,33 @@ const webpackConfig = {
|
|||||||
path: path.resolve(process.cwd(), 'dist'),
|
path: path.resolve(process.cwd(), 'dist'),
|
||||||
publicPath: '/dist/',
|
publicPath: '/dist/',
|
||||||
filename: '[name].js',
|
filename: '[name].js',
|
||||||
chunkFilename: '[id].js'
|
chunkFilename: '[id].js',
|
||||||
|
libraryTarget: 'umd'
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new ProgressBarPlugin()
|
new ProgressBarPlugin(),
|
||||||
|
new webpack.LoaderOptionsPlugin({
|
||||||
|
minimize: true,
|
||||||
|
options: {
|
||||||
|
postcss: getPostcssPlugin,
|
||||||
|
babel: {
|
||||||
|
presets: ['es2015'],
|
||||||
|
plugins: ['transform-runtime', 'transform-vue-jsx']
|
||||||
|
},
|
||||||
|
vue: {
|
||||||
|
autoprefixer: false,
|
||||||
|
preserveWhitespace: false,
|
||||||
|
postcss: getPostcssPlugin
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
],
|
],
|
||||||
postcss: getPostcssPlugin,
|
|
||||||
resolve: {
|
resolve: {
|
||||||
modules: [
|
modules: [
|
||||||
path.resolve(process.cwd(), 'node_modules'),
|
path.resolve(process.cwd(), 'node_modules'),
|
||||||
'node_modules'
|
'node_modules'
|
||||||
],
|
],
|
||||||
extensions: [
|
extensions: ['.js', '.json', '.vue'],
|
||||||
'',
|
|
||||||
'.js',
|
|
||||||
'.json',
|
|
||||||
'.vue'
|
|
||||||
],
|
|
||||||
alias: {
|
alias: {
|
||||||
src: path.resolve(process.cwd(), 'src'),
|
src: path.resolve(process.cwd(), 'src'),
|
||||||
packages: path.resolve(process.cwd(), 'packages'),
|
packages: path.resolve(process.cwd(), 'packages'),
|
||||||
@ -33,104 +42,75 @@ const webpackConfig = {
|
|||||||
vue$: 'vue/dist/vue.common.js'
|
vue$: 'vue/dist/vue.common.js'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
resolveLoader: {},
|
|
||||||
module: {
|
module: {
|
||||||
loaders: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /\.(jsx?|babel|es6)$/,
|
enforce: 'pre',
|
||||||
include: path.resolve(process.cwd()),
|
test: /\.js$/,
|
||||||
exclude: /node_modules|utils\/popper\.js|utils\/date.\js/,
|
exclude: /node_modules|vue-router\/|vue-loader\/|vue-hot-reload-api\/|docs|test|src\/index/,
|
||||||
loaders: [
|
use: ['isparta-loader']
|
||||||
'babel-loader'
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.json$/,
|
test: /\.js$/,
|
||||||
loaders: [
|
exclude: /node_modules|vue-router\/|vue-loader\/|vue-hot-reload-api\//,
|
||||||
'json-loader'
|
use: ['babel-loader']
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.css$/,
|
test: /\.(css|pcss)$/,
|
||||||
loaders: [
|
use: [
|
||||||
'style-loader',
|
'style-loader',
|
||||||
'css-loader',
|
'css-loader',
|
||||||
'postcss-loader'
|
'postcss-loader'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
test: /\.html$/,
|
|
||||||
loaders: [
|
|
||||||
'html-loader?minimize=false'
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.otf|ttf|woff2?|eot(\?\S*)?$/,
|
|
||||||
loader: 'url-loader',
|
|
||||||
query: {
|
|
||||||
limit: 10000,
|
|
||||||
name: 'static/[name].[hash:7].[ext]'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.svg(\?\S*)?$/,
|
|
||||||
loader: 'url-loader',
|
|
||||||
query: {
|
|
||||||
limit: 10000,
|
|
||||||
name: 'static/[name].[hash:7].[ext]'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
test: /\.(gif|png|jpe?g)(\?\S*)?$/,
|
test: /\.(gif|png|jpe?g)(\?\S*)?$/,
|
||||||
loader: 'url-loader',
|
use: [{
|
||||||
query: {
|
loader: 'url-loader',
|
||||||
limit: 10000,
|
options: {
|
||||||
name: 'static/[name].[hash:7].[ext]'
|
query: {
|
||||||
}
|
limit: 10000,
|
||||||
|
name: 'static/[name].[hash:7].[ext]'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.vue$/,
|
test: /test\/unit\/components\/.*\.vue$/,
|
||||||
loaders: [
|
use: [{
|
||||||
'vue-loader'
|
loader: 'vue-loader',
|
||||||
]
|
options: {
|
||||||
|
loaders: {
|
||||||
|
css: [
|
||||||
|
'style-loader',
|
||||||
|
'css-loader',
|
||||||
|
'postcss-loader'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /packages\/.*\.vue$/,
|
||||||
|
use: [{
|
||||||
|
loader: 'vue-loader',
|
||||||
|
options: {
|
||||||
|
loaders: {
|
||||||
|
css: [
|
||||||
|
'style-loader',
|
||||||
|
'css-loader',
|
||||||
|
'postcss-loader'
|
||||||
|
],
|
||||||
|
js: [
|
||||||
|
'isparta-loader'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
preLoaders: [
|
|
||||||
{
|
|
||||||
test: /\.js$/,
|
|
||||||
loader: 'isparta',
|
|
||||||
exclude: /node_modules|utils\/popper\.js|utils\/date.\js/,
|
|
||||||
include: /src|packages/
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.jsx?$/,
|
|
||||||
exclude: /node_modules|bower_components/,
|
|
||||||
loader: 'eslint-loader'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.vue$/,
|
|
||||||
exclude: /node_modules|bower_components/,
|
|
||||||
loader: 'eslint-loader'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
postLoaders: []
|
|
||||||
},
|
},
|
||||||
devtool: '#inline-source-map',
|
devtool: '#inline-source-map'
|
||||||
vue: {
|
|
||||||
loaders: {
|
|
||||||
css: 'vue-style-loader!css-loader?sourceMap',
|
|
||||||
less: 'vue-style-loader!css-loader?sourceMap!less-loader?sourceMap',
|
|
||||||
sass: 'vue-style-loader!css-loader?sourceMap!sass-loader?indentedSyntax&sourceMap',
|
|
||||||
scss: 'vue-style-loader!css-loader?sourceMap!sass-loader?sourceMap',
|
|
||||||
stylus: 'vue-style-loader!css-loader?sourceMap!stylus-loader?sourceMap',
|
|
||||||
styl: 'vue-style-loader!css-loader?sourceMap!stylus-loader?sourceMap',
|
|
||||||
js: 'isparta-loader!eslint-loader'
|
|
||||||
},
|
|
||||||
preserveWhitespace: false
|
|
||||||
},
|
|
||||||
eslint: {
|
|
||||||
emitWarning: true
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = to2(webpackConfig, { quiet: true, context: true });
|
module.exports = webpackConfig;
|
||||||
|
@ -9,7 +9,7 @@ var travis = process.env.TRAVIS;
|
|||||||
|
|
||||||
module.exports = function(config) {
|
module.exports = function(config) {
|
||||||
config.set({
|
config.set({
|
||||||
browsers: travis ? ['PhantomJS'] : ['Chrome'],
|
browsers: travis ? ['PhantomJS'] : ['PhantomJS', 'Chrome'],
|
||||||
frameworks: ['mocha', 'sinon-chai'],
|
frameworks: ['mocha', 'sinon-chai'],
|
||||||
reporters: ['spec', 'coverage'],
|
reporters: ['spec', 'coverage'],
|
||||||
files: ['./index.js'],
|
files: ['./index.js'],
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Waterfall from '../components/waterfall';
|
import Waterfall from '../components/waterfall/waterfall';
|
||||||
import { mount } from 'avoriaz';
|
import { mount } from 'avoriaz';
|
||||||
|
|
||||||
describe('Waterfall', () => {
|
describe('Waterfall', () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user