def run_tests(chrome_binary, target, no_text_coverage, coverage):
    cwd = devtools_paths.devtools_root_path()
    karmaconfig_path = os.path.join(cwd, 'out', target, 'gen', 'test',
                                    'unittests', 'front_end', 'karma.conf.js')

    if not os.path.exists(karmaconfig_path):
        print('Unable to find Karma config at ' + karmaconfig_path)
        print(
            'Make sure to set the --ninja-build-name argument to the folder name of "out/target"'
        )
        sys.exit(1)

    print('Using karma config ' + karmaconfig_path)

    exec_command = [
        devtools_paths.node_path(),
        devtools_paths.karma_path(), 'start',
        test_helpers.to_platform_path_exact(karmaconfig_path)
    ]

    env = os.environ.copy()
    env['NODE_PATH'] = devtools_paths.node_path()
    if (no_text_coverage is not False):
        env['NO_TEXT_COVERAGE'] = '1'
    if (coverage is True):
        env['COVERAGE'] = '1'
    if (chrome_binary is not None):
        env['CHROME_BIN'] = chrome_binary

    exit_code = test_helpers.popen(exec_command, cwd=cwd, env=env)
    if exit_code == 1:
        return True

    return False
Beispiel #2
0
def compile_typescript_test_files():
    tsc_compile_errors_found = False
    cwd = devtools_paths.devtools_root_path()
    env = os.environ.copy()
    shared_path = os.path.join(cwd, 'test/shared')
    e2e_test_path = os.path.join(cwd, 'test/e2e')

    # Compile shared code, e.g. helper and runner.
    print("Compiling shared TypeScript")
    exec_command = [
        devtools_paths.node_path(),
        devtools_paths.typescript_compiler_path(), '-p', shared_path
    ]
    tsc_compile_proc = popen(exec_command, cwd=cwd, env=env, capture=True)
    tsc_compile_proc.communicate()
    if tsc_compile_proc.returncode != 0:
        tsc_compile_errors_found = True

    # Compile e2e tests, e.g. helper and runner.
    print("Compiling e2e TypeScript")
    exec_command = [
        devtools_paths.node_path(),
        devtools_paths.typescript_compiler_path(), '-p', e2e_test_path
    ]
    tsc_compile_proc = popen(exec_command, cwd=cwd, env=env, capture=True)
    tsc_compile_proc.communicate()
    if tsc_compile_proc.returncode != 0:
        tsc_compile_errors_found = True

    return tsc_compile_errors_found
def run_tests(chrome_binary, chrome_features, test_suite, test_suite_list_path, test_file=None):
    env = os.environ.copy()
    env['CHROME_BIN'] = chrome_binary
    env['TEST_LIST'] = test_suite_list_path
    if chrome_features:
        env['CHROME_FEATURES'] = chrome_features

    if test_file is not None:
        env['TEST_FILE'] = test_file

    cwd = devtools_paths.devtools_root_path()
    if test_suite == 'e2e':
        exec_command = [
            devtools_paths.node_path(),
            devtools_paths.mocha_path(),
            '--config',
            E2E_MOCHA_CONFIGURATION_LOCATION,
        ]
    else:
        runner_path = os.path.join(cwd, 'test', 'shared', 'runner.js')
        exec_command = [devtools_paths.node_path(), runner_path]

    exit_code = test_helpers.popen(exec_command, cwd=cwd, env=env)
    if exit_code != 0:
        return True

    return False
