~holger-seelig/cobweb.js/trunk

« back to all changes in this revision

Viewing changes to cobweb.js/lib/pako/test/browser/test.html

  • Committer: Holger Seelig
  • Date: 2017-08-22 04:53:24 UTC
  • Revision ID: holger.seelig@yahoo.de-20170822045324-4of4xxgt79669gbt
Switched to npm.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<html>
2
 
  <head>
3
 
    <title>pako tests</title>
4
 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
 
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
 
    <link rel="stylesheet" href="../../node_modules/mocha/mocha.css" />
7
 
    <script src="../../node_modules/mocha/mocha.js"></script>
8
 
    <script>
9
 
      mocha.setup('bdd');
10
 
      mocha.suite.timeout(30000);
11
 
    </script>
12
 
    <script>
13
 
      function assert(expr, msg) {
14
 
        if (!expr) throw new Error(msg || 'failed');
15
 
      }
16
 
    </script>
17
 
    <script>
18
 
      function assert(expr, msg) {
19
 
        if (!expr) throw new Error(msg || 'failed');
20
 
      }
21
 
    </script>
22
 
    <script src="./pako.js"></script>
23
 
    <script src="./test.js"></script>
24
 
    <script>
25
 
     onload = function(){
26
 
        var runner = mocha.run();
27
 
 
28
 
        var failedTests = [];
29
 
        runner.on('end', function(){
30
 
          window.mochaResults = runner.stats;
31
 
          window.mochaResults.reports = failedTests;
32
 
        });
33
 
 
34
 
        runner.on('fail', logFailure);
35
 
 
36
 
        function logFailure(test, err){
37
 
 
38
 
          var flattenTitles = function(test){
39
 
            var titles = [];
40
 
            while (test.parent.title){
41
 
              titles.push(test.parent.title);
42
 
              test = test.parent;
43
 
            }
44
 
            return titles.reverse();
45
 
          };
46
 
 
47
 
          failedTests.push({name: test.title, result: false, message: err.message, stack: err.stack, titles: flattenTitles(test) });
48
 
        };
49
 
      };
50
 
    </script>
51
 
  </head>
52
 
  <body>
53
 
    <div id="mocha"></div>
54
 
  </body>
55
 
</html>
56