Add the old test suite to the grunt task for both local tests and CI

This relies on a hack to bypass the `mocha` detection by `grunt-mocha-phantomjs`.
The tests have to run in less than 10 seconds, which is unlikely to be problematic on current
hardware.

Alternatively, adding the following to tests/index.html also makes the old test suite compatible
with the mocha runner, but it entails loading `mocha`:

    <script src="../node_modules/mocha/mocha.js"></script>
    <script>
        mocha.setup("bdd")
        describe("dummy test", function(){
            it("is a dummy test to run the old test suite with grunt-mocha-phantomjs like the new one", function(){})
        })
        mocha.run()
    </script>
This commit is contained in:
Pierre-Yves Gerardy 2016-09-11 16:21:45 +02:00
parent 6ab9570474
commit aeb5f05706
2 changed files with 7 additions and 1 deletions

View file

@ -95,7 +95,7 @@ module.exports = function (grunt) { // eslint-disable-line
mocha_phantomjs: { // eslint-disable-line camelcase mocha_phantomjs: { // eslint-disable-line camelcase
test: { test: {
src: ["test/index.html"], src: ["test/index.html", "tests/index.html"],
options: { options: {
reporter: "dot" reporter: "dot"
} }

View file

@ -4,5 +4,11 @@
<script src="mock.js"></script> <script src="mock.js"></script>
<script src="../mithril.js"></script> <script src="../mithril.js"></script>
<script src="mithril-tests.js"></script> <script src="mithril-tests.js"></script>
<script>
// shim for running the old test suite with grunt-mocha-phantomjs like the new one
if ('callPhantom' in window) {
window.callPhantom({ testRunEnded: 1})
}
</script>
<p>Open the console to see the test report</p> <p>Open the console to see the test report</p>