Skip to content

Commit d6e89ba

Browse files
Merge master 2 (#231)
2 parents e36a627 + 1c8e6bb commit d6e89ba

5 files changed

Lines changed: 103 additions & 37 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3737
- eliminate top index functions ([#144](https://github.com/rokucommunity/roku-deploy/pull/144))
3838

3939

40-
40+
4141
## [3.16.1](https://github.com/rokucommunity/roku-deploy/compare/3.16.0...v3.16.1) - 2025-12-05
4242
### Added
4343
- Add ecpSettingMode to device-info interface ([#225](https://github.com/rokucommunity/roku-deploy/pull/225))
@@ -564,7 +564,3 @@ chore: Update package.json repository to support provenance (#218)
564564
## [1.0.0](https://github.com/RokuCommunity/roku-deploy/compare/v0.2.1...v1.0.0) - 2018-12-18
565565
### Added
566566
- support for negated globs
567-
568-
569-
570-

package-lock.json

Lines changed: 20 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,4 @@ export class ConnectionResetError extends Error {
116116

117117
export function isConnectionResetError(e: any): e is ConnectionResetError {
118118
return e?.constructor?.name === 'ConnectionResetError';
119-
}
119+
}

src/RokuDeploy.spec.ts

Lines changed: 80 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,8 +1241,74 @@ describe('RokuDeploy', () => {
12411241
});
12421242

12431243
it('does not set appType if not explicitly defined', async () => {
1244+
delete options.appType;
12441245
const stub = mockDoPostRequest();
12451246

1247+
fsExtra.outputFileSync(`${outDir}/${options.outFile}`, 'asdf');
1248+
1249+
const result = await rokuDeploy.sideload({
1250+
host: '1.2.3.4',
1251+
password: 'password',
1252+
outDir: outDir,
1253+
outFile: options.outFile,
1254+
deleteDevChannel: false
1255+
});
1256+
expect(result.message).to.equal('Successful sideload');
1257+
expect(stub.getCall(0).args[0].formData.app_type).to.be.undefined;
1258+
});
1259+
1260+
it('does not set appType if not appType is set to null or undefined', async () => {
1261+
const stub = mockDoPostRequest();
1262+
fsExtra.outputFileSync(`${outDir}/${options.outFile}`, 'asdf');
1263+
1264+
const result = await rokuDeploy.sideload({
1265+
host: '1.2.3.4',
1266+
password: 'password',
1267+
outDir: outDir,
1268+
outFile: options.outFile,
1269+
deleteDevChannel: false,
1270+
appType: null
1271+
});
1272+
expect(result.message).to.equal('Successful sideload');
1273+
expect(stub.getCall(0).args[0].formData.app_type).to.be.undefined;
1274+
});
1275+
1276+
it('sets appType="channel" when defined', async () => {
1277+
const stub = mockDoPostRequest();
1278+
fsExtra.outputFileSync(`${outDir}/${options.outFile}`, 'asdf');
1279+
1280+
const result = await rokuDeploy.sideload({
1281+
host: '1.2.3.4',
1282+
password: 'password',
1283+
outDir: outDir,
1284+
outFile: options.outFile,
1285+
deleteDevChannel: false,
1286+
appType: 'channel'
1287+
});
1288+
expect(result.message).to.equal('Successful sideload');
1289+
expect(stub.getCall(0).args[0].formData.app_type).to.eql('channel');
1290+
});
1291+
1292+
it('sets appType="dcl" when defined', async () => {
1293+
const stub = mockDoPostRequest();
1294+
fsExtra.outputFileSync(`${outDir}/${options.outFile}`, 'asdf');
1295+
1296+
const result = await rokuDeploy.sideload({
1297+
host: '1.2.3.4',
1298+
password: 'password',
1299+
outDir: outDir,
1300+
outFile: options.outFile,
1301+
deleteDevChannel: false,
1302+
appType: 'dcl'
1303+
});
1304+
expect(result.message).to.equal('Successful sideload');
1305+
expect(stub.getCall(0).args[0].formData.app_type).to.eql('dcl');
1306+
});
1307+
1308+
it('Does not reject when response contains compile error wording but config is set to ignore compile warnings', async () => {
1309+
const stub = mockDoPostRequest();
1310+
options.failOnCompileError = false;
1311+
12461312
const result = await rokuDeploy.sideload({
12471313
host: '1.2.3.4',
12481314
password: 'password',
@@ -1606,6 +1672,7 @@ describe('RokuDeploy', () => {
16061672
<font color="red">Success.</font>
16071673
</div>`;
16081674
mockDoPostRequest(body);
1675+
16091676
try {
16101677
fsExtra.writeFileSync(s`notReal.pkg`, '');
16111678
await rokuDeploy.rekeyDevice({
@@ -2906,7 +2973,7 @@ describe('RokuDeploy', () => {
29062973
outDir: outDir
29072974
});
29082975
const data = fsExtra.readFileSync(rokuDeploy['getOutputZipFilePath']({ outDir: outDir }));
2909-
const zip = await JSZip.loadAsync(data);
2976+
const zip = await JSZip.loadAsync(data as any);
29102977

29112978
const files = ['manifest'];
29122979
for (const file of files) {
@@ -2934,7 +3001,7 @@ describe('RokuDeploy', () => {
29343001
await rokuDeploy.zip(options);
29353002

29363003
const data = fsExtra.readFileSync(rokuDeploy['getOutputZipFilePath']({ outDir: outDir }));
2937-
const zip = await JSZip.loadAsync(data);
3004+
const zip = await JSZip.loadAsync(data as any);
29383005

29393006
for (const file of filePaths) {
29403007
const zipFileContents = await zip.file(file.toString())?.async('string');
@@ -3117,10 +3184,11 @@ describe('RokuDeploy', () => {
31173184

31183185
it('Finds folder using square brackets glob pattern', async () => {
31193186
fsExtra.outputFileSync(`${rootDir}/e/file.brs`, '');
3120-
expect(await getFilePaths([
3121-
'[test]/*'
3122-
],
3123-
rootDir
3187+
expect(await getFilePaths(
3188+
[
3189+
'[test]/*'
3190+
],
3191+
rootDir
31243192
)).to.eql([{
31253193
src: s`${rootDir}/e/file.brs`,
31263194
dest: s`e/file.brs`
@@ -3130,10 +3198,11 @@ describe('RokuDeploy', () => {
31303198
it('Finds folder with escaped square brackets glob pattern as name', async () => {
31313199
fsExtra.outputFileSync(`${rootDir}/[test]/file.brs`, '');
31323200
fsExtra.outputFileSync(`${rootDir}/e/file.brs`, '');
3133-
expect(await getFilePaths([
3134-
'\\[test\\]/*'
3135-
],
3136-
rootDir
3201+
expect(await getFilePaths(
3202+
[
3203+
'\\[test\\]/*'
3204+
],
3205+
rootDir
31373206
)).to.eql([{
31383207
src: s`${rootDir}/[test]/file.brs`,
31393208
dest: s`[test]/file.brs`
@@ -4402,4 +4471,4 @@ permission of Roku, Inc. is strictly prohibited.
44024471
</script>
44034472
</body>
44044473
</html>
4405-
`;
4474+
`;

src/RokuDeploy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ export class RokuDeploy {
569569
* Centralized function for handling POST http requests
570570
* @param params
571571
*/
572-
private async doPostRequest(params: any, verify = true) {
572+
private async doPostRequest(params: requestType.OptionsWithUrl, verify = true) {
573573
logger.info('handling POST request to', params.url);
574574
let results: { response: any; body: any } = await new Promise((resolve, reject) => {
575575

0 commit comments

Comments
 (0)