Completed
Pull Request — master (#27)
by
unknown
53s
created

testsuite.js (3 issues)

1
/*
2
 Javascript Object                               ______  ________________
3
 Inheritance Implementation                  __ / / __ \/  _/  _/\_____  \
4
                                            / // / /_/ // /_/ /    _(__  <
5
 Copyright 2014, Harold Iedema.             \___/\____/___/___/   /       \
6
 --------------------------------------------------------------- /______  / ---
7
 Permission is hereby granted, free of charge, to any person obtaining  \/
8
 a copy of this software and associated documentation files (the
9
 "Software"), to deal in the Software without restriction, including
10
 without limitation the rights to use, copy, modify, merge, publish,
11
 distribute, sublicense, and/or sell copies of the Software, and to
12
 permit persons to whom the Software is furnished to do so, subject to
13
 the following conditions:
14
15
 The above copyright notice and this permission notice shall be
16
 included in all copies or substantial portions of the Software.
17
18
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
 ------------------------------------------------------------------------------
26
*/
27
28
/**
29
 * TestSuite Definition
30
 */
31
var testsuite = {
32
    code: './dist/joii.js',
33
    tests: [
34
        // PrototypeBuilder
35
        "./test/PrototypeBuilder/DeepCopyTest.js",
36
        "./test/PrototypeBuilder/InheritanceTest.js",
37
        "./test/PrototypeBuilder/PropertyMetaTest.js",
38
        "./test/PrototypeBuilder/TraitTest.js",
39
        // ClassBuilder
40
        "./test/ClassBuilder/InstantiationTest.js",
41
        "./test/ClassBuilder/InheritanceTest.js",
42
        "./test/ClassBuilder/AbstractImplementationTest.js",
43
        "./test/ClassBuilder/VisibilityTest.js",
44
        "./test/ClassBuilder/GetterTest.js",
45
        "./test/ClassBuilder/SetterValidationTest.js",
46
        "./test/ClassBuilder/NullableTypeTest.js",
47
        "./test/ClassBuilder/TypeValidationTest.js",
48
        "./test/ClassBuilder/InstanceOfTest.js",
49
        "./test/ClassBuilder/CallTest.js",
50
        "./test/ClassBuilder/ConstantTest.js",
51
        "./test/ClassBuilder/SerializeTest.js",
52
        "./test/ClassBuilder/FunctionOverloadingTests.js",
53
        // InterfaceBuilder,
54
        "./test/InterfaceBuilder/InterfaceBuilderTest.js",
55
        "./test/InterfaceBuilder/InterfaceValidationTest.js",
56
        // EnumBuilder
57
        "./test/EnumBuilder/EnumBuilderTest.js",
58
        // Reflection
59
        "./test/Reflection/ReflectionTest.js",
60
        // GitHub Reported Issues
61
        "./test/IssueReports/IssueReport4.js",
62
        "./test/IssueReports/IssueReport9.js",
63
        "./test/IssueReports/IssueReport10.js",
64
        "./test/IssueReports/IssueReport11.js",
65
        "./test/IssueReports/IssueReport15.js",
66
        "./test/IssueReports/IssueReport16.js",
67
        "./test/IssueReports/IssueReport19.js",
68
        "./test/IssueReports/IssueReport21.js",
69
        "./test/IssueReports/IssueReport25.js"
70
    ]
71
};
72
73
/**
74
 * Platform-independent bootstrap.
75
 */
76
if (typeof(window) === 'undefined') {
77
    // Are we running on CLI / NodeJS ?
78
    var qunit = require("qunit");
79
    qunit.run(testsuite);
80
} else {
81
    // We're running a browser.
82
    var addScript = function(file) {
83
        var s = document.createElement('script');
84
        s.setAttribute('type', 'text/javascript');
85
        s.setAttribute('src', file);
86
        document.getElementsByTagName('head')[0].appendChild(s);
87
    };
88
    addScript(testsuite.code);
89
    for (var i in testsuite.tests) {
90
        addScript(testsuite.tests[i]);
91
    }
92
93
    // Add a 'shim' for require, as test cases use it to import JOII.
94
    // When running in a browser however, JOII is exposed to the window object.
95
    function require() { return window; }
0 ignored issues
show
It is not recommended to place function declarations in blocks.

Although, declaring functions inside blocks will not necessarily lead to runtime errors, the code might not behave as you expect it as declarations are automatically declared in the top-most scope (see ECMAScript specification).

For code such as:

function someFunction() {
    function anotherFunction() { }
}

it is recommended to make one of these two fixes:

1. Move Function Declaration outside of the block

function someFunction() { }
function anotherFunction() { }

2. Use a Function Expression

function someFunction() {
    var anotherFunction = function() { };
}
Loading history...
'require' was used before it was defined.
Loading history...
This function should enable strict mode with use strict.

Strict mode is a way to opt-in to a restricted variant of JavaScript. It eliminates some common pitfalls by being less lenient and raising more errors.

Besides, it is also used to fix certain mistakes which made it difficult for JavaScript runtimes to perform certain optimizations.

We generally recommend to only enable strict mode on the function scope and not in the global scope as that might break third-party scripts on your website.

Loading history...
96
}
97