Some basic tests for MessagePanel
Check that it puts the read marker in the right place, and check that the animation works. ... all of which has been surprisingly painful.
This commit is contained in:
parent
d2e69c819f
commit
dc5c0928b2
7 changed files with 722 additions and 27 deletions
|
@ -1,6 +1,5 @@
|
|||
// karma.conf.js - the config file for karma, which runs our tests.
|
||||
|
||||
var webpack = require('webpack');
|
||||
var path = require('path');
|
||||
|
||||
/*
|
||||
|
@ -8,6 +7,10 @@ var path = require('path');
|
|||
* to build everything; however it's the easiest way to load our dependencies
|
||||
* from node_modules.
|
||||
*
|
||||
* If you run karma in multi-run mode (with `npm run test-multi`), it will watch
|
||||
* the tests for changes, and webpack will rebuild using a cache. This is much quicker
|
||||
* than a clean rebuild.
|
||||
*
|
||||
* TODO:
|
||||
* - can we run one test at a time?
|
||||
*/
|
||||
|
@ -26,11 +29,18 @@ module.exports = function (config) {
|
|||
],
|
||||
|
||||
// list of files to exclude
|
||||
// (this doesn't work, and I don't know why - we still rerun the tests
|
||||
// when lockfiles are created)
|
||||
exclude: [
|
||||
'**/.#*'
|
||||
],
|
||||
//
|
||||
// This doesn't work. It turns out that it's webpack which does the
|
||||
// watching of the /test directory (possibly karma only watches
|
||||
// tests.js itself). Webpack watches the directory so that it can spot
|
||||
// new tests, which is fair enough; unfortunately it triggers a rebuild
|
||||
// every time a lockfile is created in that directory, and there
|
||||
// doesn't seem to be any way to tell webpack to ignore particular
|
||||
// files in a watched directory.
|
||||
//
|
||||
// exclude: [
|
||||
// '**/.#*'
|
||||
// ],
|
||||
|
||||
// preprocess matching files before serving them to the browser
|
||||
// available preprocessors:
|
||||
|
@ -83,13 +93,6 @@ module.exports = function (config) {
|
|||
module: {
|
||||
loaders: [
|
||||
{ test: /\.json$/, loader: "json" },
|
||||
{
|
||||
// disable 'require' and 'define' for sinon, per
|
||||
// https://github.com/webpack/webpack/issues/304#issuecomment-170883329
|
||||
test: /sinon\/pkg\/sinon\.js/,
|
||||
// TODO: use 'query'?
|
||||
loader: 'imports?define=>false,require=>false',
|
||||
},
|
||||
{
|
||||
test: /\.js$/, loader: "babel",
|
||||
include: [path.resolve('./src'),
|
||||
|
@ -107,6 +110,11 @@ module.exports = function (config) {
|
|||
// there is no need for webpack to parse them - they can
|
||||
// just be included as-is.
|
||||
/highlight\.js\/lib\/languages/,
|
||||
|
||||
// also disable parsing for sinon, because it
|
||||
// tries to do voodoo with 'require' which upsets
|
||||
// webpack (https://github.com/webpack/webpack/issues/304)
|
||||
/sinon\/pkg\/sinon\.js$/,
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
|
@ -114,6 +122,10 @@ module.exports = function (config) {
|
|||
'matrix-react-sdk': path.resolve('src/index.js'),
|
||||
'sinon': 'sinon/pkg/sinon.js',
|
||||
},
|
||||
root: [
|
||||
path.resolve('./src'),
|
||||
path.resolve('./test'),
|
||||
],
|
||||
},
|
||||
devtool: 'inline-source-map',
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue