This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

svjs-test

2.0.0 • Public • Published

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)

Package Sidebar

Install

npm i svjs-test

Weekly Downloads

5

Version

2.0.0

License

MIT

Unpacked Size

7.34 kB

Total Files

7

Last publish

Collaborators

  • shaack