2.0.0 • Published 3 years ago

svjs-test v2.0.0

Weekly downloads
20
License
MIT
Repository
github
Last release
3 years ago

utiny

Tired of installing 25 dependencies, just to run unit tests? utiny is the essence of unit testing in JavaScript.

It allows unit testing of ES6 modules without additional dependencies, right in your browser.

Demo: http://shaack.com/projekte/utiny/test/

Works like this

  1. Create a test/index.html:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Tests</title>
</head>
<body>
<script type="module">
    import {TestMyModule} from "./TestMyModule.js"
    TestMyModule.run()
</script>
</body>
</html>
  1. Create test classes extending Test, in this case TestMyModule.js. Functions named test[…] will be executed automatically, when you call test/index.html in your Browser.
import {Test} from "../src/utiny/Test.js"

export class TestMyModule extends Test {

    testThisWillNotFail() {
        Test.assert(true)
    }

    testThisWillFail() {
        Test.assertEquals(42, 1 + 2)
    }

}

Result

The result will look like this:

Test Result

Configuration

const props = {
    htmlOutput: true, // enable HTML output
    consoleOutput: true, // enable output via console
    onyl: undefined /* 
        set as String to run one specific test only,
        set as array to run multiple specific tests in the test class,
        leave as undefined to run test[…] functions in the test class 
        */ 
}
TestMyModule.run(props)
2.0.0

3 years ago

1.3.5

6 years ago

1.3.4

6 years ago

1.3.3

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago