forked from NervJS/nerv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:搭建新的测试环境,开始使用karma&&Mocha重写所有测试用例
- Loading branch information
Showing
9 changed files
with
138 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,4 @@ | |
}] | ||
], | ||
"comments": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// Karma configuration | ||
// Generated on Tue Jul 18 2017 18:01:48 GMT+0800 (CST) | ||
|
||
const webpack = require('webpack') | ||
|
||
module.exports = function(config) { | ||
config.set({ | ||
|
||
// base path that will be used to resolve all patterns (eg. files, exclude) | ||
basePath: '', | ||
|
||
|
||
// frameworks to use | ||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter | ||
frameworks: ['mocha', 'chai'], | ||
|
||
|
||
// list of files / patterns to load in the browser | ||
files: ['test/spec.js'], | ||
|
||
|
||
// list of files to exclude | ||
exclude: [ | ||
], | ||
|
||
|
||
// preprocess matching files before serving them to the browser | ||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor | ||
preprocessors: { | ||
'test/**/*.js': ['webpack', 'sourcemap'] | ||
}, | ||
|
||
|
||
// test results reporter to use | ||
// possible values: 'dots', 'progress' | ||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter | ||
reporters: ['progress'], | ||
|
||
|
||
// web server port | ||
port: 9876, | ||
|
||
|
||
// enable / disable colors in the output (reporters and logs) | ||
colors: true, | ||
|
||
|
||
// level of logging | ||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | ||
logLevel: config.LOG_INFO, | ||
|
||
|
||
// enable / disable watching file and executing tests whenever any file changes | ||
autoWatch: true, | ||
|
||
|
||
// start these browsers | ||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher | ||
browsers: ['Chrome'], | ||
|
||
|
||
// Continuous Integration mode | ||
// if true, Karma captures browsers, runs the tests and exits | ||
singleRun: false, | ||
|
||
// Concurrency level | ||
// how many browser should be started simultaneous | ||
concurrency: Infinity, | ||
|
||
webpack: { | ||
devtool: 'inline-source-map', | ||
module: { | ||
loaders: [ | ||
{ | ||
test: /\.js$/, | ||
loader: 'babel-loader', | ||
exclude: /node_modules/ | ||
} | ||
] | ||
} | ||
}, | ||
|
||
webpackMiddleware: { | ||
noInfo: true | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { assert } from 'chai' | ||
import h from '#/h' | ||
|
||
describe('test generate virtual dom tree', () => { | ||
it('test make virtual dom tree simply', () => { | ||
const tree = h('div', {id: 'test', key: '0'}, 'test') | ||
assert.equal(tree.tagName, 'div') | ||
assert.equal(tree.children.length, 1) | ||
assert.equal(tree.children[0].text, 'test') | ||
}) | ||
|
||
it('test make virtual dom tree with children', () => { | ||
const tree = h('ul', {key: '0', id: 'test', className: 'list'}, [ | ||
h('li', {key: '1', className: 'list_item'}, h('span', {key: '2', className: 'list_item_text'}, '1')), | ||
h('li', {key: '3', className: 'list_item'}, h('span', {key: '4', className: 'list_item_text'}, '2')), | ||
h('li', {key: '5', className: 'list_item'}, h('span', {key: '6', className: 'list_item_text'}, '3')) | ||
]) | ||
assert.equal(tree.tagName, 'ul') | ||
assert.equal(tree.key, '0') | ||
assert.equal(tree.props.id, 'test') | ||
assert.equal(tree.props.className, 'list') | ||
assert.equal(tree.children.length, 3) | ||
assert.equal(tree.children[0].key, '1') | ||
assert.equal(tree.children[0].children[0].children[0].type, 'VirtualText') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './modules/h.spec' |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.