Fail js tests if dirty package-lock

This commit is contained in:
Eric Fischer
2018-03-01 10:49:11 -05:00
parent 14e462e966
commit 383d67f879
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.