Commit 1f7b8229 authored by Iuri Matias's avatar Iuri Matias

compile contracts in test dir

parent d7669a2b
let fs = require('fs'); let fs = require('fs');
var async = require('async'); var async = require('async');
var path = require('path');
let remixLib = require('remix-lib'); let remixLib = require('remix-lib');
let compilerInput = remixLib.helpers.compiler; let compilerInput = remixLib.helpers.compiler;
...@@ -12,9 +13,14 @@ function compileFile(filename, cb) { ...@@ -12,9 +13,14 @@ function compileFile(filename, cb) {
let compiler; let compiler;
const sources = { const sources = {
"tests.sol": {content: fs.readFileSync("sol/tests.sol").toString()}, "tests.sol": {content: fs.readFileSync("sol/tests.sol").toString()},
"simple_storage.sol": {content: fs.readFileSync("examples/simple_storage.sol").toString()}, }
"simple_storage_test.sol": {content: fs.readFileSync("examples/simple_storage_test.sol").toString()}
}; // TODO: for now assumes filepath dir contains all tests, later all this
// should be replaced with remix's & browser solidity compiler code
let filepath = path.dirname(filename);
fs.readdirSync(filepath).forEach(file => {
sources[file] = {content: fs.readFileSync(path.join(filepath, file)).toString()}
});
async.waterfall([ async.waterfall([
function loadCompiler(next) { function loadCompiler(next) {
...@@ -33,7 +39,7 @@ function compileFile(filename, cb) { ...@@ -33,7 +39,7 @@ function compileFile(filename, cb) {
compiler.compile(sources, "examples/"); compiler.compile(sources, "examples/");
} }
], function(err, result) { ], function(err, result) {
cb(null, result.contracts); cb(err, result.contracts);
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment