mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-02 03:57:36 +08:00
build: adjust test build setup for easier requires
This commit is contained in:
parent
599e38edb0
commit
f7a91fc9f4
@ -1,3 +1,7 @@
|
||||
var webpackConfig = require('./webpack.test.config')
|
||||
delete webpackConfig.entry
|
||||
delete webpackConfig.devtool
|
||||
|
||||
// shared config for all unit tests
|
||||
module.exports = {
|
||||
frameworks: ['jasmine'],
|
||||
@ -8,17 +12,7 @@ module.exports = {
|
||||
preprocessors: {
|
||||
'../test/unit/specs/index.js': ['webpack']
|
||||
},
|
||||
webpack: {
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /test|node_modules/,
|
||||
loader: 'babel?optional[]=runtime&loose=all'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
webpack: webpackConfig,
|
||||
webpackMiddleware: {
|
||||
noInfo: true
|
||||
},
|
||||
|
@ -1,9 +1,10 @@
|
||||
var path = require('path')
|
||||
var webpack = require('webpack')
|
||||
|
||||
module.exports = {
|
||||
entry: './src/index',
|
||||
output: {
|
||||
path: './dist',
|
||||
path: path.resolve(__dirname, '../dist'),
|
||||
filename: 'vue.js',
|
||||
library: 'Vue',
|
||||
libraryTarget: 'umd'
|
||||
|
@ -1,18 +1,29 @@
|
||||
var path = require('path')
|
||||
var webpack = require('webpack')
|
||||
|
||||
module.exports = {
|
||||
entry: './test/unit/specs/index.js',
|
||||
output: {
|
||||
path: './test/unit',
|
||||
path: path.resolve(__dirname, '../test/unit'),
|
||||
filename: 'specs.js'
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
src: path.resolve(__dirname, '../src')
|
||||
}
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.js$/, loader: 'babel', exclude: /test\/unit/ }
|
||||
{
|
||||
test: /\.js$/,
|
||||
loader: 'babel',
|
||||
exclude: /test\/unit|node_modules/
|
||||
}
|
||||
]
|
||||
},
|
||||
babel: {
|
||||
loose: 'all'
|
||||
loose: 'all',
|
||||
optional: ['runtime']
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
@ -22,7 +33,8 @@ module.exports = {
|
||||
})
|
||||
],
|
||||
devServer: {
|
||||
contentBase: './test/unit'
|
||||
contentBase: './test/unit',
|
||||
noInfo: true
|
||||
},
|
||||
devtool: '#source-map'
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
var Vue = require('../../../../src/index')
|
||||
var _ = require('../../../../src/util')
|
||||
var Vue = require('src')
|
||||
var _ = require('src/util')
|
||||
var nextTick = _.nextTick
|
||||
|
||||
describe('Data API', function () {
|
||||
|
@ -3,8 +3,8 @@
|
||||
* those are tested in transition_spec.js.
|
||||
*/
|
||||
|
||||
var Vue = require('../../../../src/index')
|
||||
var _ = require('../../../../src/util')
|
||||
var Vue = require('src')
|
||||
var _ = require('src/util')
|
||||
|
||||
describe('DOM API', function () {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
var Vue = require('../../../../src/index')
|
||||
var Vue = require('src')
|
||||
|
||||
describe('Events API', function () {
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
var Vue = require('../../../../src/index')
|
||||
var _ = require('../../../../src/util')
|
||||
var config = require('../../../../src/config')
|
||||
var Vue = require('src')
|
||||
var _ = require('src/util')
|
||||
var config = require('src/config')
|
||||
|
||||
describe('Global API', function () {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
var Vue = require('../../../../src/index')
|
||||
var compiler = require('../../../../src/compiler')
|
||||
var Vue = require('src')
|
||||
var compiler = require('src/compiler')
|
||||
|
||||
describe('Lifecycle API', function () {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
var Vue = require('../../../src/index')
|
||||
var Vue = require('src')
|
||||
var _ = Vue.util
|
||||
|
||||
describe('Async components', function () {
|
||||
|
@ -1,6 +1,6 @@
|
||||
var config = require('../../../src/config')
|
||||
var batcher = require('../../../src/batcher')
|
||||
var nextTick = require('../../../src/util').nextTick
|
||||
var config = require('src/config')
|
||||
var batcher = require('src/batcher')
|
||||
var nextTick = require('src/util').nextTick
|
||||
|
||||
describe('Batcher', function () {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
var Cache = require('../../../src/cache')
|
||||
var Cache = require('src/cache')
|
||||
|
||||
/**
|
||||
* Debug function to assert cache state
|
||||
|
@ -1,9 +1,9 @@
|
||||
var Vue = require('../../../../src/index')
|
||||
var _ = require('../../../../src/util')
|
||||
var compiler = require('../../../../src/compiler')
|
||||
var Vue = require('src')
|
||||
var _ = require('src/util')
|
||||
var compiler = require('src/compiler')
|
||||
var compile = compiler.compile
|
||||
var publicDirectives = require('../../../../src/directives/public')
|
||||
var internalDirectives = require('../../../../src/directives/internal')
|
||||
var publicDirectives = require('src/directives/public')
|
||||
var internalDirectives = require('src/directives/internal')
|
||||
|
||||
describe('Compile', function () {
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
var transclude = require('../../../../src/compiler').transclude
|
||||
var Vue = require('../../../../src/index')
|
||||
var _ = require('../../../../src/util')
|
||||
var transclude = require('src/compiler').transclude
|
||||
var Vue = require('src')
|
||||
var _ = require('src/util')
|
||||
|
||||
describe('Transclude', function () {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
var Vue = require('../../../src/index')
|
||||
var Directive = require('../../../src/directive')
|
||||
var Vue = require('src')
|
||||
var Directive = require('src/directive')
|
||||
var nextTick = Vue.nextTick
|
||||
|
||||
describe('Directive', function () {
|
||||
|
@ -1,6 +1,6 @@
|
||||
var Vue = require('../../../../../src/index')
|
||||
var _ = require('../../../../../src/util')
|
||||
var compiler = require('../../../../../src/compiler')
|
||||
var Vue = require('src')
|
||||
var _ = require('src/util')
|
||||
var compiler = require('src/compiler')
|
||||
|
||||
describe('Partial', function () {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
var Vue = require('../../../../../src/index')
|
||||
var _ = require('../../../../../src/util')
|
||||
var Vue = require('src')
|
||||
var _ = require('src/util')
|
||||
|
||||
describe('Slot Distribution', function () {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
var _ = require('../../../../../src/util')
|
||||
var def = require('../../../../../src/directives/internal/class')
|
||||
var _ = require('src/util')
|
||||
var def = require('src/directives/internal/class')
|
||||
|
||||
describe(':class', function () {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
var _ = require('../../../../../src/util')
|
||||
var Vue = require('../../../../../src/index')
|
||||
var _ = require('src/util')
|
||||
var Vue = require('src')
|
||||
|
||||
describe('Component', function () {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
var Vue = require('../../../../../src/index')
|
||||
var Vue = require('src')
|
||||
|
||||
describe('prop', function () {
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
var _ = require('../../../../../src/util')
|
||||
var def = require('../../../../../src/directives/internal/style')
|
||||
var Vue = require('../../../../../src/index')
|
||||
var _ = require('src/util')
|
||||
var def = require('src/directives/internal/style')
|
||||
var Vue = require('src')
|
||||
|
||||
function checkPrefixedProp (prop) {
|
||||
var el = document.createElement('div')
|
||||
|
@ -1,7 +1,7 @@
|
||||
var _ = require('../../../../../src/util')
|
||||
var Vue = require('../../../../../src/index')
|
||||
var Directive = require('../../../../../src/directive')
|
||||
var def = require('../../../../../src/directives/internal/transition')
|
||||
var _ = require('src/util')
|
||||
var Vue = require('src')
|
||||
var Directive = require('src/directive')
|
||||
var def = require('src/directives/internal/transition')
|
||||
|
||||
describe('transition', function () {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
var _ = require('../../../../../src/util')
|
||||
var def = require('../../../../../src/directives/public/bind')
|
||||
var _ = require('src/util')
|
||||
var def = require('src/directives/public/bind')
|
||||
var xlinkNS = 'http://www.w3.org/1999/xlink'
|
||||
|
||||
describe('v-bind', function () {
|
||||
|
@ -1,5 +1,5 @@
|
||||
var compile = require('../../../../../src/compiler').compile
|
||||
var Vue = require('../../../../../src/index')
|
||||
var compile = require('src/compiler').compile
|
||||
var Vue = require('src')
|
||||
|
||||
describe('v-cloak', function () {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
var _ = require('../../../../../src/util')
|
||||
var Vue = require('../../../../../src/index')
|
||||
var _ = require('src/util')
|
||||
var Vue = require('src')
|
||||
|
||||
describe('el', function () {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
var Vue = require('../../../../../../src/index')
|
||||
var Vue = require('src')
|
||||
var _ = Vue.util
|
||||
|
||||
describe('v-for + ref', function () {
|
||||
|
@ -1,6 +1,6 @@
|
||||
var _ = require('../../../../../../src/util')
|
||||
var Vue = require('../../../../../../src/index')
|
||||
var config = require('../../../../../../src/config')
|
||||
var _ = require('src/util')
|
||||
var Vue = require('src')
|
||||
var config = require('src/config')
|
||||
|
||||
describe('v-for', function () {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
var Vue = require('../../../../../../src/index')
|
||||
var Vue = require('src')
|
||||
var _ = Vue.util
|
||||
|
||||
describe('v-for staggering transitions', function () {
|
||||
|
@ -1,5 +1,5 @@
|
||||
var _ = require('../../../../../src/util')
|
||||
var def = require('../../../../../src/directives/public/html')
|
||||
var _ = require('src/util')
|
||||
var def = require('src/directives/public/html')
|
||||
|
||||
describe('v-html', function () {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
var _ = require('../../../../../src/util')
|
||||
var Vue = require('../../../../../src/index')
|
||||
var _ = require('src/util')
|
||||
var Vue = require('src')
|
||||
|
||||
describe('v-if', function () {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
var _ = require('../../../../../src/util')
|
||||
var Vue = require('../../../../../src/index')
|
||||
var _ = require('src/util')
|
||||
var Vue = require('src')
|
||||
|
||||
// unset jQuery to bypass jQuery check for normal test cases
|
||||
jQuery = null
|
||||
|
@ -1,5 +1,5 @@
|
||||
var _ = require('../../../../../src/util')
|
||||
var Vue = require('../../../../../src/index')
|
||||
var _ = require('src/util')
|
||||
var Vue = require('src')
|
||||
|
||||
function trigger (target, event, process) {
|
||||
var e = document.createEvent('HTMLEvents')
|
||||
|
@ -1,4 +1,4 @@
|
||||
var Vue = require('../../../../../src/index')
|
||||
var Vue = require('src')
|
||||
|
||||
describe('v-pre', function () {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
var _ = require('../../../../../src/util')
|
||||
var Vue = require('../../../../../src/index')
|
||||
var _ = require('src/util')
|
||||
var Vue = require('src')
|
||||
|
||||
describe('ref', function () {
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
var Vue = require('../../../../../src/index')
|
||||
var transition = require('../../../../../src/transition')
|
||||
var def = require('../../../../../src/directives/public/show')
|
||||
var Vue = require('src')
|
||||
var transition = require('src/transition')
|
||||
var def = require('src/directives/public/show')
|
||||
|
||||
describe('v-show', function () {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
var _ = require('../../../../../src/util')
|
||||
var def = require('../../../../../src/directives/public/text')
|
||||
var _ = require('src/util')
|
||||
var def = require('src/directives/public/text')
|
||||
|
||||
describe('v-text', function () {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
var filters = require('../../../../src/filters')
|
||||
var filters = require('src/filters')
|
||||
|
||||
describe('Filters', function () {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// set some global Vue options
|
||||
var Vue = require('../../../src/index')
|
||||
var Vue = require('src')
|
||||
Vue.options.replace = false
|
||||
Vue.config.silent = true
|
||||
|
||||
@ -10,8 +10,8 @@ Vue.config.silent = true
|
||||
* utility functions.
|
||||
*/
|
||||
|
||||
var _ = require('../../../src/util')
|
||||
var __ = require('../../../src/util/debug')
|
||||
var _ = require('src/util')
|
||||
var __ = require('src/util/debug')
|
||||
var scope = typeof window === 'undefined'
|
||||
? global
|
||||
: window
|
||||
|
@ -1,5 +1,5 @@
|
||||
var Vue = require('../../../../src/index')
|
||||
var _ = require('../../../../src/util')
|
||||
var Vue = require('src')
|
||||
var _ = require('src/util')
|
||||
|
||||
describe('Instance Events', function () {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
var Vue = require('../../../../src/index')
|
||||
var Vue = require('src')
|
||||
var init = Vue.prototype._init
|
||||
|
||||
describe('Instance Init', function () {
|
||||
|
@ -1,4 +1,4 @@
|
||||
var Vue = require('../../../../src/index')
|
||||
var Vue = require('src')
|
||||
|
||||
describe('misc', function () {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
var Vue = require('../../../../src/index')
|
||||
var _ = require('../../../../src/util')
|
||||
var Vue = require('src')
|
||||
var _ = require('src/util')
|
||||
|
||||
describe('Instance state initialization', function () {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// test cases for edge cases & bug fixes
|
||||
var Vue = require('../../../src/index')
|
||||
var Vue = require('src')
|
||||
var _ = Vue.util
|
||||
|
||||
describe('Misc', function () {
|
||||
|
@ -1,4 +1,4 @@
|
||||
var Dep = require('../../../../src/observer/dep')
|
||||
var Dep = require('src/observer/dep')
|
||||
|
||||
describe('Dep', function () {
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
var Vue = require('../../../../src')
|
||||
var ob = require('../../../../src/observer')
|
||||
var Vue = require('src')
|
||||
var ob = require('src/observer')
|
||||
var Observer = ob.Observer
|
||||
var observe = ob.observe
|
||||
var Dep = require('../../../../src/observer/dep')
|
||||
var _ = require('../../../../src/util')
|
||||
var config = require('../../../../src/config')
|
||||
var Dep = require('src/observer/dep')
|
||||
var _ = require('src/util')
|
||||
var config = require('src/config')
|
||||
|
||||
describe('Observer', function () {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
var parse = require('../../../../src/parsers/directive').parseDirective
|
||||
var parse = require('src/parsers/directive').parseDirective
|
||||
|
||||
describe('Directive Parser', function () {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
var expParser = require('../../../../src/parsers/expression')
|
||||
var expParser = require('src/parsers/expression')
|
||||
|
||||
var testCases = [
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
var Path = require('../../../../src/parsers/path')
|
||||
var _ = require('../../../../src/util')
|
||||
var Path = require('src/parsers/path')
|
||||
var _ = require('src/util')
|
||||
|
||||
function assertPath (str, expected) {
|
||||
var path = Path.parsePath(str)
|
||||
|
@ -1,4 +1,4 @@
|
||||
var templateParser = require('../../../../src/parsers/template')
|
||||
var templateParser = require('src/parsers/template')
|
||||
var parse = templateParser.parseTemplate
|
||||
var testString = '<div>hello</div><p class="test">world</p>'
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
var textParser = require('../../../../src/parsers/text')
|
||||
var dirParser = require('../../../../src/parsers/directive')
|
||||
var config = require('../../../../src/config')
|
||||
var textParser = require('src/parsers/text')
|
||||
var dirParser = require('src/parsers/directive')
|
||||
var config = require('src/config')
|
||||
|
||||
var testCases = [
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
var Vue = require('../../../../src/index')
|
||||
var _ = require('../../../../src/util')
|
||||
var transition = require('../../../../src/transition')
|
||||
var Transition = require('../../../../src/transition/transition')
|
||||
var Vue = require('src')
|
||||
var _ = require('src/util')
|
||||
var transition = require('src/transition')
|
||||
var Transition = require('src/transition/transition')
|
||||
|
||||
if (!_.isIE9) {
|
||||
describe('Transition', function () {
|
||||
|
@ -1,4 +1,4 @@
|
||||
var _ = require('../../../../src/util')
|
||||
var _ = require('src/util')
|
||||
|
||||
describe('Util - component', function () {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
var _ = require('../../../../src/util')
|
||||
var config = require('../../../../src/config')
|
||||
var _ = require('src/util')
|
||||
var config = require('src/config')
|
||||
var warnPrefix = '[Vue warn]: '
|
||||
|
||||
if (typeof console !== 'undefined') {
|
||||
|
@ -1,4 +1,4 @@
|
||||
var _ = require('../../../../src/util')
|
||||
var _ = require('src/util')
|
||||
|
||||
describe('Util - DOM', function () {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
var _ = require('../../../../src/util')
|
||||
var _ = require('src/util')
|
||||
|
||||
describe('Util - Environment', function () {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
var _ = require('../../../../src/util')
|
||||
var _ = require('src/util')
|
||||
|
||||
describe('Util - Language Enhancement', function () {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
var _ = require('../../../../src/util')
|
||||
var Vue = require('../../../../src/index')
|
||||
var _ = require('src/util')
|
||||
var Vue = require('src')
|
||||
var merge = _.mergeOptions
|
||||
var resolveAsset = _.resolveAsset
|
||||
|
||||
@ -263,7 +263,7 @@ describe('Util - Option merging', function () {
|
||||
})
|
||||
|
||||
it('already observed instance data merge with default data', function () {
|
||||
var observe = require('../../../../src/observer').observe
|
||||
var observe = require('src/observer').observe
|
||||
var instanceData = { a: 123 }
|
||||
// observe it
|
||||
observe(instanceData)
|
||||
|
@ -1,6 +1,6 @@
|
||||
var Vue = require('../../../src/index')
|
||||
var Vue = require('src')
|
||||
var nextTick = Vue.nextTick
|
||||
var Watcher = require('../../../src/watcher')
|
||||
var Watcher = require('src/watcher')
|
||||
var _ = Vue.util
|
||||
var config = Vue.config
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user