diff --git a/test/helper-test262.js b/test/helpers/test262.js similarity index 88% rename from test/helper-test262.js rename to test/helpers/test262.js index 158cf8c2c2254aeda0a02c209643a46d9a6dc2ce..de13bd55fe29bca071bf1d9cd25f9c34d12e2010 100644 --- a/test/helper-test262.js +++ b/test/helpers/test262.js @@ -33,7 +33,7 @@ function testNegativity(str) { before(function(done) { this.timeout(0); // Otherwise it fails on slow filesystems - var test262path = fs.readlinkSync(__dirname + '/test262'); + var test262path = fs.readlinkSync(__dirname + '/../test262'); var tests = []; walk(test262path) @@ -55,6 +55,7 @@ before(function(done) { var source; var negative = ''; + // Lazy-load the source file prior to tests before(function(doneFile) { fs.readFile(item).then( data => { @@ -64,6 +65,8 @@ before(function(done) { ).then(doneFile); }); + // args only gets populated prior to the execution of this item + // (it is empty at the point of construction of the test) testConstructors.forEach(constructor => constructor(args)); }); }); diff --git a/test/interpreter.js b/test/interpreter.js index 7ff1dccb2999e67cfb66111a1c4ea7015eb8bcc2..1e57e82c6dd94eb22ae9b3e5f516d467b9e10437 100644 --- a/test/interpreter.js +++ b/test/interpreter.js @@ -5,7 +5,7 @@ var esprimaToAST = require('../esprima-to-ast.js').esprimaToAST; var JsInterpreter = require('../generator/tests/jsref/assembly.js'); require('./parser.js'); -var test262tests = require('./helper-test262.js'); +var test262tests = require('./helpers/test262.js'); // Stub logging functions ['ctx_empty', 'ctx_push', 'log_event'].forEach(f => global[f] = function(){}) diff --git a/test/mocha.opts b/test/mocha.opts new file mode 100644 index 0000000000000000000000000000000000000000..27ea163375c0140667133cca17280e7c427d3eea --- /dev/null +++ b/test/mocha.opts @@ -0,0 +1 @@ +--colors diff --git a/test/parser.js b/test/parser.js index fd46fc8d5ea8c6185646ad5a4884851c844159c7..a100c19a5f810ba278cb77777eec14e7e3da6bd8 100644 --- a/test/parser.js +++ b/test/parser.js @@ -5,7 +5,7 @@ var assert = require('chai').assert; var esprima = require('esprima'); var esprimaToAST = require('../esprima-to-ast.js'); -var test262tests = require('./helper-test262.js'); +var test262tests = require('./helpers/test262.js'); /* Tests whether a given test is negative. * Param: negative (boolean or string): Return value of helper-test262.testNegativity