def _checkWithNodeScript(input_api,
                         output_api,
                         script_path,
                         script_arguments=None):  # pylint: disable=invalid-name
    original_sys_path = sys.path
    try:
        sys.path = sys.path + [
            input_api.os_path.join(input_api.PresubmitLocalPath(), 'scripts')
        ]
        import devtools_paths
    finally:
        sys.path = original_sys_path

    node_path = devtools_paths.node_path()

    if script_arguments is None:
        script_arguments = []

    process = input_api.subprocess.Popen([node_path, script_path] +
                                         script_arguments,
                                         stdout=input_api.subprocess.PIPE,
                                         stderr=input_api.subprocess.STDOUT)
    out, _ = process.communicate()

    if process.returncode != 0:
        return [output_api.PresubmitError(out)]
    return [output_api.PresubmitNotifyResult(out)]
    def _rollup_module(self, module_name, modules, skip_rollup):
        legacyFileName = module_name + '-legacy.js'
        if legacyFileName in modules:
            write_file(
                join(self.output_dir, module_name, legacyFileName),
                minify_js(
                    read_file(
                        join(self.application_dir, module_name,
                             legacyFileName))))

        # Temporary hack, as we use `devtools_entrypoint` for this module now
        # TODO(crbug.com/1101738): remove once all folders are migrated
        if skip_rollup:
            return

        js_entrypoint = join(self.application_dir, module_name,
                             module_name + '.js')
        out = ''
        if self.use_rollup:
            rollup_process = subprocess.Popen([
                devtools_paths.node_path(),
                devtools_paths.rollup_path(), '--config',
                join(FRONT_END_DIRECTORY, 'rollup.config.js'), '--input',
                js_entrypoint
            ],
                                              stdout=subprocess.PIPE,
                                              stderr=subprocess.PIPE)
            out, error = rollup_process.communicate()
            if rollup_process.returncode != 0:
                print(error)
                sys.exit(rollup_process.returncode)
        else:
            out = read_file(js_entrypoint)
        write_file(join(self.output_dir, module_name, module_name + '.js'),
                   minify_js(out))
Beispiel #6
0
    def _rollup_module(self, module_name, modules):
        js_entrypoint = join(self.application_dir, module_name,
                             module_name + '.js')
        out = ''
        if self.use_rollup:
            rollup_process = subprocess.Popen([
                devtools_paths.node_path(),
                devtools_paths.rollup_path(), '--config',
                join(FRONT_END_DIRECTORY, 'rollup.config.js'), '--input',
                js_entrypoint, '--external', EXTERNAL_MODULE_LIST
            ],
                                              stdout=subprocess.PIPE,
                                              stderr=subprocess.PIPE)
            out, error = rollup_process.communicate()
            if rollup_process.returncode != 0:
                print(error)
                sys.exit(rollup_process.returncode)
        else:
            out = read_file(js_entrypoint)
        write_file(join(self.output_dir, module_name, module_name + '.js'),
                   minify_js(out))

        legacyFileName = module_name + '-legacy.js'
        if legacyFileName in modules:
            write_file(
                join(self.output_dir, module_name, legacyFileName),
                minify_js(
                    read_file(
                        join(self.application_dir, module_name,
                             legacyFileName))))
    def _rollup_module(self, module_name, modules):
        js_entrypoint = join(self.application_dir, module_name,
                             module_name + '.js')
        out = ''
        if self.use_rollup:
            rollup_process = subprocess.Popen(
                [devtools_paths.node_path(),
                 devtools_paths.rollup_path()] + ROLLUP_ARGS +
                ['--input', js_entrypoint],
                stdout=subprocess.PIPE,
                stderr=subprocess.PIPE)
            out, error = rollup_process.communicate()
        else:
            out = read_file(js_entrypoint)
        write_file(join(self.output_dir, module_name, module_name + '.js'),
                   minify_js(out))

        legacyFileName = module_name + '-legacy.js'
        if legacyFileName in modules:
            write_file(
                join(self.output_dir, module_name, legacyFileName),
                minify_js(
                    read_file(
                        join(self.application_dir, module_name,
                             legacyFileName))))
Beispiel #8
0
def _checkWithTypeScript(input_api,
                         output_api,
                         tsc_arguments,
                         script_path,
                         script_arguments=[]):  # pylint: disable=invalid-name
    original_sys_path = sys.path
    try:
        sys.path = sys.path + [
            input_api.os_path.join(input_api.PresubmitLocalPath(), 'scripts')
        ]
        import devtools_paths
    finally:
        sys.path = original_sys_path

    # First run tsc to compile the TS script that we then run in the _ExecuteSubProcess call
    tsc_compiler_process = input_api.subprocess.Popen(
        [
            devtools_paths.node_path(),
            devtools_paths.typescript_compiler_path()
        ] + tsc_arguments,
        stdout=input_api.subprocess.PIPE,
        stderr=input_api.subprocess.STDOUT)

    out, _ = tsc_compiler_process.communicate()
    if tsc_compiler_process.returncode != 0:
        return [
            output_api.PresubmitError('Error compiling briges regenerator:\n' +
                                      str(out))
        ]

    return _checkWithNodeScript(input_api, output_api, script_path,
                                script_arguments)
