2 Search for Gruntfile.js files in all the addons and launch them using the 'grunt test' command.
12 def grunt_tester(directories, log = sys.stdout):
16 for direc in directories:
17 for root, dirnames, filenames in os.walk(direc):
18 for filename in fnmatch.filter(filenames, 'Gruntfile.js'):
19 full = os.path.join(root, filename)
20 if re.match(r"(^.*?/node_modules/.*$)|(^.*?/lib/.*$)", full):
25 folder = os.path.dirname(file_)
26 p = subprocess.Popen(['npm', 'install'], cwd=folder)
28 raise Exception("Failed to install dependencies for Gruntfile located in folder %s" % folder)
30 p = subprocess.Popen(['grunt', 'test', '--no-color'], cwd=folder, stdout=log, stderr=log)
38 args.addons = args.addons.split(':')
41 result = grunt_tester(args.addons)
45 def add_parser(subparsers):
46 parser = subparsers.add_parser('grunt-tests',
47 description='Run the tests contained in Gruntfile.js files.')
48 common.add_addons_argument(parser)
50 parser.set_defaults(run=run)