1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-14 16:33:45 -05:00
denoland-deno/tools/test.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

59 lines
1.6 KiB
Python
Executable file

#!/usr/bin/env python
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
# Runs the full test suite.
# Usage: ./tools/test.py out/Debug
import os
from benchmark_test import TestBenchmark
from deno_dir_test import TestDenoDir
from fetch_test import FetchTest
from fmt_test import FmtTest
from integration_tests import TestIntegrations
from repl_test import TestRepl
from setup_test import TestSetup
from target_test import TestTarget
from unit_tests import JsUnitTests
from util_test import TestUtil
# NOTE: These tests are skipped on Windows
from is_tty_test import TestIsTty
from permission_prompt_test import permission_prompt_tests
from complex_permissions_test import complex_permissions_tests
import http_server
from util import (enable_ansi_colors, build_path, RESET, FG_RED, FG_GREEN,
executable_suffix, run, run_output, rmtree, tests_path)
from test_util import parse_test_args, run_tests
def main():
args = parse_test_args()
deno_dir = os.path.join(args.build_dir, ".deno_test")
if os.path.isdir(deno_dir):
rmtree(deno_dir)
os.environ["DENO_DIR"] = deno_dir
enable_ansi_colors()
test_cases = [
TestSetup,
TestUtil,
TestTarget,
JsUnitTests,
FetchTest,
FmtTest,
TestIntegrations,
TestRepl,
TestDenoDir,
TestBenchmark,
TestIsTty,
]
test_cases += permission_prompt_tests()
test_cases += complex_permissions_tests()
with http_server.spawn():
run_tests(test_cases)
if __name__ == '__main__':
main()