Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/RokuDeploy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -797,10 +797,25 @@ describe('index', () => {
it('handles successful deploy with remoteDebug', () => {
options.failOnCompileError = true;
options.remoteDebug = true;
mockDoPostRequest();
const stub = mockDoPostRequest();

return rokuDeploy.publish(options).then((result) => {
expect(result.message).to.equal('Successful deploy');
expect(stub.getCall(0).args[0].formData.remotedebug).to.eql('1');
}, () => {
assert.fail('Should not have rejected the promise');
});
});

it('handles successful deploy with remotedebug_connect_early', () => {
options.failOnCompileError = true;
options.remoteDebug = true;
options.remoteDebugConnectEarly = true;
const stub = mockDoPostRequest();

return rokuDeploy.publish(options).then((result) => {
expect(result.message).to.equal('Successful deploy');
expect(stub.getCall(0).args[0].formData.remotedebug_connect_early).to.eql('1');
}, () => {
assert.fail('Should not have rejected the promise');
});
Expand Down Expand Up @@ -3104,7 +3119,7 @@ describe('index', () => {
}

function mockDoPostRequest(body = '', statusCode = 200) {
sinon.stub(rokuDeploy as any, 'doPostRequest').callsFake((params) => {
return sinon.stub(rokuDeploy as any, 'doPostRequest').callsFake((params) => {
let results = { response: { statusCode: statusCode }, body: body };
rokuDeploy['checkRequest'](results);
return Promise.resolve(results);
Expand Down
6 changes: 6 additions & 0 deletions src/RokuDeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,12 @@ export class RokuDeploy {
requestOptions.formData.remotedebug = '1';
}

//attach the remotedebug_connect_early if present
if (options.remoteDebugConnectEarly) {
// eslint-disable-next-line camelcase
requestOptions.formData.remotedebug_connect_early = '1';
}

//try to "replace" the channel first since that usually works.
let response: HttpResponse;
try {
Expand Down
6 changes: 6 additions & 0 deletions src/RokuDeployOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ export interface RokuDeployOptions {
*/
remoteDebug?: boolean;

/**
* When publishing a sideloaded channel, this flag can be used to tell the Roku device that, should any compile errors occur, a client device (such as vscode)
* will be trying to attach to the debug protocol control port to consume those compile errors. This must be used in conjuction with the `remoteDebug` option
*/
remoteDebugConnectEarly?: boolean;

/**
* The port used to send remote control commands (like home press, back, etc.). Defaults to 8060.
* This is mainly useful for things like emulators that use alternate ports,
Expand Down