fetch test files

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

@ -16,7 +16,7 @@ const TestTabLogic = require('./testTab/testTab')
const profile = {
name: 'solidityUnitTesting',
displayName: 'Solidity unit testing',
methods: ['testFromPath', 'testFromSource', 'setTestFolderPath'],
methods: ['testFromPath', 'testFromSource', 'setTestFolderPath', 'getTestlibs'],
events: [],
icon: 'assets/img/unitTesting.webp',
description: 'Fast tool to generate unit tests for your contracts',
@ -74,6 +74,10 @@ module.exports = class TestTab extends ViewPlugin {
}
}
getTestlibs() {
return { assertLibCode, accountsLibCode: this.testRunner.accountsLibCode}
}
async onActivation () {
const isSolidityActive = await this.call('manager', 'isActive', 'solidity')
if (!isSolidityActive) {

@ -117,7 +117,11 @@ export class CompilerImports extends Plugin {
* @returns {Promise} - string content
*/
async resolveAndSave (url, targetPath) {
if (url.indexOf('remix_tests.sol') !== -1) return remixTests.assertLibCode
if (url.indexOf('remix_tests.sol') !== -1 || url.indexOf('remix_accounts.sol') !== -1) {
const {assertLibCode, accountsLibCode} = await this.call('solidityUnitTesting', 'getTestlibs')
if (url === 'remix_tests.sol') return assertLibCode
else if (url === 'remix_accounts.sol') return accountsLibCode
}
try {
const provider = await this.call('fileManager', 'getProviderOf', url)
if (provider) {

Loading…
Cancel
Save