Merge pull request #1374 from ethereum/fixCurrentPath

Fix currentPath()
pull/1/head
yann300 6 years ago committed by GitHub
commit bc3f533788
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      .circleci/config.yml
  2. 2
      src/app/files/fileManager.js
  3. 4
      src/app/panels/righthand-panel.js
  4. 2
      src/app/tabs/run-tab.js
  5. 8
      src/app/tabs/test-tab.js

@ -7,7 +7,7 @@ jobs:
remix-ide: remix-ide:
docker: docker:
# specify the version you desire here # specify the version you desire here
- image: circleci/node:7.10 - image: circleci/node:9.11.2
# Specify service dependencies here if necessary # Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images # CircleCI maintains a library of pre-built images
@ -26,10 +26,10 @@ jobs:
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
- dep-bundle-12-{{ checksum "package.json" }} - dep-bundle-13-{{ checksum "package.json" }}
- run: npm install - run: npm install
- save_cache: - save_cache:
key: dep-bundle-12-{{ checksum "package.json" }} key: dep-bundle-13-{{ checksum "package.json" }}
paths: paths:
- ~/repo/node_modules - ~/repo/node_modules
- run: npm run lint && npm run test && npm run downloadsolc && npm run make-mock-compiler && npm run build - run: npm run lint && npm run test && npm run downloadsolc && npm run make-mock-compiler && npm run build
@ -38,7 +38,7 @@ jobs:
remix-debugger: remix-debugger:
docker: docker:
# specify the version you desire here # specify the version you desire here
- image: circleci/node:7.10 - image: circleci/node:9.11.2
working_directory: ~/repo working_directory: ~/repo
@ -46,10 +46,10 @@ jobs:
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
- dep-bundle-7-{{ checksum "package.json" }} - dep-bundle-8-{{ checksum "package.json" }}
- run: npm install - run: npm install
- save_cache: - save_cache:
key: dep-bundle-7-{{ checksum "package.json" }} key: dep-bundle-8-{{ checksum "package.json" }}
paths: paths:
- ~/repo/node_modules - ~/repo/node_modules
- run: npm run build_debugger - run: npm run build_debugger

@ -74,7 +74,7 @@ class FileManager {
currentPath () { currentPath () {
var self = this var self = this
var currentFile = self._deps.config.get('currentFile') var currentFile = self._deps.config.get('currentFile')
var reg = /(.*\/).*/ var reg = /(.*)(\/).*/
var path = reg.exec(currentFile) var path = reg.exec(currentFile)
return path ? path[1] : null return path ? path[1] : null
} }

@ -111,14 +111,14 @@ module.exports = class RighthandPanel {
</div> </div>
</div>` </div>`
const { compile, run, settings, analysis, debug, support } = self._components const { compile, run, settings, analysis, debug, support, test } = self._components
self._components.tabbedMenu.addTab('Compile', 'compileView', compile.render()) self._components.tabbedMenu.addTab('Compile', 'compileView', compile.render())
self._components.tabbedMenu.addTab('Run', 'runView', run.render()) self._components.tabbedMenu.addTab('Run', 'runView', run.render())
self._components.tabbedMenu.addTab('Settings', 'settingsView', settings.render()) self._components.tabbedMenu.addTab('Settings', 'settingsView', settings.render())
self._components.tabbedMenu.addTab('Analysis', 'staticanalysisView', analysis.render()) self._components.tabbedMenu.addTab('Analysis', 'staticanalysisView', analysis.render())
self._components.tabbedMenu.addTab('Debugger', 'debugView', debug.render()) self._components.tabbedMenu.addTab('Debugger', 'debugView', debug.render())
self._components.tabbedMenu.addTab('Support', 'supportView', support.render()) self._components.tabbedMenu.addTab('Support', 'supportView', support.render())
// self._components.tabbedMenu.addTab('Test', 'testView', test.render()) self._components.tabbedMenu.addTab('Test', 'testView', test.render())
self._components.tabbedMenu.selectTabByTitle('Compile') self._components.tabbedMenu.selectTabByTitle('Compile')
} }
// showDebugger () { // showDebugger () {

@ -266,7 +266,7 @@ function makeRecorder (registry, runTabEvent, self) {
modalDialogCustom.prompt(null, 'Transactions will be saved in a file under ' + path, 'scenario.json', input => { modalDialogCustom.prompt(null, 'Transactions will be saved in a file under ' + path, 'scenario.json', input => {
var fileProvider = fileManager.fileProviderOf(path) var fileProvider = fileManager.fileProviderOf(path)
if (fileProvider) { if (fileProvider) {
var newFile = path + input var newFile = path + '/' + input
helper.createNonClashingName(newFile, fileProvider, (error, newFile) => { helper.createNonClashingName(newFile, fileProvider, (error, newFile) => {
if (error) return modalDialogCustom.alert('Failed to create file. ' + newFile + ' ' + error) if (error) return modalDialogCustom.alert('Failed to create file. ' + newFile + ' ' + error)
if (!fileProvider.set(newFile, txJSON)) { if (!fileProvider.set(newFile, txJSON)) {

@ -68,8 +68,7 @@ module.exports = class TestTab {
}) })
} }
function runTest (testFilePath, callback) { function runTest (testFilePath, provider, callback) {
var provider = this._deps.fileManager.fileProviderOf(testFilePath)
provider.get(testFilePath, (error, content) => { provider.get(testFilePath, (error, content) => {
if (!error) { if (!error) {
var runningTest = {} var runningTest = {}
@ -85,13 +84,14 @@ module.exports = class TestTab {
let runTests = function () { let runTests = function () {
container.innerHTML = '' container.innerHTML = ''
var path = this._deps.fileManager.currentPath() var path = this._deps.fileManager.currentPath()
var provider = this._deps.fileManager.fileProviderOf(path)
var tests = [] var tests = []
self._deps.fileManager.filesFromPath(path, (error, files) => { self._deps.fileManager.filesFromPath(path, (error, files) => {
if (!error) { if (!error) {
for (var file in files) { for (var file in files) {
if (/.(_test.sol)$/.exec(file)) tests.push(path + file) if (/.(_test.sol)$/.exec(file)) tests.push(provider.type + '/' + file)
} }
async.eachOfSeries(tests, (value, key, callback) => { runTest(value, callback) }) async.eachOfSeries(tests, (value, key, callback) => { runTest(value, provider, callback) })
} }
}) })
} }

Loading…
Cancel
Save