|
|
@ -1,5 +1,5 @@ |
|
|
|
import {NightwatchBrowser} from 'nightwatch' |
|
|
|
import {NightwatchBrowser} from 'nightwatch' |
|
|
|
import { ChildProcess, spawn } from 'child_process' |
|
|
|
import { ChildProcess, spawn, execSync } from 'child_process' |
|
|
|
import { homedir } from 'os' |
|
|
|
import { homedir } from 'os' |
|
|
|
const tests = { |
|
|
|
const tests = { |
|
|
|
before: function (browser: NightwatchBrowser, done: VoidFunction) { |
|
|
|
before: function (browser: NightwatchBrowser, done: VoidFunction) { |
|
|
@ -69,27 +69,37 @@ const tests = { |
|
|
|
async function installSlither(): Promise<void> { |
|
|
|
async function installSlither(): Promise<void> { |
|
|
|
console.log('installSlither', process.cwd()) |
|
|
|
console.log('installSlither', process.cwd()) |
|
|
|
try { |
|
|
|
try { |
|
|
|
const server = spawn('npx ts-node', ['../../libs/remixd/src/scripts/installSlither.ts'], { cwd: process.cwd(), shell: true, detached: true }) |
|
|
|
try { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
const solcVersion = '0.8.15' |
|
|
|
server.stdout.on('data', function (data) { |
|
|
|
console.log('\x1b[32m%s\x1b[0m', `[Slither Installation]: requires Python3.6+ (pip3) to be installed on your system`) |
|
|
|
console.log(data.toString()) |
|
|
|
console.log('\x1b[32m%s\x1b[0m', `[Slither Installation]: solc-select will be installed along with Slither to set different solc compiler versions.`) |
|
|
|
if ( |
|
|
|
console.log('\x1b[32m%s\x1b[0m', `[Slither Installation]: checking pip3 availability ...`) |
|
|
|
data.toString().includes("Slither is ready to use") |
|
|
|
const pip3OP = execSync('pip3 --version') |
|
|
|
) { |
|
|
|
console.log('\x1b[32m%s\x1b[0m', `[Slither Installation]: pip3 found: ${pip3OP.toString()}`) |
|
|
|
console.log('resolving') |
|
|
|
console.log('\x1b[32m%s\x1b[0m', `[Slither Installation]: installing slither...`) |
|
|
|
resolve() |
|
|
|
const slitherOP = execSync('pip3 install slither-analyzer') |
|
|
|
} |
|
|
|
console.log('\x1b[32m%s\x1b[0m', `[Slither Installation]: slither installation output: ${slitherOP.toString()}`) |
|
|
|
}) |
|
|
|
console.log('\x1b[32m%s\x1b[0m', `[Slither Installation]: installing solc-select...`) |
|
|
|
server.stderr.on('err', function (data) { |
|
|
|
const solcSelectOP = execSync('pip3 install solc-select') |
|
|
|
console.log(data.toString()) |
|
|
|
console.log('\x1b[32m%s\x1b[0m', `[Slither Installation]: solc-select installation output: ${solcSelectOP.toString()}`) |
|
|
|
reject(data.toString()) |
|
|
|
console.log('\x1b[32m%s\x1b[0m', `[Slither Installation]: installing solc ${solcVersion}...`) |
|
|
|
}) |
|
|
|
const solcInstallOP = execSync(`solc-select install ${solcVersion}`) |
|
|
|
}) |
|
|
|
console.log('\x1b[32m%s\x1b[0m', `[Slither Installation]: solc installation output: ${solcInstallOP.toString()}`) |
|
|
|
|
|
|
|
console.log('\x1b[32m%s\x1b[0m', `[Slither Installation]: setting solc version to ${solcVersion}...`) |
|
|
|
|
|
|
|
const solcUseOP = execSync(`solc-select use ${solcVersion}`) |
|
|
|
|
|
|
|
console.log('\x1b[32m%s\x1b[0m', `[Slither Installation]: solc setting installation output: ${solcUseOP.toString()}`) |
|
|
|
|
|
|
|
console.log('\x1b[32m%s\x1b[0m', `[Slither Installation]: Slither is ready to use!`) |
|
|
|
|
|
|
|
} catch (err) { |
|
|
|
|
|
|
|
console.log('\x1b[31m%s\x1b[0m', `[Slither Installation]: Error occurred: ${err}`) |
|
|
|
|
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
console.log(e) |
|
|
|
console.log(e) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = { |
|
|
|
module.exports = { |
|
|
|
...process.platform.startsWith('linux')?tests:{} |
|
|
|
...process.platform.startsWith('linux')?tests:{} |
|
|
|
} |
|
|
|
} |