Skip to content

Commit

Permalink
Test suite: Memory leak in vm.runInNewContext() seems fixed.
Browse files Browse the repository at this point in the history
Revert 9a4b6fa to drastically improve tests execution time.
  • Loading branch information
Golmote committed Apr 5, 2018
1 parent 46e6f0c commit 9bceece
Showing 1 changed file with 8 additions and 30 deletions.
38 changes: 8 additions & 30 deletions tests/run.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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
});
}
);
}
Expand Down

0 comments on commit 9bceece

Please sign in to comment.