instance creation removed

pull/1738/head
Aniket-Engg 3 years ago committed by yann300
parent 434b97ae0b
commit b2ffff3e83
  1. 2
      apps/remix-ide/src/app/tabs/test-tab.js
  2. 8
      libs/remix-core-plugin/src/lib/compiler-content-imports.ts

@ -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) => {

@ -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

Loading…
Cancel
Save