Merge pull request #17593 from edx/efischer/clean_git_checkout

Fail js tests if dirty package-lock
This commit is contained in:
Eric Fischer
2018-03-06 14:50:38 -05:00
committed by GitHub
2 changed files with 16 additions and 1 deletions

View File

@@ -303,7 +303,10 @@ def run_complexity():
@task
@needs('pavelib.prereqs.install_node_prereqs')
@needs(
'pavelib.prereqs.install_node_prereqs',
'pavelib.utils.test.utils.ensure_clean_package_lock',
)
@cmdopts([
("limit=", "l", "limit for number of acceptable violations"),
])

View File

@@ -33,6 +33,18 @@ def clean_test_files():
sh("rm -rf /tmp/mako_[cl]ms")
@task
@timed
def ensure_clean_package_lock():
"""
Ensure no untracked changes have been made in the current git context.
"""
sh("""
git diff --name-only --exit-code package-lock.json ||
(echo \"Dirty package-lock.json, run 'npm install' and commit the generated changes\" && exit 1)
""")
def clean_dir(directory):
"""
Delete all the files from the specified directory.