Files
dolt/tools/run-all-js-tests.py
T
Erik Arvidsson e90bfcbd2a Switch to Yarn (#3092)
brew install yarn
2017-01-20 11:42:32 -08:00

31 lines
912 B
Python
Executable File

#!/usr/bin/env python
# Copyright 2016 Attic Labs, Inc. All rights reserved.
# Licensed under the Apache License, version 2.0:
# http://www.apache.org/licenses/LICENSE-2.0
# This tool finds all package.json files and runs yarn and yarn test in those directories.
import argparse
import os
import subprocess
from noms.pushd import pushd
def main():
parser = argparse.ArgumentParser(description='Runs all Node.js tests')
args = parser.parse_args()
lsfiles = subprocess.check_output(['git', 'ls-files']).split('\n')
lsfiles.sort(key = len) # Sort by shortest first to make sure we deal with parents first
for f in lsfiles:
path, name = os.path.split(os.path.abspath(f))
if name == 'package.json':
with pushd(path):
print('Running tests in: %s' % path)
subprocess.check_call(['yarn'])
subprocess.check_call(['yarn', 'test'])
if __name__ == '__main__':
main()