Skip to content
This repository has been archived by the owner on Feb 3, 2020. It is now read-only.

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
okoala committed Apr 1, 2016
1 parent 105ce45 commit f8bb4a5
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ test
bower.json
component.json
gruntfile.js
sauce_connect.log
sauce_connect.log
37 changes: 28 additions & 9 deletions build/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,42 @@
// we can just use the exact same webpack config by requiring it
// but make sure to delete the normal entry
var webpackConf = require('./webpack.base.config')
delete webpackConf.entry

module.exports = function (config) {
config.set({
browsers: ['PhantomJS'],
frameworks: ['jasmine'],
reporters: ['spec'],
reporters: ['spec', 'coverage'],
// this is the entry file for all our tests.
files: ['../test/unit/index.js'],
// we will pass the entry file to webpack for bundling.
preprocessors: {
'../test/unit/index.js': ['webpack']
'../test/unit/index.js': ['webpack', 'sourcemap']
},
webpack: {
devtool: '#inline-source-map',
module: {
loaders: [
{
test: /\.js$/,
exclude: /test|node_modules|vue\/dist/,
loader: 'babel?optional[]=runtime&loose=all'
}
],
postLoaders: [
{
test: /\.js$/,
exclude: /test|node_modules|vue\/dist|lib\//,
loader: 'istanbul-instrumenter'
}
]
}
},
webpack: webpackConf,
webpackMiddleware: {
noInfo: true
},
singleRun: true
singleRun: true,
coverageReporter: {
reporters: [
{ type: 'lcov', dir: '../coverage', subdir: '.' },
{ type: 'text-summary', dir: '../coverage', subdir: '.' }
]
}
})
}
28 changes: 14 additions & 14 deletions build/webpack/_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,20 @@ module.exports = {
loader: 'vue'
},
{
test: /.*\.(gif|png|jpe?g|svg)$/i,
loaders: [
'file?hash=sha512&digest=hex&name=[hash].[ext]',
'image-webpack?{progressive:true, optimizationLevel: 7, interlaced: false, pngquant:{quality: "65-90", speed: 4}}'
]
test: /\.js$/,
loader: 'babel!eslint',
// make sure to exclude 3rd party code in node_modules
exclude: /node_modules/
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel'
test: /.*\.(gif|png|jpe?g|svg)$/i,
loader: 'url',
query: {
// inline files smaller then 10kb as base64 dataURL
limit: 10000,
// fallback to file-loader with this naming scheme
name: '[name].[ext]?[hash]'
}
},
{
test: /\.less$/,
Expand All @@ -61,16 +65,12 @@ module.exports = {
loaders: {
// apply babel transform to all javascript
// inside *.vue files.
md: 'html!vue-antd-docs'
// js: 'babel',
md: 'html!vue-antd-docs',
js: 'babel!eslint'
// less: ExtractTextPlugin.extract(
// 'css?sourceMap&-minimize!' + 'autoprefixer-loader!' + 'less?sourceMap'
// )
}
},
eslint: {
configFile: './.eslintrc',
emitWarning: true
},
devtool: 'source-map'
}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,13 @@
"html-webpack-plugin": "^2.15.0",
"image-webpack-loader": "^1.6.3",
"inject-loader": "^2.0.1",
"istanbul-instrumenter-loader": "^0.2.0",
"jasmine-core": "^2.4.1",
"karma": "^0.13.15",
"karma-coverage": "^0.5.5",
"karma-jasmine": "^0.3.6",
"karma-phantomjs-launcher": "^0.2.1",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "0.0.23",
"karma-webpack": "^1.7.0",
"less": "^2.6.0",
Expand Down
13 changes: 13 additions & 0 deletions test/e2e/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
var base = 'http://localhost:' + (process.env.PORT || 8002)

module.exports = {
'components e2e tests': function (browser) {
browser
.url(base)
.waitForElementVisible('h1', 1000)
.assert.containsText('.view', 'FOUR OH FOUR')

// /components
.url(base + '/components')
}
}
14 changes: 14 additions & 0 deletions test/unit/base/menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* global describe, it, expect */

import Vue from 'vue'
import Menu from '../../../components/base/menu'

describe('Base.Menu', () => {
it('should render correct contents', () => {
const vm = new Vue({
template: '<div><menu></menu></div>',
components: { Menu }
}).$mount()
expect(vm.$el.querySelector(''))
})
})

0 comments on commit f8bb4a5

Please sign in to comment.