示例#1
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 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
示例#3
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
示例#4
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