Skip to content

Commit 94ca366

Browse files
committed
Make tasks nullable-aware
1 parent 4f271b6 commit 94ca366

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

tasks/offlinePackagingTasks.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ async function doPackageOffline() {
7373
await doOfflinePackage(p.platformInfo, p.id, p.isFramework, packageJSON, packedVsixOutputRoot);
7474
}
7575
catch (err) {
76+
const message = (err instanceof Error ? err.stack : err) ?? '<unknown error>';
7677
// NOTE: Extra `\n---` at the end is because gulp will print this message following by the
7778
// stack trace of this line. So that seperates the two stack traces.
78-
throw Error(`Failed to create package ${p.id}. ${err.stack ?? err ?? '<unknown error>'}\n---`);
79+
throw Error(`Failed to create package ${p.id}. ${message}\n---`);
7980
}
8081
}
8182
}

tasks/spawnNode.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ export default async function spawnNode(args?: string[], options?: SpawnSyncOpti
2323
stdio: "inherit"
2424
};
2525

26-
console.log(`starting ${nodePath} ${args.join(' ')}`);
26+
console.log(`starting ${nodePath} ${args ? args.join(' ') : ''}`);
2727

2828
const buffer = spawnSync(nodePath, args, optionsWithFullEnvironment);
2929

3030
return { code: buffer.status, signal: buffer.signal };
31-
}
31+
}

tasks/testTasks.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ gulp.task("test:feature", async () => {
1818

1919
const result = await spawnNode([featureTestRunnerPath], { env });
2020

21-
if (result.code > 0) {
21+
if (result.code === null || result.code > 0) {
2222
// Ensure that gulp fails when tests fail
2323
throw new Error(`Exit code: ${result.code} Signal: ${result.signal}`);
2424
}
@@ -35,7 +35,7 @@ gulp.task("test:unit", async () => {
3535
'test/unitTests/**/*.test.ts'
3636
]);
3737

38-
if (result.code > 0) {
38+
if (result.code === null || result.code > 0) {
3939
// Ensure that gulp fails when tests fail
4040
throw new Error(`Exit code: ${result.code} Signal: ${result.signal}`);
4141
}
@@ -83,7 +83,7 @@ async function runIntegrationTest(testAssetName: string) {
8383

8484
const result = await spawnNode([integrationTestRunnerPath], { env, cwd: rootPath });
8585

86-
if (result.code > 0) {
86+
if (result.code === null || result.code > 0) {
8787
// Ensure that gulp fails when tests fail
8888
throw new Error(`Exit code: ${result.code} Signal: ${result.signal}`);
8989
}

0 commit comments

Comments
 (0)