pull/1857/head
bunsenstraat 3 years ago
commit 37490fa2e0
  1. 7
      apps/remix-ide-e2e/nightwatch.ts
  2. 1
      apps/remix-ide/src/app.js
  3. 2
      libs/remix-solidity/src/lib/eventManager.ts
  4. 1
      libs/remix-tests/package.json
  5. 23
      libs/remix-tests/src/compiler.ts
  6. 21
      libs/remix-tests/src/runTestSources.ts

@ -79,9 +79,10 @@ module.exports = {
acceptSslCerts: true,
'moz:firefoxOptions': {
args: [
'--headless',
'--width=2560',
'--height=1440'
'-headless',
'-width=2560',
'-height=1440',
'-window-size=2560x1440'
]
}
}

@ -272,7 +272,6 @@ class AppComponent {
filePanel,
Registry.getInstance().get('compilersartefacts').api,
networkModule,
self.mainview,
Registry.getInstance().get('fileproviders/browser').api
)
const analysis = new AnalysisTab()

@ -21,7 +21,7 @@ export default class EventManager {
obj = this.anonymous
}
for (const reg in this.registered[eventName]) {
if (this.registered[eventName][reg].obj === obj && this.registered[eventName][reg].func === func) {
if (this.registered[eventName][reg].obj === obj && this.registered[eventName][reg].func.toString() === func.toString()) {
this.registered[eventName].splice(reg, 1)
}
}

@ -49,6 +49,7 @@
"color-support": "^1.1.3",
"colors": "^1.1.2",
"commander": "^2.13.0",
"deep-equal": "^1.0.1",
"ethereumjs-util": "^7.0.10",
"ethers": "^5.4.2",
"ethjs-util": "^0.1.6",

@ -170,8 +170,7 @@ export function compileFileOrFiles (filename: string, isDirectory: boolean, opts
* @param opts Options
* @param cb Callback
*/
export function compileContractSources (sources: SrcIfc, compilerConfig: CompilerConfiguration, importFileCb: any, opts: any, cb): void {
let compiler
export function compileContractSources (sources: SrcIfc, compiler: any, opts: any, cb): void {
const filepath = opts.testFilePath || ''
const testFileImportRegEx = /^(import)\s['"](remix_tests.sol|tests.sol)['"];/gm
@ -184,24 +183,14 @@ export function compileContractSources (sources: SrcIfc, compilerConfig: Compile
}
async.waterfall([
function loadCompiler (next) {
const { currentCompilerUrl, evmVersion, optimize, runs, usingWorker } = compilerConfig
compiler = new RemixCompiler(importFileCb)
compiler.set('evmVersion', evmVersion)
compiler.set('optimize', optimize)
compiler.set('runs', runs)
compiler.loadVersion(usingWorker, currentCompilerUrl)
// @ts-ignore
compiler.event.register('compilerLoaded', this, (version) => {
next()
})
},
function doCompilation (next) {
// @ts-ignore
compiler.event.register('compilationFinished', this, (success, data, source) => {
const compilationFinishedCb = (success, data, source) => {
if (opts && opts.event) opts.event.emit('compilationFinished', success, data, source)
next(null, data)
})
}
compiler.event.unregister('compilationFinished', compilationFinishedCb)
// @ts-ignore
compiler.event.register('compilationFinished', compilationFinishedCb)
compiler.compile(sources, filepath)
}
], function (err: Error | null | undefined, result: any) {

@ -1,4 +1,6 @@
import async, { ErrorCallback } from 'async'
import deepequal from 'deep-equal'
import { Compiler as RemixCompiler } from '@remix-project/remix-solidity'
import { compileContractSources, writeTestAccountsContract } from './compiler'
import { deployAll } from './deployer'
import { runTest } from './testRunner'
@ -16,6 +18,8 @@ export class UnitTestRunner {
accountsLibCode
testsAccounts: string[] | null
web3
compiler
compilerConfig
constructor () {
this.event = new EventEmitter()
@ -53,7 +57,22 @@ export class UnitTestRunner {
async.waterfall([
(next) => {
compileContractSources(contractSources, compilerConfig, importFileCb, { accounts: this.testsAccounts, testFilePath: opts.testFilePath, event: this.event }, next)
if (!deepequal(this.compilerConfig, compilerConfig)) {
this.compilerConfig = compilerConfig
const { currentCompilerUrl, evmVersion, optimize, runs, usingWorker } = compilerConfig
this.compiler = new RemixCompiler(importFileCb)
this.compiler.set('evmVersion', evmVersion)
this.compiler.set('optimize', optimize)
this.compiler.set('runs', runs)
this.compiler.loadVersion(usingWorker, currentCompilerUrl)
// @ts-ignore
this.compiler.event.register('compilerLoaded', this, (version) => {
next()
})
} else next()
},
(next) => {
compileContractSources(contractSources, this.compiler, { accounts: this.testsAccounts, testFilePath: opts.testFilePath, event: this.event }, next)
},
(compilationResult: compilationInterface, asts: ASTInterface, next) => {
for (const filename in asts) {

Loading…
Cancel
Save