run each test in series

pull/1/head
yann300 7 years ago
parent 0e96c32c19
commit a55172d4a4
  1. 14
      src/app/tabs/test-tab.js

@ -1,4 +1,5 @@
var yo = require('yo-yo') var yo = require('yo-yo')
var async = require('async')
var css = require('./styles/test-tab-styles') var css = require('./styles/test-tab-styles')
var remixTests = require('remix-tests') var remixTests = require('remix-tests')
@ -28,7 +29,7 @@ function testTabView (api) {
cb() cb()
} }
let finalCallback = function (_err, result) { let updateFinalResult = function (_err, result) {
if (result.totalPassing > 0) { if (result.totalPassing > 0) {
append(container, (' ' + result.totalPassing + ' passing ') + ('(' + result.totalTime + 's)')) append(container, (' ' + result.totalPassing + ' passing ') + ('(' + result.totalTime + 's)'))
} }
@ -43,13 +44,16 @@ function testTabView (api) {
}) })
} }
function runTest (testFilePath) { function runTest (testFilePath, callback) {
var provider = api.fileProviderOf(testFilePath) var provider = api.fileProviderOf(testFilePath)
provider.get(testFilePath, (error, content) => { provider.get(testFilePath, (error, content) => {
if (!error) { if (!error) {
var runningTest = {} var runningTest = {}
runningTest[testFilePath] = { content } runningTest[testFilePath] = { content }
remixTests.runTestSources(runningTest, testCallback, resultsCallback, finalCallback, api.importFileCb) remixTests.runTestSources(runningTest, testCallback, resultsCallback, (error, result) => {
updateFinalResult(error, result)
callback(error)
}, api.importFileCb)
} }
}) })
} }
@ -57,11 +61,13 @@ function testTabView (api) {
let runTests = function () { let runTests = function () {
container.innerHTML = '' container.innerHTML = ''
var path = api.currentPath() var path = api.currentPath()
var tests = []
api.filesFromPath(path, (error, files) => { api.filesFromPath(path, (error, files) => {
if (!error) { if (!error) {
for (var file in files) { for (var file in files) {
if (/.(_test.sol)$/.exec(file)) runTest(path + file) if (/.(_test.sol)$/.exec(file)) tests.push(path + file)
} }
async.eachOfSeries(tests, (value, key, callback) => { runTest(value, callback) })
} }
}) })
} }

Loading…
Cancel
Save