Skip to content

Commit

Permalink
fix(test/console): register in the console in tests when ipc connected
Browse files Browse the repository at this point in the history
  • Loading branch information
jrainville authored and iurimatias committed Dec 14, 2018
1 parent 0950df2 commit 503a79c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/cmd/cmd_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ class EmbarkController {
});
engine.startService("storage");
engine.startService("codeGenerator");
engine.startService("console");
engine.startService("console", {forceRegister: true});
engine.startService("pluginCommand");
if (options.coverage) {
engine.startService("codeCoverage");
Expand Down
5 changes: 3 additions & 2 deletions src/lib/core/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,15 @@ class Engine {
this.registerModule('plugin_cmd', {embarkConfigFile: this.embarkConfig, embarkConfig: this.config.embarkConfig, packageFile: 'package.json'});
}

console(_options) {
console(options) {
this.registerModule('console', {
events: this.events,
plugins: this.plugins,
version: this.version,
ipc: this.ipc,
logger: this.logger,
config: this.config
config: this.config,
forceRegister: options.forceRegister
});
this.registerModule('authenticator');
}
Expand Down
4 changes: 3 additions & 1 deletion src/lib/modules/console/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Console {
private cmdHistoryFile: string;
private suggestions: Suggestions;
private providerReady: boolean;
private forceRegister: boolean;

constructor(embark: Embark, options: any) {
this.embark = embark;
Expand All @@ -37,6 +38,7 @@ class Console {
this.logger = options.logger;
this.ipc = options.ipc;
this.config = options.config;
this.forceRegister = options.forceRegister;
this.history = [];
this.cmdHistoryFile = options.cmdHistoryFile || fs.dappPath(".embark", "cmd_history");
this.providerReady = false;
Expand Down Expand Up @@ -179,7 +181,7 @@ class Console {
this.events.emit("runcode:register", "EmbarkJS", EmbarkJS, false);

EmbarkJS.Blockchain.done = true;
if (this.ipc.connected) {
if (this.ipc.connected && !this.forceRegister) {
return;
}

Expand Down

0 comments on commit 503a79c

Please sign in to comment.