Skip to content

Commit fce2467

Browse files
Fix bug that overwrites signing pkg during tests (#114)
* Fix bug that overwrites signing pkg during tests * Fix test coverage * run less CI builds for PRs * Fix cli test by running build first
1 parent 5625a23 commit fce2467

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
name: build
2-
on: [push, pull_request]
2+
on:
3+
push:
4+
branches:
5+
- master
6+
tags:
7+
- v*
8+
pull_request:
39

410
jobs:
511
ci:

src/RokuDeploy.spec.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('index', () => {
2929
stagingDir: stagingDir,
3030
signingPassword: '12345',
3131
host: 'localhost',
32-
rekeySignedPackage: `../../testSignedPackage.pkg`
32+
rekeySignedPackage: `${tempDir}/testSignedPackage.pkg`
3333
});
3434
options.rootDir = rootDir;
3535
fsExtra.emptyDirSync(tempDir);
@@ -555,7 +555,9 @@ describe('index', () => {
555555

556556
it('runs via the command line using the rokudeploy.json file', function test() {
557557
this.timeout(20000);
558-
child_process.execSync(`node dist/index.js`);
558+
//build the project
559+
child_process.execSync(`npm run build`, { stdio: 'inherit' });
560+
child_process.execSync(`node dist/index.js`, { stdio: 'inherit' });
559561
});
560562

561563
describe('generateBaseRequestOptions', () => {
@@ -911,7 +913,7 @@ describe('index', () => {
911913
<keyed-developer-id>${options.devId}</keyed-developer-id>
912914
</device-info>`;
913915
mockDoGetRequest(body);
914-
fsExtra.outputFileSync(`${rootDir}/${options.rekeySignedPackage}`, '');
916+
fsExtra.outputFileSync(path.resolve(rootDir, options.rekeySignedPackage), '');
915917
});
916918

917919
it('does not crash when archive is undefined', async () => {
@@ -931,8 +933,13 @@ describe('index', () => {
931933
<font color="red">Success.</font>
932934
</div>`;
933935
mockDoPostRequest(body);
934-
options.rekeySignedPackage = `../../testSignedPackage.pkg`;
935-
await rokuDeploy.rekeyDevice(options);
936+
options.rekeySignedPackage = s`../notReal.pkg`;
937+
try {
938+
fsExtra.writeFileSync(s`${tempDir}/notReal.pkg`, '');
939+
await rokuDeploy.rekeyDevice(options);
940+
} finally {
941+
fsExtra.removeSync(s`${tempDir}/notReal.pkg`);
942+
}
936943
});
937944

938945
it('should work with absolute path', async () => {
@@ -941,7 +948,7 @@ describe('index', () => {
941948
</div>`;
942949
mockDoPostRequest(body);
943950

944-
options.rekeySignedPackage = s`${cwd}/testSignedPackage.pkg`;
951+
options.rekeySignedPackage = s`${tempDir}/testSignedPackage.pkg`;
945952
await rokuDeploy.rekeyDevice(options);
946953
});
947954

0 commit comments

Comments
 (0)