diff --git a/apps/remix-ide/src/app/tabs/test-tab.js b/apps/remix-ide/src/app/tabs/test-tab.js index 86f8938e5b..5a243fae45 100644 --- a/apps/remix-ide/src/app/tabs/test-tab.js +++ b/apps/remix-ide/src/app/tabs/test-tab.js @@ -559,7 +559,7 @@ module.exports = class TestTab extends ViewPlugin { this.updateFinalResult(error, result, testFilePath) callback(error) }, (url, cb) => { - return this.contentImport.resolveAndSave(url).then((result) => cb(null, result)).catch((error) => cb(error.message)) + return this.contentImport.resolveAndSave(url, null, this.testRunner).then((result) => cb(null, result)).catch((error) => cb(error.message)) }, { testFilePath } ) }).catch((error) => { diff --git a/libs/remix-core-plugin/src/lib/compiler-content-imports.ts b/libs/remix-core-plugin/src/lib/compiler-content-imports.ts index 227c8cd2f1..11c398f0a6 100644 --- a/libs/remix-core-plugin/src/lib/compiler-content-imports.ts +++ b/libs/remix-core-plugin/src/lib/compiler-content-imports.ts @@ -117,15 +117,11 @@ export class CompilerImports extends Plugin { * @param {String} targetPath - (optional) internal path where the content should be saved to * @returns {Promise} - string content */ - async resolveAndSave (url, targetPath) { + async resolveAndSave (url, targetPath, testRunner = null) { if (url.indexOf('remix_tests.sol') !== -1 || url.indexOf('remix_accounts.sol') !== -1) { let content if (url === 'remix_tests.sol') content = assertLibCode - else if (url === 'remix_accounts.sol') { - this.testRunner = new UnitTestRunner() - await this.testRunner.init() - content = this.testRunner.accountsLibCode - } + else if (url === 'remix_accounts.sol' && testRunner) content = testRunner.accountsLibCode const provider = await this.call('fileManager', 'getProviderOf', null) if (provider) provider.addExternal('.deps/remix-tests/' + url, content, url) return content