Beispiel #9
0
def js_lint(files_list=None):
    eslint_errors_found = False

    if files_list is None:
        files_list = [devtools_frontend_path]
    files_list = [
        file_name for file_name in files_list
        if not file_name.endswith('.eslintrc.js')
    ]

    eslintconfig_path = path.join(devtools_path, '.eslintrc.js')
    eslintignore_path = path.join(devtools_path, '.eslintignore')
    exec_command = [
        devtools_paths.node_path(),
        devtools_paths.eslint_path(),
        '--config',
        to_platform_path_exact(eslintconfig_path),
        '--ignore-path',
        to_platform_path_exact(eslintignore_path),
        '--fix',
    ] + files_list

    eslint_proc = popen(exec_command, cwd=devtools_path)
    (eslint_proc_out, _) = eslint_proc.communicate()
    if eslint_proc.returncode != 0:
        eslint_errors_found = True
    else:
        print('eslint exited successfully')

    print(eslint_proc_out)
    return eslint_errors_found
Beispiel #10
0
def run_tests(chrome_binary,
              chrome_features,
              test_suite_path,
              test_suite,
              jobs,
              server,
              test_file=None):
    env = os.environ.copy()
    env['CHROME_BIN'] = chrome_binary
    if chrome_features:
        env['CHROME_FEATURES'] = chrome_features

    if test_file is not None:
        env['TEST_FILE'] = test_file

    if jobs:
        env['JOBS'] = jobs

    env['SERVER'] = server
    cwd = devtools_paths.devtools_root_path()
    exec_command = [
        devtools_paths.node_path(),
        devtools_paths.mocha_path(),
        '--config',
        os.path.join(test_suite_path, '.mocharc.js'),
    ]

    exit_code = test_helpers.popen(exec_command, cwd=cwd, env=env)
    if exit_code != 0:
        return True

    return False
Beispiel #11
0
def main():
    eslintconfig_path = path.join(ROOT_DIRECTORY, '.eslintrc.js')
    scripts_eslintconfig_path = path.join(ROOT_DIRECTORY, 'scripts',
                                          '.eslintrc.js')
    eslintignore_path = path.join(ROOT_DIRECTORY, '.eslintignore')

    directories_or_files_to_lint = sys.argv[1:]

    if len(directories_or_files_to_lint) == 0:
        directories_or_files_to_lint = DEFAULT_DIRECTORIES_TO_LINT

    exec_command = [
        devtools_paths.node_path(),
        devtools_paths.eslint_path(),
        '--config',
        test_helpers.to_platform_path_exact(eslintconfig_path),
        '--config',
        test_helpers.to_platform_path_exact(scripts_eslintconfig_path),
        '--ignore-path',
        test_helpers.to_platform_path_exact(eslintignore_path),
        '--ext',
        '.js,.ts',
        '--fix',
    ] + directories_or_files_to_lint

    eslint_proc = Popen(exec_command, cwd=ROOT_DIRECTORY)
    eslint_proc.communicate()

    sys.exit(eslint_proc.returncode)
def ensure_licenses():
    cmd = [
        devtools_paths.node_path(),
        devtools_paths.license_checker_path(), '--onlyAllow',
        ('%s' % (';'.join(LICENSES)))
    ]

    return exec_command(cmd)
def _checkWithNodeScript(input_api, output_api, script_path, script_arguments=[]):  # pylint: disable=invalid-name
    original_sys_path = sys.path
    try:
        sys.path = sys.path + [input_api.os_path.join(input_api.PresubmitLocalPath(), 'scripts')]
        import devtools_paths
    finally:
        sys.path = original_sys_path

    return _ExecuteSubProcess(input_api, output_api, [devtools_paths.node_path(), script_path], script_arguments, [])
def compile_typescript(typescript_targets):
    for target in typescript_targets:
        print("Compiling %s TypeScript" % (target['name']))
        exec_command = [devtools_paths.node_path(), devtools_paths.typescript_compiler_path(), '-p', target['path']]
        exit_code = test_helpers.popen(exec_command)
        if exit_code != 0:
            return True

    return False
def run_dark_mode_generator(file_path):
    chrome_binary = devtools_paths.downloaded_chrome_binary_path()

    exec_command = [
        devtools_paths.node_path(),
        'scripts/dark_mode/generate_dark_theme_sheet.js', chrome_binary,
        file_path
    ]
    process = subprocess.Popen(exec_command)
    process.communicate()
