mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-03 11:30:28 -05:00
fb4c8624a0
This adds some a basic integration tests for sample/js/{counter,fs}.
It work pretty much like this:
- Run `npm install`
- Do setup (good place to initialize the database) (optional).
- Start a http store from go.
- Run `node . <args...>`. The IntegrationTestSuite has convenience
methods to get the spec.
- Do teardown, which is a good time to check the output and the current state of the db (optional).
Towards #1888
32 lines
863 B
Python
32 lines
863 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()
|