From 532d2d9834091ec1b994ccc1094e9e4b44d257a6 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 18 Jan 2021 19:44:56 +0530 Subject: [PATCH] compiler version tests working fine --- libs/remix-tests/src/compiler.ts | 13 +++++++++---- libs/remix-tests/tests/testRunner.cli.spec.ts | 3 +-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/libs/remix-tests/src/compiler.ts b/libs/remix-tests/src/compiler.ts index 0c6c3a0f27..9a608ed7e0 100644 --- a/libs/remix-tests/src/compiler.ts +++ b/libs/remix-tests/src/compiler.ts @@ -129,11 +129,16 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts: const {currentCompilerUrl, evmVersion, optimize, runs} = compilerConfig evmVersion ? compiler.set('evmVersion', evmVersion) : optimize ? compiler.set('optimize', optimize) : - runs ? compiler.set('runs', runs) : - currentCompilerUrl ? compiler.loadRemoteVersion(currentCompilerUrl) : compiler.onInternalCompilerLoaded() - compiler.event.register('compilerLoaded', this, function (version) { + runs ? compiler.set('runs', runs) : '' + if(currentCompilerUrl) { + compiler.loadRemoteVersion(currentCompilerUrl) + compiler.event.register('compilerLoaded', this, function (version) { + next() + }); + } else { + compiler.onInternalCompilerLoaded() next() - }); + } }, function doCompilation(next) { // @ts-ignore diff --git a/libs/remix-tests/tests/testRunner.cli.spec.ts b/libs/remix-tests/tests/testRunner.cli.spec.ts index 9347988a50..da5152ebb5 100644 --- a/libs/remix-tests/tests/testRunner.cli.spec.ts +++ b/libs/remix-tests/tests/testRunner.cli.spec.ts @@ -53,9 +53,8 @@ Commands: test('remix-tests running a test file with custom compiler version', () => { const res = spawnSync(executablePath, ['--compiler', '0.7.4', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) - console.log('res.stdout.toString().trim()---------->', res.stdout.toString().trim()) // match initial lines - expect(res.stdout.toString().trim()).toMatch(/Loading remote solc version v0.7.4+commit.3f05b770/) + expect(res.stdout.toString().trim().includes('Loading remote solc version v0.7.4+commit.3f05b770')).toBeTruthy() expect(res.stdout.toString().trim()).toMatch(/:: Running remix-tests - Unit testing for solidity ::/) expect(res.stdout.toString().trim()).toMatch(/creation of library remix_tests.sol:Assert pending.../) // match test result