def main():
    exec_command = [
        devtools_paths.node_path(),
        path.join(CURRENT_DIRECTORY, 'run_lint_check_js.js'),
    ]

    eslint_proc = Popen(exec_command, cwd=ROOT_DIRECTORY)
    eslint_proc.communicate()

    sys.exit(eslint_proc.returncode)
Beispiel #17
0
def run_tests(chrome_binary):
    cwd = devtools_paths.devtools_root_path()
    karmaconfig_path = os.path.join(cwd, 'karma.conf.js')

    exec_command = [
        devtools_paths.node_path(),
        devtools_paths.karma_path(), 'start',
        test_helpers.to_platform_path_exact(karmaconfig_path)
    ]

    env = os.environ.copy()
    env['NODE_PATH'] = devtools_paths.node_path()
    if (chrome_binary is not None):
        env['CHROME_BIN'] = chrome_binary

    exit_code = test_helpers.popen(exec_command, cwd=cwd, env=env)
    if exit_code == 1:
        return True

    return False
Beispiel #18
0
def run_tests(chrome_binary, target, no_text_coverage, no_html_coverage,
              coverage, expanded_reporting, cwd, mocha_fgrep):
    karmaconfig_path = os.path.join(cwd, 'out', target, 'gen', 'test',
                                    'unittests', 'karma.conf.js')

    if not os.path.exists(karmaconfig_path):
        print('Unable to find Karma config at ' + karmaconfig_path)
        print(
            'Make sure to set the --ninja-build-name argument to the folder name of "out/target"'
        )
        sys.exit(1)

    print('Using karma config ' + karmaconfig_path)

    exec_command = [
        devtools_paths.node_path(),
        devtools_paths.karma_path(), 'start',
        test_helpers.to_platform_path_exact(karmaconfig_path)
    ]

    env = os.environ.copy()
    env['NODE_PATH'] = devtools_paths.node_path()
    if (no_text_coverage is not False):
        env['NO_TEXT_COVERAGE'] = '1'
    if (no_html_coverage is not False):
        env['NO_HTML_COVERAGE'] = '1'
    if (coverage is True):
        env['COVERAGE'] = '1'
    if (expanded_reporting is True):
        env['EXPANDED_REPORTING'] = '1'
    if (chrome_binary is not None):
        env['CHROME_BIN'] = chrome_binary
    if (mocha_fgrep is not None):
        print('Using Mocha --fgrep flag ' + mocha_fgrep)
        env['MOCHA_FGREP'] = mocha_fgrep
    exit_code = test_helpers.popen(exec_command, cwd=cwd, env=env)
    if exit_code == 1:
        return True

    return False
Beispiel #19
0
def _CheckFormat(input_api, output_api):

    def popen(args):
        return input_api.subprocess.Popen(args=args, stdout=input_api.subprocess.PIPE, stderr=input_api.subprocess.STDOUT)

    affected_files = _getAffectedJSFiles(input_api)
    if len(affected_files) == 0:
        return []
    original_sys_path = sys.path
    try:
        sys.path = sys.path + [input_api.os_path.join(input_api.PresubmitLocalPath(), 'scripts')]
        import devtools_paths
    finally:
        sys.path = original_sys_path

    ignore_files = []
    eslint_ignore_path = input_api.os_path.join(input_api.PresubmitLocalPath(), '.eslintignore')
    with open(eslint_ignore_path, 'r') as ignore_manifest:
        for line in ignore_manifest:
            ignore_files.append(input_api.os_path.normpath(line.strip()))
    formattable_files = [
        affected_file for affected_file in affected_files if all(ignore_file not in affected_file for ignore_file in ignore_files)
    ]
    if len(formattable_files) == 0:
        return []

    check_formatting_process = popen(['git', 'cl', 'format', '--js', '--dry-run'] + formattable_files)
    check_formatting_process.communicate()
    if check_formatting_process.returncode == 0:
        return []

    format_args = ['git', 'cl', 'format', '--js'] + formattable_files
    format_process = popen(format_args)
    format_out, _ = format_process.communicate()
    if format_process.returncode != 0:
        return [output_api.PresubmitError(format_out)]

    # Use eslint to autofix the braces.
    # Also fix semicolon to avoid confusing clang-format.
    eslint_process = popen(
        [devtools_paths.node_path(), devtools_paths.eslint_path(), '--config', '.eslintrc.js', '--fix'] + affected_files)
    eslint_process.communicate()

    # Need to run clang-format again to align the braces
    popen(format_args).communicate()

    return [
        output_api.PresubmitError('ERROR: Found formatting violations.\n'
                                  'Ran clang-format on diff\n'
                                  'Use git status to check the formatting changes'),
        output_api.PresubmitError(format_out),
    ]
