mirror of https://github.com/embarklabs/embark.git
feat(@embark/test-runner): show interface contract message in tests
But only show it if the contract was in the contract config
This commit is contained in:
parent
334d3bcdc5
commit
f9d7a3f41b
|
@ -14,6 +14,7 @@ class ContractsManager {
|
||||||
this.events = embark.events;
|
this.events = embark.events;
|
||||||
this.fs = embark.fs;
|
this.fs = embark.fs;
|
||||||
this.plugins = options.plugins;
|
this.plugins = options.plugins;
|
||||||
|
this.currentContext = embark.currentContext || [];
|
||||||
|
|
||||||
this.contracts = {};
|
this.contracts = {};
|
||||||
this.contractDependencies = {};
|
this.contractDependencies = {};
|
||||||
|
@ -376,7 +377,11 @@ class ContractsManager {
|
||||||
},
|
},
|
||||||
function setDeployIntention(callback) {
|
function setDeployIntention(callback) {
|
||||||
let className, contract;
|
let className, contract;
|
||||||
let showInterfaceMessage = false;
|
let showInterfaceMessageTrace = false;
|
||||||
|
let showInterfaceMessageWarn = false;
|
||||||
|
const isTest = self.currentContext.includes(constants.contexts.test);
|
||||||
|
const contractsInConfig = Object.keys(self.contractsConfig.contracts);
|
||||||
|
|
||||||
for (className in self.contracts) {
|
for (className in self.contracts) {
|
||||||
contract = self.contracts[className];
|
contract = self.contracts[className];
|
||||||
contract.deploy = (contract.deploy === undefined) || contract.deploy;
|
contract.deploy = (contract.deploy === undefined) || contract.deploy;
|
||||||
|
@ -390,17 +395,20 @@ class ContractsManager {
|
||||||
|
|
||||||
if (contract.code === "") {
|
if (contract.code === "") {
|
||||||
const message = __("assuming %s to be an interface", className);
|
const message = __("assuming %s to be an interface", className);
|
||||||
showInterfaceMessage = true;
|
if (contract.silent || (isTest && !contractsInConfig.includes(className))) {
|
||||||
if (contract.silent) {
|
showInterfaceMessageTrace = true;
|
||||||
self.logger.trace(message);
|
self.logger.trace(message);
|
||||||
} else {
|
} else {
|
||||||
self.logger.info(message);
|
showInterfaceMessageWarn = true;
|
||||||
|
self.logger.warn(message);
|
||||||
}
|
}
|
||||||
contract.deploy = false;
|
contract.deploy = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (showInterfaceMessage) {
|
if (showInterfaceMessageTrace || showInterfaceMessageWarn) {
|
||||||
self.logger.warn(__('To get more details on interface contracts, go here: %s', 'https://embark.status.im/docs/troubleshooting.html#Assuming-Contract-to-be-an-interface'.underline));
|
let logFunction = showInterfaceMessageWarn ? self.logger.warn : self.logger.trace;
|
||||||
|
logFunction.call(self.logger, __('To get more details on interface Smart contracts, go here: %s', 'https://embark.status.im/docs/troubleshooting.html#Assuming-Contract-to-be-an-interface'.underline));
|
||||||
|
|
||||||
}
|
}
|
||||||
callback();
|
callback();
|
||||||
},
|
},
|
||||||
|
|
|
@ -216,6 +216,7 @@ class Test {
|
||||||
console.info('Compiling contracts'.cyan);
|
console.info('Compiling contracts'.cyan);
|
||||||
self.events.request("contracts:build", false, (err) => {
|
self.events.request("contracts:build", false, (err) => {
|
||||||
self.firstDeployment = false;
|
self.firstDeployment = false;
|
||||||
|
console.info('Compilation done\n'.cyan);
|
||||||
next(err);
|
next(err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -18,7 +18,7 @@ Issues typically occur if NodeJS and/or Embark are installed using `sudo`, avoid
|
||||||
|
|
||||||
## Assuming Contract to be an interface
|
## Assuming Contract to be an interface
|
||||||
|
|
||||||
This warning happens when Embark can't deploy one of your contracts because the compiler did not return a bytecode.
|
This warning happens when Embark can't deploy one of your Smart Contracts because the compiler did not return a bytecode.
|
||||||
|
|
||||||
Here are some of the reasons:
|
Here are some of the reasons:
|
||||||
- If it inherits from an interface, it must have all the functions implemented
|
- If it inherits from an interface, it must have all the functions implemented
|
||||||
|
|
Loading…
Reference in New Issue