DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (c68fe15a81fc)

VCS Links

Line Code
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
import mozunit

from conftest import build

LINTER = 'eslint'


def test_lint_with_global_exclude(lint, config, paths):
    config['exclude'] = ['subdir', 'import']
    results = lint(paths(), config=config, root=build.topsrcdir)
    assert len(results) == 0


def test_no_files_to_lint(lint, config, paths):
    # A directory with no files to lint.
    results = lint(paths('nolint'), root=build.topsrcdir)
    assert results == []

    # Errors still show up even when a directory with no files is passed in.
    results = lint(paths('nolint', 'subdir/bad.js'), root=build.topsrcdir)
    assert len(results) == 1


def test_bad_import(lint, config, paths):
    results = lint(paths('import'), config=config, root=build.topsrcdir)
    assert results == 1


if __name__ == '__main__':
    mozunit.main()