@simplysf/simply-cicd 0.15.2 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +127 -38
- package/lib/commands/simply/cicd/build/lwc-jest.d.ts +2 -1
- package/lib/commands/simply/cicd/build/lwc-jest.js +8 -3
- package/lib/commands/simply/cicd/build/lwc-jest.js.map +1 -1
- package/lib/commands/simply/cicd/notify/build.d.ts +28 -0
- package/lib/commands/simply/cicd/notify/build.js +136 -0
- package/lib/commands/simply/cicd/notify/build.js.map +1 -0
- package/lib/common/build/lwcJest.d.ts +17 -1
- package/lib/common/build/lwcJest.js +98 -8
- package/lib/common/build/lwcJest.js.map +1 -1
- package/lib/common/notify/buildNotification.d.ts +53 -0
- package/lib/common/notify/buildNotification.js +176 -0
- package/lib/common/notify/buildNotification.js.map +1 -0
- package/lib/common/notify/templates.d.ts +2 -0
- package/lib/common/notify/templates.js +21 -0
- package/lib/common/notify/templates.js.map +1 -1
- package/messages/simply.cicd.build.lwc-jest.md +9 -1
- package/messages/simply.cicd.notify.build.md +83 -0
- package/messages/simply.cicd.notify.teams.md +1 -1
- package/oclif.manifest.json +1499 -1306
- package/package.json +2 -2
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, SimplySF.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Messages } from '@salesforce/core';
|
|
17
|
+
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
|
|
18
|
+
import { listAlmProviderKinds } from '@simplysf/simply-cicd-core';
|
|
19
|
+
import { logger } from '../../../../common/logger.js';
|
|
20
|
+
import { sendBuildNotification, } from '../../../../common/notify/buildNotification.js';
|
|
21
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
22
|
+
const messages = Messages.loadMessages('@simplysf/simply-cicd', 'simply.cicd.notify.build');
|
|
23
|
+
/** Sends a build job's failure, or its new package version and stories, to Microsoft Teams. */
|
|
24
|
+
export default class NotifyBuild extends SfCommand {
|
|
25
|
+
static summary = messages.getMessage('summary');
|
|
26
|
+
static description = messages.getMessage('description');
|
|
27
|
+
static examples = messages.getMessages('examples');
|
|
28
|
+
static flags = {
|
|
29
|
+
...SfCommand.baseFlags,
|
|
30
|
+
'ci-commit-ref-name': Flags.string({
|
|
31
|
+
summary: messages.getMessage('flags.ci-commit-ref-name.summary'),
|
|
32
|
+
env: 'SIMPLY_CICD_CI_COMMIT_REF_NAME',
|
|
33
|
+
}),
|
|
34
|
+
'ci-job-name': Flags.string({
|
|
35
|
+
summary: messages.getMessage('flags.ci-job-name.summary'),
|
|
36
|
+
env: 'SIMPLY_CICD_CI_JOB_NAME',
|
|
37
|
+
}),
|
|
38
|
+
'ci-job-stage': Flags.string({
|
|
39
|
+
summary: messages.getMessage('flags.ci-job-stage.summary'),
|
|
40
|
+
env: 'SIMPLY_CICD_CI_JOB_STAGE',
|
|
41
|
+
}),
|
|
42
|
+
'ci-job-status': Flags.string({
|
|
43
|
+
summary: messages.getMessage('flags.ci-job-status.summary'),
|
|
44
|
+
env: 'SIMPLY_CICD_CI_JOB_STATUS',
|
|
45
|
+
}),
|
|
46
|
+
'ci-pipeline-id': Flags.string({
|
|
47
|
+
summary: messages.getMessage('flags.ci-pipeline-id.summary'),
|
|
48
|
+
env: 'SIMPLY_CICD_CI_PIPELINE_ID',
|
|
49
|
+
}),
|
|
50
|
+
'ci-pipeline-url': Flags.string({
|
|
51
|
+
summary: messages.getMessage('flags.ci-pipeline-url.summary'),
|
|
52
|
+
env: 'SIMPLY_CICD_CI_PIPELINE_URL',
|
|
53
|
+
}),
|
|
54
|
+
'ci-project-title': Flags.string({
|
|
55
|
+
summary: messages.getMessage('flags.ci-project-title.summary'),
|
|
56
|
+
env: 'SIMPLY_CICD_CI_PROJECT_TITLE',
|
|
57
|
+
}),
|
|
58
|
+
'subscriber-package-version-id': Flags.string({
|
|
59
|
+
summary: messages.getMessage('flags.subscriber-package-version-id.summary'),
|
|
60
|
+
env: 'SIMPLY_CICD_SUBSCRIBER_PACKAGE_VERSION_ID',
|
|
61
|
+
}),
|
|
62
|
+
enabled: Flags.boolean({
|
|
63
|
+
summary: messages.getMessage('flags.enabled.summary'),
|
|
64
|
+
default: false,
|
|
65
|
+
env: 'SIMPLY_CICD_ENABLED',
|
|
66
|
+
}),
|
|
67
|
+
'alm-base-url': Flags.string({
|
|
68
|
+
summary: messages.getMessage('flags.alm-base-url.summary'),
|
|
69
|
+
env: 'SIMPLY_CICD_ALM_BASE_URL',
|
|
70
|
+
}),
|
|
71
|
+
'alm-project-key': Flags.string({
|
|
72
|
+
summary: messages.getMessage('flags.alm-project-key.summary'),
|
|
73
|
+
env: 'SIMPLY_CICD_ALM_PROJECT_KEY',
|
|
74
|
+
}),
|
|
75
|
+
'alm-provider': Flags.custom({ options: listAlmProviderKinds() })({
|
|
76
|
+
summary: messages.getMessage('flags.alm-provider.summary'),
|
|
77
|
+
default: 'jira',
|
|
78
|
+
env: 'SIMPLY_CICD_ALM_PROVIDER',
|
|
79
|
+
}),
|
|
80
|
+
'teams-webhook-url': Flags.string({
|
|
81
|
+
summary: messages.getMessage('flags.teams-webhook-url.summary'),
|
|
82
|
+
multiple: true,
|
|
83
|
+
}),
|
|
84
|
+
debug: Flags.boolean({
|
|
85
|
+
summary: messages.getMessage('flags.debug.summary'),
|
|
86
|
+
default: false,
|
|
87
|
+
env: 'SIMPLY_CICD_DEBUG',
|
|
88
|
+
}),
|
|
89
|
+
};
|
|
90
|
+
async run() {
|
|
91
|
+
const { flags } = await this.parse(NotifyBuild);
|
|
92
|
+
logger.raw('\n' + '='.repeat(80));
|
|
93
|
+
logger.info('>>> Sending Teams Notification <<<');
|
|
94
|
+
logger.raw('='.repeat(80) + '\n');
|
|
95
|
+
if (flags.debug) {
|
|
96
|
+
logger.debug('Incoming Parameters:', flags);
|
|
97
|
+
}
|
|
98
|
+
if (!flags.enabled) {
|
|
99
|
+
logger.info('Teams notification is disabled. Skipping.');
|
|
100
|
+
return { sent: false };
|
|
101
|
+
}
|
|
102
|
+
if (!flags['teams-webhook-url'] || flags['teams-webhook-url'].length === 0) {
|
|
103
|
+
throw messages.createError('error.missingTeamsWebhookUrl');
|
|
104
|
+
}
|
|
105
|
+
const options = {
|
|
106
|
+
ciCommitRefName: flags['ci-commit-ref-name'],
|
|
107
|
+
ciJobName: flags['ci-job-name'],
|
|
108
|
+
ciJobStage: flags['ci-job-stage'],
|
|
109
|
+
ciJobStatus: flags['ci-job-status'],
|
|
110
|
+
ciPipelineId: flags['ci-pipeline-id'],
|
|
111
|
+
ciPipelineUrl: flags['ci-pipeline-url'],
|
|
112
|
+
ciProjectTitle: flags['ci-project-title'],
|
|
113
|
+
subscriberPackageVersionId: flags['subscriber-package-version-id'],
|
|
114
|
+
almBaseUrl: flags['alm-base-url'],
|
|
115
|
+
almProjectKey: flags['alm-project-key'],
|
|
116
|
+
almProvider: flags['alm-provider'],
|
|
117
|
+
teamsWebhookUrl: flags['teams-webhook-url'],
|
|
118
|
+
debug: flags.debug,
|
|
119
|
+
};
|
|
120
|
+
try {
|
|
121
|
+
const result = await sendBuildNotification(options);
|
|
122
|
+
logger.raw('\n' + '='.repeat(80));
|
|
123
|
+
logger.success(result.sent ? 'Successfully sent notification' : 'No notification needed');
|
|
124
|
+
logger.raw('='.repeat(80) + '\n');
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
logger.raw('\n' + '='.repeat(80));
|
|
129
|
+
logger.error('Error sending notification');
|
|
130
|
+
logger.raw(error.message);
|
|
131
|
+
logger.raw('='.repeat(80) + '\n');
|
|
132
|
+
throw error;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../../src/commands/simply/cicd/notify/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAwB,MAAM,4BAA4B,CAAC;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EACL,qBAAqB,GAGtB,MAAM,gDAAgD,CAAC;AAExD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,CAAC;AAI5F,+FAA+F;AAC/F,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,SAA4B;IAC5D,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAE5D,MAAM,CAAU,KAAK,GAAG;QAC7B,GAAG,SAAS,CAAC,SAAS;QACtB,oBAAoB,EAAE,KAAK,CAAC,MAAM,CAAC;YACjC,OA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CAAC,wBAAwB,CAAC,CAAC;YAC1F,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;YAElC,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;YAClC,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;YAC3C,MAAM,CAAC,GAAG,CAAE,KAAe,CAAC,OAAO,CAAC,CAAC;YACrC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;YAClC,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC"}
|
|
@@ -1,9 +1,25 @@
|
|
|
1
|
+
/** Where `runLwcJest` writes the JUnit report, mirroring `runApexTests`'s `./test-results/apex`. */
|
|
2
|
+
export declare const LWC_JEST_RESULTS_DIR = "./test-results/lwc";
|
|
3
|
+
export declare const LWC_JEST_RESULTS_FILE = "test-result.xml";
|
|
1
4
|
export type RunLwcJestOptions = {
|
|
2
5
|
disabled?: boolean;
|
|
6
|
+
failOnTestFailure?: boolean;
|
|
7
|
+
projectDir?: string;
|
|
3
8
|
};
|
|
4
9
|
export type RunLwcJestResult = {
|
|
5
10
|
skipped: boolean;
|
|
6
11
|
success: boolean;
|
|
7
12
|
};
|
|
8
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Builds an ES module Jest config that loads the project's own config and adds `jest-junit` to its
|
|
15
|
+
* reporters, rather than replacing them the way a CLI `--reporters` would. `rootDir` is pinned to the
|
|
16
|
+
* project, since Jest would otherwise default it to the wrapper's own (temporary) directory.
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildJunitJestConfig(projectConfigFile: string, projectDir: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Installs the LWC Jest test libraries and runs the project's LWC Jest tests with coverage, writing
|
|
21
|
+
* a JUnit report to `./test-results/lwc/test-result.xml` alongside any reporters the project's own
|
|
22
|
+
* Jest config sets. A failure is logged and returned, unless `failOnTestFailure` is set, in which
|
|
23
|
+
* case it also throws.
|
|
24
|
+
*/
|
|
9
25
|
export declare function runLwcJest(options: RunLwcJestOptions): Promise<RunLwcJestResult>;
|
|
@@ -13,24 +13,114 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { promises as fs } from 'node:fs';
|
|
17
|
+
import os from 'node:os';
|
|
18
|
+
import path from 'node:path';
|
|
19
|
+
import { pathToFileURL } from 'node:url';
|
|
16
20
|
import { execa } from 'execa';
|
|
17
21
|
import { logger } from '../logger.js';
|
|
18
|
-
/**
|
|
22
|
+
/** Where `runLwcJest` writes the JUnit report, mirroring `runApexTests`'s `./test-results/apex`. */
|
|
23
|
+
export const LWC_JEST_RESULTS_DIR = './test-results/lwc';
|
|
24
|
+
export const LWC_JEST_RESULTS_FILE = 'test-result.xml';
|
|
25
|
+
/** The project config files `sfdx-lwc-jest` recognizes; with none present it passes its own default `--config`. */
|
|
26
|
+
const PROJECT_JEST_CONFIG_FILES = ['jest.config.js', 'jest.config.mjs', 'jest.config.cjs'];
|
|
27
|
+
async function findProjectJestConfig(projectDir) {
|
|
28
|
+
for (const file of PROJECT_JEST_CONFIG_FILES) {
|
|
29
|
+
const configPath = path.join(projectDir, file);
|
|
30
|
+
try {
|
|
31
|
+
// eslint-disable-next-line no-await-in-loop -- first match wins, in sfdx-lwc-jest's order
|
|
32
|
+
await fs.access(configPath);
|
|
33
|
+
return configPath;
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// not present; try the next name
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Builds an ES module Jest config that loads the project's own config and adds `jest-junit` to its
|
|
43
|
+
* reporters, rather than replacing them the way a CLI `--reporters` would. `rootDir` is pinned to the
|
|
44
|
+
* project, since Jest would otherwise default it to the wrapper's own (temporary) directory.
|
|
45
|
+
*/
|
|
46
|
+
export function buildJunitJestConfig(projectConfigFile, projectDir) {
|
|
47
|
+
// A config function rather than top-level await: Jest loads config files with require() first, and
|
|
48
|
+
// require() can't load an ES module that uses top-level await.
|
|
49
|
+
return `import path from 'node:path';
|
|
50
|
+
|
|
51
|
+
export default async () => {
|
|
52
|
+
const mod = await import(${JSON.stringify(pathToFileURL(projectConfigFile).href)});
|
|
53
|
+
let config = mod.default ?? mod;
|
|
54
|
+
if (typeof config === 'function') {
|
|
55
|
+
config = await config();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const reporters = config.reporters ?? ['default'];
|
|
59
|
+
const hasJunit = reporters.some((reporter) => (Array.isArray(reporter) ? reporter[0] : reporter) === 'jest-junit');
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
...config,
|
|
63
|
+
rootDir: path.resolve(${JSON.stringify(projectDir)}, config.rootDir ?? '.'),
|
|
64
|
+
reporters: hasJunit ? reporters : [...reporters, 'jest-junit'],
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
`;
|
|
68
|
+
}
|
|
69
|
+
function failRun(options, message, error) {
|
|
70
|
+
logger.error(message);
|
|
71
|
+
if (options.failOnTestFailure) {
|
|
72
|
+
throw new Error(message, { cause: error });
|
|
73
|
+
}
|
|
74
|
+
return { skipped: false, success: false };
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Installs the LWC Jest test libraries and runs the project's LWC Jest tests with coverage, writing
|
|
78
|
+
* a JUnit report to `./test-results/lwc/test-result.xml` alongside any reporters the project's own
|
|
79
|
+
* Jest config sets. A failure is logged and returned, unless `failOnTestFailure` is set, in which
|
|
80
|
+
* case it also throws.
|
|
81
|
+
*/
|
|
19
82
|
export async function runLwcJest(options) {
|
|
20
83
|
if (options.disabled) {
|
|
21
84
|
logger.warn('lwc-jest is disabled. Skipping.');
|
|
22
85
|
return { skipped: true, success: false };
|
|
23
86
|
}
|
|
87
|
+
const projectDir = options.projectDir ?? process.cwd();
|
|
24
88
|
logger.info('Running LWC Jest tests...');
|
|
89
|
+
// Created up front so a pipeline's `when: always` artifact path exists even if Jest never starts.
|
|
90
|
+
await fs.mkdir(path.join(projectDir, LWC_JEST_RESULTS_DIR), { recursive: true });
|
|
25
91
|
try {
|
|
26
|
-
await execa('npm', ['install', '@salesforce/sfdx-lwc-jest', '@sa11y/jest'
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
92
|
+
await execa('npm', ['install', '@salesforce/sfdx-lwc-jest', '@sa11y/jest', 'jest-junit'], {
|
|
93
|
+
cwd: projectDir,
|
|
94
|
+
stdio: 'pipe',
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
return failRun(options, 'Failed to install the LWC Jest test libraries.', error);
|
|
99
|
+
}
|
|
100
|
+
const projectConfig = await findProjectJestConfig(projectDir);
|
|
101
|
+
const wrapperDir = projectConfig ? await fs.mkdtemp(path.join(os.tmpdir(), 'lwc-jest-')) : undefined;
|
|
102
|
+
try {
|
|
103
|
+
let reporterArgs = ['--reporters=default', '--reporters=jest-junit'];
|
|
104
|
+
if (projectConfig && wrapperDir) {
|
|
105
|
+
const wrapperConfig = path.join(wrapperDir, 'jest.config.mjs');
|
|
106
|
+
await fs.writeFile(wrapperConfig, buildJunitJestConfig(projectConfig, projectDir));
|
|
107
|
+
reporterArgs = [`--config=${wrapperConfig}`];
|
|
108
|
+
}
|
|
109
|
+
await execa('npx', ['sfdx-lwc-jest', '--coverage', '--', '--passWithNoTests', ...reporterArgs], {
|
|
110
|
+
cwd: projectDir,
|
|
111
|
+
stdio: 'inherit',
|
|
112
|
+
env: { JEST_JUNIT_OUTPUT_DIR: LWC_JEST_RESULTS_DIR, JEST_JUNIT_OUTPUT_NAME: LWC_JEST_RESULTS_FILE },
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
return failRun(options, 'LWC Jest tests failed.', error);
|
|
30
117
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
118
|
+
finally {
|
|
119
|
+
if (wrapperDir) {
|
|
120
|
+
await fs.rm(wrapperDir, { recursive: true, force: true });
|
|
121
|
+
}
|
|
34
122
|
}
|
|
123
|
+
logger.success('LWC Jest tests completed.');
|
|
124
|
+
return { skipped: false, success: true };
|
|
35
125
|
}
|
|
36
126
|
//# sourceMappingURL=lwcJest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lwcJest.js","sourceRoot":"","sources":["../../../src/common/build/lwcJest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"lwcJest.js","sourceRoot":"","sources":["../../../src/common/build/lwcJest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,oGAAoG;AACpG,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AACzD,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEvD,mHAAmH;AACnH,MAAM,yBAAyB,GAAG,CAAC,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;AAK3F,KAA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AE,YAAY,EAAE,IAAI,EAAE,mBAAmB,EAAE,GAAG,YAAY,CAAC,EAAE;YAC9F,GAAG,EAAE,UAAU;YACf,KAAK,EAAE,SAAS;YAChB,GAAG,EAAE,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE;SACpG,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,OAAO,CAAC,OAAO,EAAE,wBAAwB,EAAE,KAAK,CAAC,CAAC;IAC3D,CAAC;YAAS,CAAC;QACT,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAC5C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type AlmProviderKind } from '@simplysf/simply-cicd-core';
|
|
2
|
+
import { type CommitStories } from './getCommitStories.js';
|
|
3
|
+
/** The file `build create-package-version` writes the new version's `04t` ID to. */
|
|
4
|
+
export declare const SUBSCRIBER_PACKAGE_VERSION_ID_FILE = "subscriberPackageVersionId.env";
|
|
5
|
+
export type NotifyBuildResult = {
|
|
6
|
+
sent: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type NotifyBuildOptions = {
|
|
9
|
+
ciCommitRefName?: string;
|
|
10
|
+
ciJobName?: string;
|
|
11
|
+
ciJobStage?: string;
|
|
12
|
+
ciJobStatus?: string;
|
|
13
|
+
ciPipelineId?: string;
|
|
14
|
+
ciPipelineUrl?: string;
|
|
15
|
+
ciProjectTitle?: string;
|
|
16
|
+
subscriberPackageVersionId?: string;
|
|
17
|
+
almBaseUrl?: string;
|
|
18
|
+
almProjectKey?: string;
|
|
19
|
+
almProvider?: AlmProviderKind;
|
|
20
|
+
teamsWebhookUrl?: string[];
|
|
21
|
+
debug: boolean;
|
|
22
|
+
};
|
|
23
|
+
/** The new package version's git tag and the issue references since the previous one. */
|
|
24
|
+
export type PackageVersionHistory = CommitStories & {
|
|
25
|
+
versionTag: string;
|
|
26
|
+
previousVersionTag: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The `04t` ID of a package version created in this job: the explicit value if given, otherwise the
|
|
30
|
+
* one `build create-package-version` wrote to {@link SUBSCRIBER_PACKAGE_VERSION_ID_FILE}. `undefined`
|
|
31
|
+
* when the job created none.
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveSubscriberPackageVersionId(explicit?: string): Promise<string | undefined>;
|
|
34
|
+
/** Fetches the tags, and the full history when the CI clone is shallow, so tags can be described and diffed. */
|
|
35
|
+
export declare function fetchVersionHistory(): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* The tag at `HEAD` that `build create-package-version` annotated with `subscriberPackageVersionId`.
|
|
38
|
+
* Matching on the annotation rather than the name works for any version tag format or suffix.
|
|
39
|
+
*/
|
|
40
|
+
export declare function findPackageVersionTag(subscriberPackageVersionId: string): Promise<string | undefined>;
|
|
41
|
+
/** The nearest version tag, in the project's format, before `versionTag`. `undefined` for a package's first version. */
|
|
42
|
+
export declare function findPreviousVersionTag(versionTag: string): Promise<string | undefined>;
|
|
43
|
+
/**
|
|
44
|
+
* Resolves the new version's tag, the previous version's tag, and the issue references in between.
|
|
45
|
+
* Never throws: anything it can't resolve comes back as `N/A`, because a notification shouldn't be
|
|
46
|
+
* what fails a build.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getPackageVersionHistory(subscriberPackageVersionId: string, options: Pick<NotifyBuildOptions, 'almBaseUrl' | 'almProjectKey' | 'almProvider' | 'debug'>): Promise<PackageVersionHistory>;
|
|
49
|
+
/**
|
|
50
|
+
* Posts a failure card for a failed build job, or a package version card for a successful job that
|
|
51
|
+
* created a package version. Any other job result sends nothing.
|
|
52
|
+
*/
|
|
53
|
+
export declare function sendBuildNotification(options: NotifyBuildOptions): Promise<NotifyBuildResult>;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, SimplySF.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { promises as fs } from 'node:fs';
|
|
17
|
+
import { execa } from 'execa';
|
|
18
|
+
import { isSubscriberPackageVersionId, readSfdxProject } from '@simplysf/simply-core';
|
|
19
|
+
import { createAlmProvider } from '@simplysf/simply-cicd-core';
|
|
20
|
+
import { VersionTagFormat } from '../build/versionTagFormat.js';
|
|
21
|
+
import { logger } from '../logger.js';
|
|
22
|
+
import { NOT_AVAILABLE, renderIssuesFromCommitLog } from './getCommitStories.js';
|
|
23
|
+
import { renderNotifyTemplate } from './renderTemplate.js';
|
|
24
|
+
import { sendNotification } from './sendNotification.js';
|
|
25
|
+
/** The file `build create-package-version` writes the new version's `04t` ID to. */
|
|
26
|
+
export const SUBSCRIBER_PACKAGE_VERSION_ID_FILE = 'subscriberPackageVersionId.env';
|
|
27
|
+
/**
|
|
28
|
+
* The `04t` ID of a package version created in this job: the explicit value if given, otherwise the
|
|
29
|
+
* one `build create-package-version` wrote to {@link SUBSCRIBER_PACKAGE_VERSION_ID_FILE}. `undefined`
|
|
30
|
+
* when the job created none.
|
|
31
|
+
*/
|
|
32
|
+
export async function resolveSubscriberPackageVersionId(explicit) {
|
|
33
|
+
if (explicit) {
|
|
34
|
+
return explicit;
|
|
35
|
+
}
|
|
36
|
+
let content;
|
|
37
|
+
try {
|
|
38
|
+
content = await fs.readFile(SUBSCRIBER_PACKAGE_VERSION_ID_FILE, 'utf8');
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
const value = /^SUBSCRIBER_PACKAGE_VERSION_ID=(?<id>\S+)\s*$/m.exec(content)?.groups?.id;
|
|
44
|
+
return value && isSubscriberPackageVersionId(value) ? value : undefined;
|
|
45
|
+
}
|
|
46
|
+
/** Fetches the tags, and the full history when the CI clone is shallow, so tags can be described and diffed. */
|
|
47
|
+
export async function fetchVersionHistory() {
|
|
48
|
+
const { stdout } = await execa('git', ['rev-parse', '--is-shallow-repository']);
|
|
49
|
+
const unshallow = stdout.trim() === 'true' ? ['--unshallow'] : [];
|
|
50
|
+
await execa('git', ['fetch', ...unshallow, '--tags', '--quiet']);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The tag at `HEAD` that `build create-package-version` annotated with `subscriberPackageVersionId`.
|
|
54
|
+
* Matching on the annotation rather than the name works for any version tag format or suffix.
|
|
55
|
+
*/
|
|
56
|
+
export async function findPackageVersionTag(subscriberPackageVersionId) {
|
|
57
|
+
const { stdout } = await execa('git', [
|
|
58
|
+
'tag',
|
|
59
|
+
'--points-at',
|
|
60
|
+
'HEAD',
|
|
61
|
+
'--format=%(refname:short)%09%(contents:subject)',
|
|
62
|
+
]);
|
|
63
|
+
return stdout
|
|
64
|
+
.split(/\r?\n/)
|
|
65
|
+
.map((line) => line.split('\t'))
|
|
66
|
+
.find(([, subject]) => subject?.trim() === subscriberPackageVersionId)?.[0];
|
|
67
|
+
}
|
|
68
|
+
/** The nearest version tag, in the project's format, before `versionTag`. `undefined` for a package's first version. */
|
|
69
|
+
export async function findPreviousVersionTag(versionTag) {
|
|
70
|
+
const project = await readSfdxProject().catch(() => undefined);
|
|
71
|
+
const glob = VersionTagFormat.fromProject(project).matchPattern();
|
|
72
|
+
try {
|
|
73
|
+
const { stdout } = await execa('git', ['describe', '--tags', '--abbrev=0', '--match', glob, `${versionTag}^`]);
|
|
74
|
+
return stdout.trim() || undefined;
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Resolves the new version's tag, the previous version's tag, and the issue references in between.
|
|
82
|
+
* Never throws: anything it can't resolve comes back as `N/A`, because a notification shouldn't be
|
|
83
|
+
* what fails a build.
|
|
84
|
+
*/
|
|
85
|
+
export async function getPackageVersionHistory(subscriberPackageVersionId, options) {
|
|
86
|
+
const history = { ...NOT_AVAILABLE, versionTag: 'N/A', previousVersionTag: 'N/A' };
|
|
87
|
+
try {
|
|
88
|
+
await fetchVersionHistory();
|
|
89
|
+
const versionTag = await findPackageVersionTag(subscriberPackageVersionId);
|
|
90
|
+
if (!versionTag) {
|
|
91
|
+
logger.warn(`No tag at HEAD is annotated with ${subscriberPackageVersionId}.`);
|
|
92
|
+
return history;
|
|
93
|
+
}
|
|
94
|
+
history.versionTag = versionTag;
|
|
95
|
+
const previousVersionTag = await findPreviousVersionTag(versionTag);
|
|
96
|
+
if (!previousVersionTag) {
|
|
97
|
+
logger.info(`No version tag before ${versionTag}. Skipping stories.`);
|
|
98
|
+
return history;
|
|
99
|
+
}
|
|
100
|
+
history.previousVersionTag = previousVersionTag;
|
|
101
|
+
const { stdout: commits } = await execa('git', ['log', '--pretty=oneline', `${previousVersionTag}..${versionTag}`]);
|
|
102
|
+
if (commits) {
|
|
103
|
+
Object.assign(history, renderIssuesFromCommitLog(commits, options.almProjectKey, {
|
|
104
|
+
almBaseUrl: options.almBaseUrl,
|
|
105
|
+
almProvider: createAlmProvider(options.almProvider ?? 'jira'),
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
logger.warn(`Could not resolve package version history: ${error.message}`);
|
|
111
|
+
if (options.debug) {
|
|
112
|
+
logger.error(String(error));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return history;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Posts a failure card for a failed build job, or a package version card for a successful job that
|
|
119
|
+
* created a package version. Any other job result sends nothing.
|
|
120
|
+
*/
|
|
121
|
+
export async function sendBuildNotification(options) {
|
|
122
|
+
const { ciJobStatus } = options;
|
|
123
|
+
const templateData = {
|
|
124
|
+
refName: options.ciCommitRefName,
|
|
125
|
+
pipelineUrl: options.ciPipelineUrl,
|
|
126
|
+
pipelineId: options.ciPipelineId,
|
|
127
|
+
projectTitle: options.ciProjectTitle,
|
|
128
|
+
jobName: options.ciJobName,
|
|
129
|
+
stage: options.ciJobStage,
|
|
130
|
+
stories: 'N/A',
|
|
131
|
+
storiesLinked: 'N/A',
|
|
132
|
+
};
|
|
133
|
+
let templateName;
|
|
134
|
+
if (ciJobStatus === 'failed') {
|
|
135
|
+
templateName = 'build-failure-notification';
|
|
136
|
+
}
|
|
137
|
+
else if (ciJobStatus === 'success') {
|
|
138
|
+
const subscriberPackageVersionId = await resolveSubscriberPackageVersionId(options.subscriberPackageVersionId);
|
|
139
|
+
if (!subscriberPackageVersionId) {
|
|
140
|
+
logger.info('No package version was created in this job. Skipping notification.');
|
|
141
|
+
return { sent: false };
|
|
142
|
+
}
|
|
143
|
+
templateName = 'build-package-version-notification';
|
|
144
|
+
logger.info(`Gathering stories for package version ${subscriberPackageVersionId}...`);
|
|
145
|
+
const history = await getPackageVersionHistory(subscriberPackageVersionId, options);
|
|
146
|
+
Object.assign(templateData, {
|
|
147
|
+
subscriberPackageVersionId,
|
|
148
|
+
packageVersion: history.versionTag,
|
|
149
|
+
packageVersionPrevious: history.previousVersionTag,
|
|
150
|
+
stories: history.stories,
|
|
151
|
+
storiesLinked: history.storiesWithUrl,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
logger.info(`No notification logic for job status: ${ciJobStatus ?? 'unknown'}`);
|
|
156
|
+
return { sent: false };
|
|
157
|
+
}
|
|
158
|
+
const payload = {
|
|
159
|
+
content: renderNotifyTemplate(templateName, templateData),
|
|
160
|
+
refName: options.ciCommitRefName,
|
|
161
|
+
pipelineId: options.ciPipelineId,
|
|
162
|
+
pipelineUrl: options.ciPipelineUrl,
|
|
163
|
+
projectTitle: options.ciProjectTitle,
|
|
164
|
+
jobName: options.ciJobName,
|
|
165
|
+
jobStage: options.ciJobStage,
|
|
166
|
+
jobStatus: ciJobStatus,
|
|
167
|
+
stories: templateData.stories,
|
|
168
|
+
storiesLinked: templateData.storiesLinked,
|
|
169
|
+
packageVersionPrevious: templateData.packageVersionPrevious,
|
|
170
|
+
packageVersion: templateData.packageVersion,
|
|
171
|
+
subscriberPackageVersionId: templateData.subscriberPackageVersionId,
|
|
172
|
+
};
|
|
173
|
+
await sendNotification(options.teamsWebhookUrl, payload);
|
|
174
|
+
return { sent: true };
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=buildNotification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildNotification.js","sourceRoot":"","sources":["../../../src/common/notify/buildNotification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,4BAA4B,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAwB,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EA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yC,WAAW,IAAI,SAAS,EAAE,CAAC,CAAC;QACjF,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACzB,CAAC;IAED,MAAM,OAAO,GAAG;QACd,OAAO,EAAE,oBAAoB,CAAC,YAAY,EAAE,YAAY,CAAC;QACzD,OAAO,EAAE,OAAO,CAAC,eAAe;QAChC,UAAU,EAAE,OAAO,CAAC,YAAY;QAChC,WAAW,EAAE,OAAO,CAAC,aAAa;QAClC,YAAY,EAAE,OAAO,CAAC,cAAc;QACpC,OAAO,EAAE,OAAO,CAAC,SAAS;QAC1B,QAAQ,EAAE,OAAO,CAAC,UAAU;QAC5B,SAAS,EAAE,WAAW;QACtB,OAAO,EAAE,YAAY,CAAC,OAAO;QAC7B,aAAa,EAAE,YAAY,CAAC,aAAa;QACzC,sBAAsB,EAAE,YAAY,CAAC,sBAAsB;QAC3D,cAAc,EAAE,YAAY,CAAC,cAAc;QAC3C,0BAA0B,EAAE,YAAY,CAAC,0BAA0B;KACpE,CAAC;IAEF,MAAM,gBAAgB,CAAC,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IACzD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** Teams notification card templates, keyed the same as the original `.hbs` file names. */
|
|
2
2
|
export declare const NOTIFY_TEMPLATES: {
|
|
3
|
+
readonly 'build-failure-notification': "<table>\n <tr><th colspan=\"3\" style=\"color: white; background-color: darkred;\">{{projectTitle}}: Failed Build</th></tr>\n <tr><th colspan=\"3\" style=\"color: white; background-color: grey;\">Job: {{jobName}} (Stage:\n {{stage}})</th></tr>\n <tr><td>Branch</td><td colspan=\"2\">Pipeline</td></tr>\n <tr><td>{{refName}}</td><td colspan=\"2\"><a\n href=\"{{pipelineUrl}}\"\n >{{pipelineId}}</a></td></tr>\n</table>\n";
|
|
4
|
+
readonly 'build-package-version-notification': "<table>\n <tr><th colspan=\"3\" style=\"color: white; background-color: darkgreen;\">{{projectTitle}}: Package Version\n Created</th></tr>\n <tr><td>Version</td><td>Branch</td><td>Pipeline</td></tr>\n <tr><td>{{packageVersion}}<br />{{subscriberPackageVersionId}}</td><td>{{refName}}</td><td><a\n href=\"{{pipelineUrl}}\"\n >{{pipelineId}}</a></td></tr>\n <tr><td colspan=\"3\">Stories since {{packageVersionPrevious}}</td></tr>\n <tr><td colspan=\"3\">{{{storiesLinked}}}</td></tr>\n</table>\n";
|
|
3
5
|
readonly 'happy-soup-failure-notification': "<table>\n <tr><th colspan=\"3\" style=\"color: white; background-color: darkred;\">Failed Stage:\n {{stage}}</th></tr>\n <tr><td>Environment</td><td>Branch</td><td>Pipeline</td></tr>\n <tr><td>{{environmentName}}</td><td>{{refName}}</td><td><a\n href=\"{{pipelineUrl}}\"\n >{{pipelineId}}</a></td></tr>\n</table>\n";
|
|
4
6
|
readonly 'happy-soup-final-failure-notification': "<table>\n <tr><th colspan=\"3\" style=\"color: white; background-color: darkred;\">Happy Soup Deployment Failed</th></tr>\n <tr><td>Environment</td><td>Branch</td><td>Pipeline</td></tr>\n <tr><td>{{environmentName}}</td><td>{{refName}}</td><td><a\n href=\"{{pipelineUrl}}\"\n >{{pipelineId}}</a></td></tr>\n</table>\n";
|
|
5
7
|
readonly 'happy-soup-final-success-notification': "<table>\n <tr><th colspan=\"3\" style=\"color: white; background-color: darkgreen;\">Happy Soup Deployment\n Completed</th></tr>\n <tr><td>Environment</td><td>Branch</td><td>Pipeline</td></tr>\n <tr><td>{{environmentName}}</td><td>{{refName}}</td><td><a\n href=\"{{pipelineUrl}}\"\n >{{pipelineId}}</a></td></tr>\n{{#if upgradedPackages.length}}\n <tr><td colspan=\"3\">Upgraded Packages</td></tr>\n{{#each upgradedPackages}}\n <tr><td colspan=\"1\">{{packageName}}</td><td colspan=\"2\">{{{storiesLinked}}}</td></tr>\n{{/each}}\n{{/if}}\n</table>\n";
|
|
@@ -15,6 +15,27 @@
|
|
|
15
15
|
*/
|
|
16
16
|
/** Teams notification card templates, keyed the same as the original `.hbs` file names. */
|
|
17
17
|
export const NOTIFY_TEMPLATES = {
|
|
18
|
+
'build-failure-notification': `<table>
|
|
19
|
+
<tr><th colspan="3" style="color: white; background-color: darkred;">{{projectTitle}}: Failed Build</th></tr>
|
|
20
|
+
<tr><th colspan="3" style="color: white; background-color: grey;">Job: {{jobName}} (Stage:
|
|
21
|
+
{{stage}})</th></tr>
|
|
22
|
+
<tr><td>Branch</td><td colspan="2">Pipeline</td></tr>
|
|
23
|
+
<tr><td>{{refName}}</td><td colspan="2"><a
|
|
24
|
+
href="{{pipelineUrl}}"
|
|
25
|
+
>{{pipelineId}}</a></td></tr>
|
|
26
|
+
</table>
|
|
27
|
+
`,
|
|
28
|
+
'build-package-version-notification': `<table>
|
|
29
|
+
<tr><th colspan="3" style="color: white; background-color: darkgreen;">{{projectTitle}}: Package Version
|
|
30
|
+
Created</th></tr>
|
|
31
|
+
<tr><td>Version</td><td>Branch</td><td>Pipeline</td></tr>
|
|
32
|
+
<tr><td>{{packageVersion}}<br />{{subscriberPackageVersionId}}</td><td>{{refName}}</td><td><a
|
|
33
|
+
href="{{pipelineUrl}}"
|
|
34
|
+
>{{pipelineId}}</a></td></tr>
|
|
35
|
+
<tr><td colspan="3">Stories since {{packageVersionPrevious}}</td></tr>
|
|
36
|
+
<tr><td colspan="3">{{{storiesLinked}}}</td></tr>
|
|
37
|
+
</table>
|
|
38
|
+
`,
|
|
18
39
|
'happy-soup-failure-notification': `<table>
|
|
19
40
|
<tr><th colspan="3" style="color: white; background-color: darkred;">Failed Stage:
|
|
20
41
|
{{stage}}</th></tr>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/common/notify/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,2FAA2F;AAC3F,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,iCAAiC,EAAE;;;;;;;;CAQpC;IACC,uCAAuC,EAAE;;;;;;;CAO1C;IACC,uCAAuC,EAAE;;;;;;;;;;;;;;CAc1C;IACC,wCAAwC,EAAE;;;;;;;;CAQ3C;IACC,iCAAiC,EAAE;;;;;;;;;;;;;;CAcpC;IACC,8BAA8B,EAAE;;;;;;;;;;CAUjC;IACC,8BAA8B,EAAE;;;;;;;;;;CAUjC;CACS,CAAC"}
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/common/notify/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,2FAA2F;AAC3F,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,4BAA4B,EAAE;;;;;;;;;CAS/B;IACC,oCAAoC,EAAE;;;;;;;;;;CAUvC;IACC,iCAAiC,EAAE;;;;;;;;CAQpC;IACC,uCAAuC,EAAE;;;;;;;CAO1C;IACC,uCAAuC,EAAE;;;;;;;;;;;;;;CAc1C;IACC,wCAAwC,EAAE;;;;;;;;CAQ3C;IACC,iCAAiC,EAAE;;;;;;;;;;;;;;CAcpC;IACC,8BAA8B,EAAE;;;;;;;;;;CAUjC;IACC,8BAA8B,EAAE;;;;;;;;;;CAUjC;CACS,CAAC"}
|
|
@@ -4,8 +4,16 @@ Install the LWC Jest test libraries and run the project's LWC Jest tests with co
|
|
|
4
4
|
|
|
5
5
|
# description
|
|
6
6
|
|
|
7
|
-
Installs `@salesforce/sfdx-lwc-jest
|
|
7
|
+
Installs `@salesforce/sfdx-lwc-jest`, `@sa11y/jest`, and `jest-junit`, then runs `sfdx-lwc-jest --coverage -- --passWithNoTests` with the `jest-junit` reporter added to any reporters the project's own Jest config sets, writing a JUnit report to `./test-results/lwc/test-result.xml` for the pipeline to upload as an artifact. By default failures are logged, not thrown, so they don't fail the pipeline; pass `--lwc-jest-fail-on-test-failure` to make them exit non-zero.
|
|
8
|
+
|
|
9
|
+
# flags.lwc-jest-fail-on-test-failure.summary
|
|
10
|
+
|
|
11
|
+
Exit non-zero when the LWC Jest tests (or their install) fail, failing the pipeline. By default failures are only logged.
|
|
8
12
|
|
|
9
13
|
# examples
|
|
10
14
|
|
|
11
15
|
- <%= config.bin %> <%= command.id %>
|
|
16
|
+
|
|
17
|
+
- Fail the pipeline when a test fails:
|
|
18
|
+
|
|
19
|
+
<%= config.bin %> <%= command.id %> --lwc-jest-fail-on-test-failure
|