def main():
    exec_command = [
        devtools_paths.node_path(),
        path.join(ROOT_DIRECTORY, 'node_modules', 'stylelint', 'bin',
                  'stylelint.js'),
    ]
    exec_command.extend(get_css_files_or_glob())
    exec_command.append('--fix')

    stylelint_proc = Popen(exec_command, cwd=ROOT_DIRECTORY)
    stylelint_proc.communicate()

    sys.exit(stylelint_proc.returncode)
Beispiel #21
0
def run_tests(chrome_binary, test_suite_list_path):
    env = os.environ.copy()
    env['CHROME_BIN'] = chrome_binary
    env['TEST_LIST'] = test_suite_list_path

    cwd = devtools_paths.devtools_root_path()
    runner_path = os.path.join(cwd, 'test', 'shared', 'runner.js')
    exec_command = [devtools_paths.node_path(), runner_path]

    exit_code = test_helpers.popen(exec_command, cwd=cwd, env=env)
    if exit_code != 0:
        return True

    return False
Beispiel #22
0
def rollup(input_path, output_path, filename, max_size, rollup_plugin):
    target = join(input_path, filename)
    rollup_process = subprocess.Popen(
        [devtools_paths.node_path(),
         devtools_paths.rollup_path()] +
        ['--format', 'iife', '-n', 'InspectorOverlay'] + ['--input', target] +
        ['--plugin', rollup_plugin, '--plugin', 'terser'],
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE)
    out, error = rollup_process.communicate()
    if not out:
        raise Exception("rollup failed: " + error)
    check_size(filename, out, max_size)
    write_file(join(output_path, filename), out)
def run_tests():
    karma_errors_found = False
    karmaconfig_path = os.path.join(devtools_path, 'karma.conf.js')
    exec_command = [
        devtools_paths.node_path(),
        devtools_paths.karma_path(), 'start',
        to_platform_path_exact(karmaconfig_path)
    ]
    env = os.environ.copy()
    env['NODE_PATH'] = devtools_paths.node_path()
    if (chrome_binary is not None):
        env['CHROME_BIN'] = chrome_binary

    karma_proc = popen(exec_command, cwd=devtools_path, env=env)

    (karma_proc_out, _) = karma_proc.communicate()
    if karma_proc.returncode != 0:
        karma_errors_found = True
    else:
        print('Karma exited successfully')

    print(karma_proc_out)
    return karma_errors_found
Beispiel #24
0
def check_with_node_script(script_path, script_description, args):
    print(script_description + "...")
    script_proc_errors_found = False
    exec_command = [
        devtools_paths.node_path(),
        script_path,
    ] + args

    script_proc = popen(exec_command)
    (script_proc_out, _) = script_proc.communicate()
    if script_proc.returncode != 0:
        script_proc_errors_found = True

    print(script_proc_out)
    return script_proc_errors_found
Beispiel #25
0
def main():
    exec_command = [
        devtools_paths.node_path(),
        path.join(ROOT_DIRECTORY, 'node_modules', 'stylelint', 'bin',
                  'stylelint.js'),
    ]
    exec_command.extend(get_css_files_or_glob())
    exec_command.append('--fix')
    # If all affected files are excluded due to .stylelintignore, exit gracefully
    exec_command.append('--allow-empty-input')

    stylelint_proc = Popen(exec_command, cwd=ROOT_DIRECTORY)
    stylelint_proc.communicate()

    sys.exit(stylelint_proc.returncode)
