rename fs.ts

pull/7/head
Sab94 6 years ago
parent 21ea2ce12f
commit c0159cedc7
  1. 2
      remix-tests/bin/remix-tests
  2. 2
      remix-tests/src/compiler.ts
  3. 20
      remix-tests/src/fileSystem.ts
  4. 21
      remix-tests/src/fs.js
  5. 65
      remix-tests/src/run.js
  6. 65
      remix-tests/src/run.ts
  7. 6
      remix-tests/src/runTestFiles.ts

@ -1,4 +1,4 @@
#!/usr/bin/env node
require('../src/run.js');
require('../dist/run.js');

@ -1,5 +1,5 @@
/* eslint no-extend-native: "warn" */
let fs = require('../src/fs')
let fs = require('./fileSystem')
var async = require('async')
var path = require('path')
let RemixCompiler = require('remix-solidity').Compiler

@ -0,0 +1,20 @@
// Extend fs
let fs: any = require('fs')
const path = require('path')
// https://github.com/mikeal/node-utils/blob/master/file/lib/main.js
fs.walkSync = function (start, callback) {
fs.readdirSync(start).forEach(name => {
if (name === 'node_modules') {
return // hack
}
var abspath = path.join(start, name)
if (fs.statSync(abspath).isDirectory()) {
fs.walkSync(abspath, callback)
} else {
callback(abspath)
}
})
}
export = fs

@ -1,21 +0,0 @@
// Extend fs
var fs = require('fs')
const path = require('path')
// https://github.com/mikeal/node-utils/blob/master/file/lib/main.js
fs.walkSync = function (start, callback) {
fs.readdirSync(start).forEach(name => {
if (name === 'node_modules') {
return // hack
}
var abspath = path.join(start, name)
if (fs.statSync(abspath).isDirectory()) {
fs.walkSync(abspath, callback)
} else {
callback(abspath)
}
})
}
module.exports = fs

@ -1,65 +0,0 @@
const commander = require('commander')
const Web3 = require('web3')
const RemixTests = require('./index.js')
const fs = require('fs')
const Provider = require('remix-simulator').Provider
const { Log } = require('./logger')
const logger = new Log()
const log = logger.logger
require('colors')
// parse verbosity
function mapVerbosity (v) {
const levels = {
0: 'error',
1: 'warn',
2: 'info',
3: 'verbose',
4: 'debug',
5: 'silly'
}
return levels[v]
}
const version = require('../package.json').version
commander.version(version)
commander.command('version').description('output the version number').action(function () {
console.log(version)
})
commander.command('help').description('output usage information').action(function () {
commander.help()
})
// get current version
commander
.option('-v, --verbose <level>', 'run with verbosity', mapVerbosity)
.action(function (filename) {
// Console message
console.log(('\n\t👁 :: Running remix-tests - Unit testing for solidity :: 👁\t\n').white)
// set logger verbosity
if (commander.verbose) {
logger.setVerbosity(commander.verbose)
log.info('verbosity level set to ' + commander.verbose.blue)
}
let web3 = new Web3()
// web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'))
web3.setProvider(new Provider())
// web3.setProvider(new web3.providers.WebsocketProvider('ws://localhost:8546'))
if (!fs.existsSync(filename)) {
console.error(filename + ' not found')
process.exit(1)
}
let isDirectory = fs.lstatSync(filename).isDirectory()
RemixTests.runTestFiles(filename, isDirectory, web3)
})
if (!process.argv.slice(2).length) {
log.error('Please specify a filename')
process.exit()
}
commander.parse(process.argv)

@ -0,0 +1,65 @@
const commander = require('commander')
const Web3 = require('web3')
import runTestFiles from './runTestFiles'
import fs = require('./fileSystem')
const Provider = require('remix-simulator').Provider
import Log = require('./logger')
const logger = new Log()
const log = logger.logger
require('colors')
// parse verbosity
function mapVerbosity (v) {
const levels = {
0: 'error',
1: 'warn',
2: 'info',
3: 'verbose',
4: 'debug',
5: 'silly'
}
return levels[v]
}
const version = require('../package.json').version
commander.version(version)
commander.command('version').description('output the version number').action(function () {
console.log(version)
})
commander.command('help').description('output usage information').action(function () {
commander.help()
})
// get current version
commander
.option('-v, --verbose <level>', 'run with verbosity', mapVerbosity)
.action(function (filename) {
// Console message
console.log(('\n\t👁 :: Running remix-tests - Unit testing for solidity :: 👁\t\n'),'color: white')
// set logger verbosity
if (commander.verbose) {
logger.setVerbosity(commander.verbose)
log.info('verbosity level set to ' + commander.verbose.blue)
}
let web3 = new Web3()
// web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'))
web3.setProvider(new Provider())
// web3.setProvider(new web3.providers.WebsocketProvider('ws://localhost:8546'))
if (!fs.existsSync(filename)) {
console.error(filename + ' not found')
process.exit(1)
}
let isDirectory = fs.lstatSync(filename).isDirectory()
runTestFiles(filename, isDirectory, web3)
})
if (!process.argv.slice(2).length) {
log.error('Please specify a filename')
process.exit()
}
commander.parse(process.argv)

@ -1,13 +1,13 @@
import async = require('async')
import path = require('path')
import fs = require('./fs')
import fs from './fileSystem'
import runTest from './testRunner'
require('colors')
import Compiler = require('./compiler')
import Deployer = require('./deployer')
function runTestFiles(filepath, isDirectory, web3, opts) {
function runTestFiles(filepath, isDirectory, web3, opts = {}) {
opts = opts || {}
const { Signale } = require('signale')
// signale configuration
@ -31,7 +31,7 @@ function runTestFiles(filepath, isDirectory, web3, opts) {
}
}
const signale = new Signale(options)
let accounts = opts.accounts || null
let accounts = opts['accounts'] || null
async.waterfall([
function getAccountList (next) {
if (accounts) return next(null)

Loading…
Cancel
Save