1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 23:34:47 -05:00
denoland-deno/tools/unit_tests.py
Bartek Iwańczuk 43c6c1a9f5 Refactor test infrastructure (#2432)
* use subclass of unittest.TestCase for all test cases

* allow to run single test file (eg. python tools/integration_tests.py)

* test filtering (via --pattern/-p CLI flag)

* use common CLI parser for all tests:
  usage: test.py [-h] [--failfast] [--verbose] [--executable EXECUTABLE]
               [--release] [--pattern PATTERN] [--build-dir BUILD_DIR]

  optional arguments:
  -h, --help            show this help message and exit
  --failfast, -f        Stop on first failure
  --verbose, -v         Verbose output
  --executable EXECUTABLE
                        Use external executable of Deno
  --release             Test against release executable
  --pattern PATTERN, -p PATTERN
                        Run tests that match provided pattern
  --build-dir BUILD_DIR
                        Deno build directory

* respect NO_COLOR variable
2019-06-03 12:35:55 -04:00

28 lines
778 B
Python
Executable file

#!/usr/bin/env python
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import sys
import subprocess
import http_server
from test_util import DenoTestCase, run_tests
class JsUnitTests(DenoTestCase):
def test_unit_test_runner(self):
cmd = [
self.deno_exe, "run", "--reload", "--allow-run",
"js/unit_test_runner.ts"
]
process = subprocess.Popen(
cmd, bufsize=1, universal_newlines=True, stderr=subprocess.STDOUT)
process.wait()
errcode = process.returncode
if errcode != 0:
raise AssertionError(
"js/unit_test_runner.ts exited with exit code %s" % errcode)
if __name__ == '__main__':
with http_server.spawn():
run_tests()