create test files while running tests

pull/1738/head
Aniket-Engg 3 years ago committed by yann300
parent f9e939a732
commit 1ff0ad757c
  1. 8
      libs/remix-core-plugin/src/lib/compiler-content-imports.ts

@ -118,8 +118,12 @@ export class CompilerImports extends Plugin {
async resolveAndSave (url, targetPath) { async resolveAndSave (url, targetPath) {
if (url.indexOf('remix_tests.sol') !== -1 || url.indexOf('remix_accounts.sol') !== -1) { if (url.indexOf('remix_tests.sol') !== -1 || url.indexOf('remix_accounts.sol') !== -1) {
const { assertLibCode, accountsLibCode } = await this.call('solidityUnitTesting', 'getTestlibs') const { assertLibCode, accountsLibCode } = await this.call('solidityUnitTesting', 'getTestlibs')
if (url === 'remix_tests.sol') return assertLibCode let content
else if (url === 'remix_accounts.sol') return accountsLibCode if (url === 'remix_tests.sol') content = assertLibCode
else if (url === 'remix_accounts.sol') content = accountsLibCode
const provider = await this.call('fileManager', 'getProviderOf', null)
if (provider) provider.addExternal('.deps/remix-tests/' + url, content, url)
return content
} }
try { try {
const provider = await this.call('fileManager', 'getProviderOf', url) const provider = await this.call('fileManager', 'getProviderOf', url)

Loading…
Cancel
Save