Files
dolt/tools/run-all-js-tests.py
T
Erik Arvidsson c0bd2c90d4 More tweaks to tools/run-all-js-tests.py (#1974)
* Update Splore build.py

* path

* Setup the bin symlinks in preinstall

* Link entire node_modules instead
2016-07-06 13:44:11 -07:00

33 lines
864 B
Python

#!/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 npm install and npm test in those directories.
import os
import subprocess
from contextlib import contextmanager
@contextmanager
def pushd(path):
currentDir = os.getcwd()
os.chdir(path)
yield
os.chdir(currentDir)
def main():
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(f)
if name == 'package.json':
with pushd(path):
subprocess.check_call(['npm', 'install'])
subprocess.check_call(['npm', 'test'])
if __name__ == '__main__':
main()