tests: Make test-js-with-node handling smarter.

Added support for passing a filename without `.js` suffix.
This then fixed the issue of no complaints for invalid test
files. Now, throws an error for invalid test files.

Fixes #8579.
This commit is contained in:
Joshua Pan 2018-03-10 11:24:48 -08:00 committed by showell
parent eb0da20b78
commit ed9eb3bdb5
2 changed files with 7 additions and 1 deletions

View File

@ -33,7 +33,7 @@ exports.find_files_to_run = function () {
} }
testsDifference.forEach(function (filename) { testsDifference.forEach(function (filename) {
console.log(filename + " does not exist"); throw (filename + ".js does not exist");
}); });
tests.sort(); tests.sort();

View File

@ -93,6 +93,12 @@ os.environ['TZ'] = 'UTC'
INDEX_JS = 'frontend_tests/zjsunit/index.js' INDEX_JS = 'frontend_tests/zjsunit/index.js'
# Add ".js" to the end of all the file arguments, so index.js
# can actually verify if the file exists or not.
for index, arg in enumerate(options.args):
if not arg.endswith('.js'):
options.args[index] = arg + '.js'
# The index.js test runner is the real "driver" here, and we launch # The index.js test runner is the real "driver" here, and we launch
# with either istanbul or node, depending on whether we want coverage # with either istanbul or node, depending on whether we want coverage
# reports. Running under istanbul is slower and creates funny # reports. Running under istanbul is slower and creates funny