Add the ability to run tests via the webpack devserver
This commit is contained in:
parent
65246d0041
commit
7eb6a17fd2
@ -28,7 +28,6 @@ const $iq = strophe.default.$iq;
|
||||
const $msg = strophe.default.$msg;
|
||||
const $pres = strophe.default.$pres;
|
||||
|
||||
|
||||
dayjs.extend(advancedFormat);
|
||||
|
||||
// Add Strophe Namespaces
|
||||
|
33
tests.html
Normal file
33
tests.html
Normal file
@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Converse.js</title>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Converse.js: A free chat client for your website" />
|
||||
<script src="3rdparty/libsignal-protocol.js"></script>
|
||||
<link rel="manifest" href="./manifest.json">
|
||||
<link rel="shortcut icon" type="image/ico" href="favicon.ico"/>
|
||||
<link rel="shortcut icon" type="image/png" href="node_modules/jasmine-core/images/jasmine_favicon.png">
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="node_modules/jasmine-core/lib/jasmine-core/jasmine.css">
|
||||
<script data-main="tests/runner" src="../node_modules/requirejs/require.js"></script>
|
||||
<style>
|
||||
.tests-brand-heading {
|
||||
margin-top: 1em;
|
||||
font-size: 200%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="reset"></body>
|
||||
<div id="header_wrap" class="outer">
|
||||
<header class="inner">
|
||||
<h1 class="brand-heading tests-brand-heading">
|
||||
<i class="icon-conversejs"></i> Converse</h1>
|
||||
<h2 id="project_tagline">Tests</h2>
|
||||
</header>
|
||||
</div>
|
||||
<script>
|
||||
converse.load();
|
||||
</script>
|
||||
</html>
|
@ -25,5 +25,6 @@
|
||||
<h2 id="project_tagline">Tests</h2>
|
||||
</header>
|
||||
</div>
|
||||
<script>converse.load();</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,9 +1,6 @@
|
||||
(function (root, factory) {
|
||||
define("mock", [], factory);
|
||||
}(this, function () {
|
||||
|
||||
converse.load();
|
||||
|
||||
const _ = converse.env._;
|
||||
const u = converse.env.utils;
|
||||
const Promise = converse.env.Promise;
|
||||
|
@ -70,16 +70,25 @@ var specs = [
|
||||
"spec/xss"
|
||||
];
|
||||
|
||||
require(['console-reporter', 'mock', 'sinon'], (ConsoleReporter, mock, sinon) => {
|
||||
if (window.view_mode) {
|
||||
mock.view_mode = window.view_mode;
|
||||
}
|
||||
window.sinon = sinon;
|
||||
// Load the specs
|
||||
require(specs, jasmine => {
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 7000;
|
||||
const jasmineEnv = jasmine.getEnv();
|
||||
jasmineEnv.addReporter(new ConsoleReporter());
|
||||
window.onload();
|
||||
|
||||
function load () {
|
||||
require(['console-reporter', 'mock', 'sinon'], (ConsoleReporter, mock, sinon) => {
|
||||
if (window.view_mode) {
|
||||
mock.view_mode = window.view_mode;
|
||||
}
|
||||
window.sinon = sinon;
|
||||
// Load the specs
|
||||
require(specs, jasmine => {
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 7000;
|
||||
const jasmineEnv = jasmine.getEnv();
|
||||
jasmineEnv.addReporter(new ConsoleReporter());
|
||||
window.onload();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (window.converse) {
|
||||
load();
|
||||
} else {
|
||||
window.addEventListener('converse-loaded', load);
|
||||
}
|
||||
|
@ -13,6 +13,11 @@ module.exports = merge(common, {
|
||||
new HTMLWebpackPlugin({
|
||||
title: 'Converse.js Dev',
|
||||
template: 'webpack.html'
|
||||
}),
|
||||
new HTMLWebpackPlugin({
|
||||
filename: 'tests.html',
|
||||
title: 'Converse.js Tests',
|
||||
template: 'tests.html'
|
||||
})
|
||||
],
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user