summaryrefslogtreecommitdiff
path: root/tools/test.py
blob: b8647134215452bb6ebb4d8b8f390de655dda402 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/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 TestFetch
from fmt_test import TestFmt
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, 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,
        TestFetch,
        TestIntegrations,
        TestRepl,
        TestDenoDir,
        TestBenchmark,
        TestIsTty,
        # It is very slow, so do TestFmt at the end.
        TestFmt,
    ]
    test_cases += permission_prompt_tests()
    test_cases += complex_permissions_tests()

    with http_server.spawn():
        run_tests(test_cases)


if __name__ == '__main__':
    main()