def run_tests(chrome_binary,
              chrome_features,
              test_suite_path,
              test_suite,
              jobs,
              target,
              cwd=None,
              node_modules_path=None,
              test_patterns=None):
    env = os.environ.copy()
    env['CHROME_BIN'] = chrome_binary
    if chrome_features:
        env['CHROME_FEATURES'] = chrome_features

    if test_patterns:
        env['TEST_PATTERNS'] = ';'.join(test_patterns)

    if jobs:
        env['JOBS'] = jobs

    if target:
        env['TARGET'] = target

    if node_modules_path is not None:
        # Node requires the path to be absolute
        env['NODE_PATH'] = os.path.abspath(node_modules_path)

    if not cwd:
        cwd = devtools_paths.devtools_root_path()

    exec_command = [devtools_paths.node_path()]

    if 'DEBUG' in env:
        exec_command.append('--inspect')

    exec_command = exec_command + [
        devtools_paths.mocha_path(),
        '--config',
        os.path.join(test_suite_path, '.mocharc.js'),
    ]

    exit_code = test_helpers.popen(exec_command, cwd=cwd, env=env)
    if exit_code != 0:
        return True

    return False
Beispiel #27
0
def run_boot_perf_test(chrome_binary, runs):
    boot_perf_errors_found = False
    exec_command = [devtools_paths.node_path(), devtools_paths.boot_perf_test_path(), '--progress=false', '--runs=%s' % runs]

    env = os.environ.copy()
    env['CHROME_BIN'] = chrome_binary

    cwd = devtools_paths.devtools_root_path()

    boot_perf_proc = popen(exec_command, cwd=cwd, env=env)
    (boot_perf_proc_out, _) = boot_perf_proc.communicate()

    if boot_perf_proc.returncode != 0:
        boot_perf_errors_found = True

    print(boot_perf_proc_out)
    return boot_perf_errors_found
    def _rollup_worker(self, output):
        js_entrypoint = join(self.application_dir,
                             self.app_file('unbundled.js'))
        rollup_process = subprocess.Popen(
            [devtools_paths.node_path(),
             devtools_paths.rollup_path()] + ROLLUP_ARGS +
            ['--input', js_entrypoint],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE)
        out, error = rollup_process.communicate()

        if rollup_process.returncode != 0:
            print('Error while running rollup:')
            print(error)
            sys.exit(1)

        output.write(minify_js(out))
Beispiel #29
0
def run_e2e_test(chrome_binary):
    e2e_errors_found = False
    cwd = devtools_paths.devtools_root_path()
    e2e_test_path = os.path.join(cwd, 'test/shared/runner.js')
    e2e_test_list = os.path.join(cwd, 'test/e2e/test-list.js')
    exec_command = [devtools_paths.node_path(), e2e_test_path]

    env = os.environ.copy()
    env['CHROME_BIN'] = chrome_binary
    env['TEST_LIST'] = e2e_test_list

    e2e_proc = popen(exec_command, cwd=cwd, env=env, capture=True)
    e2e_proc.communicate()
    if e2e_proc.returncode != 0:
        e2e_errors_found = True

    return e2e_errors_found
V8_DIRECTORY_PATH = path.join(ROOT_DIRECTORY, 'v8')
PROTOCOL_LOCATION = path.join(ROOT_DIRECTORY, 'third_party', 'blink', 'public',
                              'devtools_protocol')
SCRIPTS_BUILD_PATH = path.join(ROOT_DIRECTORY, 'scripts', 'build')

GENERATE_ARIA_SCRIPT = path.join(SCRIPTS_BUILD_PATH, 'generate_aria.py')
GENERATE_SUPPORTED_CSS_SCRIPT = path.join(SCRIPTS_BUILD_PATH,
                                          'generate_supported_css.py')
GENERATE_PROTOCOL_DEFINITIONS_SCRIPT = path.join(SCRIPTS_BUILD_PATH,
                                                 'code_generator_frontend.py')
CONCATENATE_PROTOCOL_SCRIPT = path.join(ROOT_DIRECTORY, 'third_party',
                                        'inspector_protocol',
                                        'concatenate_protocols.py')

NODE_LOCATION = devtools_paths.node_path()
TSC_LOCATION = devtools_paths.typescript_compiler_path()


def popen(arguments, cwd=ROOT_DIRECTORY, env=os.environ.copy()):
    process = subprocess.Popen([sys.executable] + arguments, cwd=cwd, env=env)

    process.communicate()

    if process.returncode != 0:
        sys.exit(process.returncode)


def runTsc(file_to_compile):
    process = subprocess.Popen([NODE_LOCATION, TSC_LOCATION, file_to_compile],
                               stdout=subprocess.PIPE,