From 9bceece812bcfc658399a5c98799c308a9638828 Mon Sep 17 00:00:00 2001 From: Golmote Date: Thu, 5 Apr 2018 09:01:04 +0200 Subject: [PATCH] Test suite: Memory leak in vm.runInNewContext() seems fixed. Revert 9a4b6fa3ec770a382eccc149b849cc1c3112aa53 to drastically improve tests execution time. --- tests/run.js | 38 ++++++++------------------------------ 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/tests/run.js b/tests/run.js index 73c4c4acd1..46366cca3c 100644 --- a/tests/run.js +++ b/tests/run.js @@ -1,9 +1,9 @@ "use strict"; var TestDiscovery = require("./helper/test-discovery"); +var TestCase = require("./helper/test-case"); var path = require("path"); var argv = require("yargs").argv; -var child_process = require("child_process"); var testSuite; if (argv.language) { @@ -23,41 +23,19 @@ for (var language in testSuite) { describe("Testing language '" + language + "'", function () { this.timeout(10000); - // Each set of tests runs in its own child process - var child; - before(function () { - child = child_process.fork(__dirname + "/run-child.js", ['--language=' + language], { - stdio: 'inherit' - }); - }); - - after(function () { - child.kill(); - }); - testFiles.forEach( function (filePath) { var fileName = path.basename(filePath, path.extname(filePath)); it("– should pass test case '" + fileName + "'", - function (done) { + function () { + + if (path.extname(filePath) === '.test') { + TestCase.runTestCase(language, filePath); + } else { + TestCase.runTestsWithHooks(language, require(filePath)); + } - child.removeAllListeners('message'); - child.on('message', function (o) { - // We have to delay the call, - // otherwise the first message is received - // over and over again. - setTimeout(function() { - if (o.error) { - throw JSON.parse(o.error); - } else if (o.success) { - done(); - } - }, 1); - }); - child.send({ - filePath: filePath - }); } ); }