forked from mirrors/gecko-dev
Bug 1651469 - [puppeteer-test] Report errors in mocha hooks r=remote-protocol-reviewers,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D82813
This commit is contained in:
parent
0cf65adf2b
commit
0856418749
1 changed files with 10 additions and 2 deletions
|
|
@ -10,11 +10,13 @@ from __future__ import (
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
import sys
|
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from six import iteritems
|
from six import iteritems
|
||||||
|
|
@ -192,6 +194,8 @@ def wait_proc(p, cmd=None, exit_on_fail=True, output_timeout=None):
|
||||||
|
|
||||||
class MochaOutputHandler(object):
|
class MochaOutputHandler(object):
|
||||||
def __init__(self, logger, expected):
|
def __init__(self, logger, expected):
|
||||||
|
self.hook_re = re.compile('"before\b?.*" hook|"after\b?.*" hook')
|
||||||
|
|
||||||
self.logger = logger
|
self.logger = logger
|
||||||
self.proc = None
|
self.proc = None
|
||||||
self.test_results = OrderedDict()
|
self.test_results = OrderedDict()
|
||||||
|
|
@ -239,6 +243,10 @@ class MochaOutputHandler(object):
|
||||||
status = "TIMEOUT"
|
status = "TIMEOUT"
|
||||||
if test_name and test_path:
|
if test_name and test_path:
|
||||||
test_name = "{} ({})".format(test_name, os.path.basename(test_path))
|
test_name = "{} ({})".format(test_name, os.path.basename(test_path))
|
||||||
|
# mocha hook failures are not tracked in metadata
|
||||||
|
if status != "PASS" and self.hook_re.search(test_name):
|
||||||
|
self.logger.error("TEST-UNEXPECTED-ERROR %s" % (test_name,))
|
||||||
|
return
|
||||||
if test_start:
|
if test_start:
|
||||||
self.logger.test_start(test_name)
|
self.logger.test_start(test_name)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue