Run internal JsTestDriver tests and check for the expected output.

Newer versions of zope.testing have a "run_internal" function
specifically used for internal testing, where as the "run" function
does an unconditional "sys.exit()" now. So use "run_internal" if it's
available.

    >>> import os
    >>> from zope.testing import testrunner
    >>> runner = getattr(testrunner, "run_internal", testrunner.run)

    >>> defaults = [
    ...     "--path", root_directory,
    ...     "-m", "lazr.testing.tests.test_js",
    ...     "-t", "JsTestDriverSelfTest",
    ...     ]


Set JSTESTDRIVER_SELFTEST in the environment in order to enable the
self test registration:

    >>> os.environ["JSTESTDRIVER_SELFTEST"] = "1"

Run in verbose mode, so that the timings are displayed too. Progress
doesn't work very well at the moment due to JsTestDriver not reporting
test count upfront so disable it.

    >>> runner(defaults, "--no-progress -vvv".split())
    Running tests at level 1
    Running lazr.testing.jstestdriver.JsTestDriverLayer tests:
      Set up lazr.testing.jstestdriver.JsTestDriverLayer in N.NNN seconds.
      Running:
     testAssertFalse:BrowserN.N.N.N (ErrorInlineTestCase) (N.NNN s)
    <BLANKLINE>
    <BLANKLINE>
    Error in test testAssertFalse:BrowserN.N.N.N (ErrorInlineTestCase)
    Traceback (most recent call last):
    ...
    JsTestDriverError: y is not defined
    <BLANKLINE>
     testAssertNull:BrowserN.N.N.N (ErrorInlineTestCase) (N.NNN s)
    <BLANKLINE>
    <BLANKLINE>
    Error in test testAssertNull:BrowserN.N.N.N (ErrorInlineTestCase)
    Traceback (most recent call last):
    ...
    JsTestDriverError: y is not defined
    <BLANKLINE>
     testThrowAFit:BrowserN.N.N.N (ErrorInlineTestCase) (N.NNN s)
    <BLANKLINE>
    <BLANKLINE>
    Error in test testThrowAFit:BrowserN.N.N.N (ErrorInlineTestCase)
    Traceback (most recent call last):
    ...
    JsTestDriverError: "A Fit"
    <BLANKLINE>
     testThrowAnError:BrowserN.N.N.N (ErrorInlineTestCase) (N.NNN s)
    <BLANKLINE>
    <BLANKLINE>
    Error in test testThrowAnError:BrowserN.N.N.N (ErrorInlineTestCase)
    Traceback (most recent call last):
    ...
    JsTestDriverError: Some Messy Message
    <BLANKLINE>
     testAssertEquals:BrowserN.N.N.N (ErrorTestCase) (N.NNN s)
    <BLANKLINE>
    <BLANKLINE>
    Error in test testAssertEquals:BrowserN.N.N.N (ErrorTestCase)
    Traceback (most recent call last):
    ...
    JsTestDriverError: y is not defined
    <BLANKLINE>
     testAssertTrue:BrowserN.N.N.N (ErrorTestCase) (N.NNN s)
    <BLANKLINE>
    <BLANKLINE>
    Error in test testAssertTrue:BrowserN.N.N.N (ErrorTestCase)
    Traceback (most recent call last):
    ...
    JsTestDriverError: y is not defined
    <BLANKLINE>
     testAssertFalse:BrowserN.N.N.N (FailureInlineTestCase) (N.NNN s)
    <BLANKLINE>
    <BLANKLINE>
    Failure in test testAssertFalse:BrowserN.N.N.N (FailureInlineTestCase)
    Traceback (most recent call last):
    ...
    JsTestDriverFailure: Not false? Are you kidding me? expected false but was true
    <BLANKLINE>
     testAssertNull:BrowserN.N.N.N (FailureInlineTestCase) (N.NNN s)
    <BLANKLINE>
    <BLANKLINE>
    Failure in test testAssertNull:BrowserN.N.N.N (FailureInlineTestCase)
    Traceback (most recent call last):
    ...
    JsTestDriverFailure: I was pretty sure it was null. expected null but was {}
    <BLANKLINE>
     testAssertEquals:BrowserN.N.N.N (FailureTestCase) (N.NNN s)
    <BLANKLINE>
    <BLANKLINE>
    Failure in test testAssertEquals:BrowserN.N.N.N (FailureTestCase)
    Traceback (most recent call last):
    ...
    JsTestDriverFailure: expected "Hello" but was "World!"
    <BLANKLINE>
     testAssertTrue:BrowserN.N.N.N (FailureTestCase) (N.NNN s)
    <BLANKLINE>
    <BLANKLINE>
    Failure in test testAssertTrue:BrowserN.N.N.N (FailureTestCase)
    Traceback (most recent call last):
    ...
    JsTestDriverFailure: How can that possibly be false? expected true but was false
    <BLANKLINE>
     testAssertFalse:BrowserN.N.N.N (SuccessInlineTestCase) (N.NNN s)
     testAssertNull:BrowserN.N.N.N (SuccessInlineTestCase) (N.NNN s)
     testAssertEquals:BrowserN.N.N.N (SuccessTestCase) (N.NNN s)
     testAssertTrue:BrowserN.N.N.N (SuccessTestCase) (N.NNN s)
      Ran 14 tests with 4 failures and 6 errors in N.NNN seconds.
    Tearing down left over layers:
      Tear down lazr.testing.jstestdriver.JsTestDriverLayer in N.NNN seconds.
    <BLANKLINE>
    Tests with errors:
       testAssertFalse:BrowserN.N.N.N (ErrorInlineTestCase)
       testAssertNull:BrowserN.N.N.N (ErrorInlineTestCase)
       testThrowAFit:BrowserN.N.N.N (ErrorInlineTestCase)
       testThrowAnError:BrowserN.N.N.N (ErrorInlineTestCase)
       testAssertEquals:BrowserN.N.N.N (ErrorTestCase)
       testAssertTrue:BrowserN.N.N.N (ErrorTestCase)
    <BLANKLINE>
    Tests with failures:
       testAssertFalse:BrowserN.N.N.N (FailureInlineTestCase)
       testAssertNull:BrowserN.N.N.N (FailureInlineTestCase)
       testAssertEquals:BrowserN.N.N.N (FailureTestCase)
       testAssertTrue:BrowserN.N.N.N (FailureTestCase)
    True

    >>> del os.environ["JSTESTDRIVER_SELFTEST"]
