@sprucelabs/jest-jira-reporter 1.0.0 → 1.0.1
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 +6 -67
- package/build/.spruce/errors/errors.types.d.ts +12 -9
- package/build/.spruce/errors/errors.types.js +0 -2
- package/build/.spruce/errors/jestJiraReporter/transitionNotFound.schema.js +8 -3
- package/build/.spruce/errors/options.types.d.ts +2 -2
- package/build/.spruce/schemas/fields/fields.types.d.ts +1 -1
- package/build/JestReporter.js +10 -6
- package/build/errors/SpruceError.d.ts +1 -1
- package/build/errors/SpruceError.js +1 -1
- package/build/esm/.spruce/errors/errors.types.d.ts +12 -9
- package/build/esm/.spruce/errors/errors.types.js +0 -2
- package/build/esm/.spruce/errors/options.types.d.ts +2 -2
- package/build/esm/errors/SpruceError.d.ts +1 -1
- package/build/esm/integrationTest.js +1 -1
- package/build/integrationTest.js +1 -1
- package/package.json +43 -38
package/README.md
CHANGED
|
@@ -1,76 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Jira Reporter
|
|
2
2
|
|
|
3
|
-
Update
|
|
3
|
+
Update Jira when your tests pass or fail.
|
|
4
4
|
|
|
5
|
-
<img src="https://raw.githubusercontent.com/sprucelabsai/jest-
|
|
5
|
+
<img src="https://raw.githubusercontent.com/sprucelabsai/jest-jira-reporter/master/docs/images/overview.png">
|
|
6
6
|
|
|
7
7
|
## Installing
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
yarn add -D @sprucelabs/jest-
|
|
10
|
+
yarn add -D @sprucelabs/jest-jira-reporter
|
|
11
11
|
```
|
|
12
|
-
```bash
|
|
13
|
-
npm install --dev @sprucelabs/jest-sheets-reporter
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Example Jest config
|
|
17
|
-
Inside your `package.json` there is a `jest` block.
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"jest": {
|
|
22
|
-
"reporters": [
|
|
23
|
-
"default",
|
|
24
|
-
[
|
|
25
|
-
"@sprucelabs/jest-sheets-reporter",
|
|
26
|
-
{
|
|
27
|
-
"sheetId": "{{spreadsheetId}}",
|
|
28
|
-
"worksheetId": 0,
|
|
29
|
-
"testMap": {
|
|
30
|
-
"testName": "destinationCell",
|
|
31
|
-
"getsGoodHealthCheckAndNothingElse": "C5",
|
|
32
|
-
"canGetLatestVersionBasedOnDir": "C16",
|
|
33
|
-
"canBuildSkill": "C24",
|
|
34
|
-
"canWatchAndBuild": "C25"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
]
|
|
39
|
-
},
|
|
13
|
+
```bash
|
|
14
|
+
npm install --dev @sprucelabs/jest-jira-reporter
|
|
40
15
|
```
|
|
41
|
-
|
|
42
|
-
## How does it work
|
|
43
|
-
|
|
44
|
-
This simple reporter matches the name of your test against what is in your `jest` config and updates the cell whose name matches.
|
|
45
|
-
|
|
46
|
-
If a test passes, the cell is set to 1.
|
|
47
|
-
|
|
48
|
-
If a test fails, the cell is set to 0.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
## Making it pretty
|
|
52
|
-
|
|
53
|
-
You can change the look of a cell by using conditional formatting:
|
|
54
|
-
|
|
55
|
-
<img src="https://raw.githubusercontent.com/sprucelabsai/jest-sheets-reporter/master/docs/images/conditional.png">
|
|
56
|
-
|
|
57
|
-
Then we set the background and the text color based on the value being exactly `1` or `0`.
|
|
58
|
-
|
|
59
|
-
<img src="https://raw.githubusercontent.com/sprucelabsai/jest-sheets-reporter/master/docs/images/stylerules.png">
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
## Getting your account credentials
|
|
63
|
-
|
|
64
|
-
1. Visit the [Google Console](https://console.developers.google.com/)
|
|
65
|
-
2. Create a new project, call it Test Integrations
|
|
66
|
-
3. After creation, go to the project dashboard and in the left meno go "API's & Services" -> "Enabled API's & Services"
|
|
67
|
-
4. Click "+ Enable API's and Services"
|
|
68
|
-
5. Find sheets and enable it.
|
|
69
|
-
6. After save, click "Create Credentials" in the upper right.
|
|
70
|
-
7. Give it a name, leave everything else blank and save
|
|
71
|
-
9. On the service account details page, click "KEYS" tab
|
|
72
|
-
10. Click Add Key -> JSON
|
|
73
|
-
11. Take the download private key and open it
|
|
74
|
-
12. client_email -> GOOGLE_SERVICE_EMAIL
|
|
75
|
-
13. private_key -> GOOGLE_SERVICE_PRIVATE_KEY
|
|
76
|
-
14. Remember to invite the service email to any spreadsheet you want it to update!
|
|
@@ -3,7 +3,7 @@ import * as SpruceSchema from '@sprucelabs/schema';
|
|
|
3
3
|
export declare namespace SpruceErrors.JestJiraReporter {
|
|
4
4
|
interface TransitionNotFound {
|
|
5
5
|
/** Transition. */
|
|
6
|
-
|
|
6
|
+
transition: 'In Progress' | 'Done';
|
|
7
7
|
}
|
|
8
8
|
interface TransitionNotFoundSchema extends SpruceSchema.Schema {
|
|
9
9
|
id: 'transitionNotFound';
|
|
@@ -11,18 +11,21 @@ export declare namespace SpruceErrors.JestJiraReporter {
|
|
|
11
11
|
name: 'Transition not found';
|
|
12
12
|
fields: {
|
|
13
13
|
/** Transition. */
|
|
14
|
-
|
|
14
|
+
transition: {
|
|
15
15
|
label: 'Transition';
|
|
16
16
|
type: 'select';
|
|
17
17
|
isRequired: true;
|
|
18
18
|
options: {
|
|
19
|
-
choices: [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
choices: [
|
|
20
|
+
{
|
|
21
|
+
value: 'In Progress';
|
|
22
|
+
label: 'In Progress';
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: 'Done';
|
|
26
|
+
label: 'Done';
|
|
27
|
+
}
|
|
28
|
+
];
|
|
26
29
|
};
|
|
27
30
|
};
|
|
28
31
|
};
|
|
@@ -7,13 +7,18 @@ const transitionNotFoundSchema = {
|
|
|
7
7
|
name: 'Transition not found',
|
|
8
8
|
fields: {
|
|
9
9
|
/** Transition. */
|
|
10
|
-
|
|
10
|
+
transition: {
|
|
11
11
|
label: 'Transition',
|
|
12
12
|
type: 'select',
|
|
13
13
|
isRequired: true,
|
|
14
|
-
options: {
|
|
14
|
+
options: {
|
|
15
|
+
choices: [
|
|
16
|
+
{ value: 'In Progress', label: 'In Progress' },
|
|
17
|
+
{ value: 'Done', label: 'Done' },
|
|
18
|
+
],
|
|
19
|
+
},
|
|
15
20
|
},
|
|
16
|
-
}
|
|
21
|
+
},
|
|
17
22
|
};
|
|
18
23
|
schema_1.SchemaRegistry.getInstance().trackSchema(transitionNotFoundSchema);
|
|
19
24
|
exports.default = transitionNotFoundSchema;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ErrorOptions as ISpruceErrorOptions } from '@sprucelabs/error';
|
|
2
|
+
import { SpruceErrors } from './errors.types';
|
|
3
3
|
export interface TransitionNotFoundErrorOptions extends SpruceErrors.JestJiraReporter.TransitionNotFound, ISpruceErrorOptions {
|
|
4
4
|
code: 'TRANSITION_NOT_FOUND';
|
|
5
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { FieldDefinitions, FieldDefinitionMap, FieldValueTypeGeneratorMap, FieldMap } from '@sprucelabs/schema';
|
|
1
|
+
export { FieldDefinitions, FieldDefinitionMap, FieldValueTypeGeneratorMap, FieldMap, } from '@sprucelabs/schema';
|
package/build/JestReporter.js
CHANGED
|
@@ -7,14 +7,19 @@ const schema_1 = require("@sprucelabs/schema");
|
|
|
7
7
|
const jira_client_1 = __importDefault(require("jira-client"));
|
|
8
8
|
const SpruceError_1 = __importDefault(require("./errors/SpruceError"));
|
|
9
9
|
class JestReporter {
|
|
10
|
+
client;
|
|
11
|
+
static JiraApi = jira_client_1.default;
|
|
12
|
+
testMap;
|
|
13
|
+
statusMap = {
|
|
14
|
+
passed: 'Done',
|
|
15
|
+
failed: 'In Progress',
|
|
16
|
+
};
|
|
17
|
+
transitions;
|
|
18
|
+
transitionLoadPromise;
|
|
10
19
|
constructor(options) {
|
|
11
|
-
this.statusMap = {
|
|
12
|
-
passed: 'Done',
|
|
13
|
-
failed: 'In Progress',
|
|
14
|
-
};
|
|
15
20
|
const username = process.env.JIRA_USERNAME;
|
|
16
21
|
const password = process.env.JIRA_PASSWORD;
|
|
17
|
-
const { protocol, host, apiVersion, strictSSL, testMap } = (0, schema_1.assertOptions)(
|
|
22
|
+
const { protocol, host, apiVersion, strictSSL, testMap } = (0, schema_1.assertOptions)({ ...options, env: process.env }, [
|
|
18
23
|
'host',
|
|
19
24
|
'apiVersion',
|
|
20
25
|
'testMap',
|
|
@@ -75,5 +80,4 @@ class JestReporter {
|
|
|
75
80
|
return this.testMap[title];
|
|
76
81
|
}
|
|
77
82
|
}
|
|
78
|
-
JestReporter.JiraApi = jira_client_1.default;
|
|
79
83
|
exports.default = JestReporter;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseSpruceError from '@sprucelabs/error';
|
|
2
|
-
import ErrorOptions from
|
|
2
|
+
import ErrorOptions from './../.spruce/errors/options.types';
|
|
3
3
|
export default class SpruceError extends BaseSpruceError<ErrorOptions> {
|
|
4
4
|
/** an easy to understand version of the errors */
|
|
5
5
|
friendlyMessage(): string;
|
|
@@ -9,7 +9,7 @@ class SpruceError extends error_1.default {
|
|
|
9
9
|
friendlyMessage() {
|
|
10
10
|
const { options } = this;
|
|
11
11
|
let message;
|
|
12
|
-
switch (options
|
|
12
|
+
switch (options?.code) {
|
|
13
13
|
case 'TRANSITION_NOT_FOUND':
|
|
14
14
|
message = 'A Transition not found just happened!';
|
|
15
15
|
break;
|
|
@@ -3,7 +3,7 @@ import * as SpruceSchema from '@sprucelabs/schema';
|
|
|
3
3
|
export declare namespace SpruceErrors.JestJiraReporter {
|
|
4
4
|
interface TransitionNotFound {
|
|
5
5
|
/** Transition. */
|
|
6
|
-
|
|
6
|
+
transition: 'In Progress' | 'Done';
|
|
7
7
|
}
|
|
8
8
|
interface TransitionNotFoundSchema extends SpruceSchema.Schema {
|
|
9
9
|
id: 'transitionNotFound';
|
|
@@ -11,18 +11,21 @@ export declare namespace SpruceErrors.JestJiraReporter {
|
|
|
11
11
|
name: 'Transition not found';
|
|
12
12
|
fields: {
|
|
13
13
|
/** Transition. */
|
|
14
|
-
|
|
14
|
+
transition: {
|
|
15
15
|
label: 'Transition';
|
|
16
16
|
type: 'select';
|
|
17
17
|
isRequired: true;
|
|
18
18
|
options: {
|
|
19
|
-
choices: [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
choices: [
|
|
20
|
+
{
|
|
21
|
+
value: 'In Progress';
|
|
22
|
+
label: 'In Progress';
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: 'Done';
|
|
26
|
+
label: 'Done';
|
|
27
|
+
}
|
|
28
|
+
];
|
|
26
29
|
};
|
|
27
30
|
};
|
|
28
31
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ErrorOptions as ISpruceErrorOptions } from '@sprucelabs/error';
|
|
2
|
+
import { SpruceErrors } from './errors.types';
|
|
3
3
|
export interface TransitionNotFoundErrorOptions extends SpruceErrors.JestJiraReporter.TransitionNotFound, ISpruceErrorOptions {
|
|
4
4
|
code: 'TRANSITION_NOT_FOUND';
|
|
5
5
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseSpruceError from '@sprucelabs/error';
|
|
2
|
-
import ErrorOptions from
|
|
2
|
+
import ErrorOptions from './../.spruce/errors/options.types';
|
|
3
3
|
export default class SpruceError extends BaseSpruceError<ErrorOptions> {
|
|
4
4
|
/** an easy to understand version of the errors */
|
|
5
5
|
friendlyMessage(): string;
|
|
@@ -7,7 +7,7 @@ const reporter = new JestReporter({
|
|
|
7
7
|
strictSSL: true,
|
|
8
8
|
testMap: { test1: 'LTEST-1', test2: 'LTEST-2' },
|
|
9
9
|
});
|
|
10
|
-
reporter.onTestComplete({}, {
|
|
10
|
+
void reporter.onTestComplete({}, {
|
|
11
11
|
testResults: [
|
|
12
12
|
{ title: 'test1', status: 'failed' },
|
|
13
13
|
{ title: 'test2', status: 'passed' },
|
package/build/integrationTest.js
CHANGED
|
@@ -12,7 +12,7 @@ const reporter = new JestReporter_1.default({
|
|
|
12
12
|
strictSSL: true,
|
|
13
13
|
testMap: { test1: 'LTEST-1', test2: 'LTEST-2' },
|
|
14
14
|
});
|
|
15
|
-
reporter.onTestComplete({}, {
|
|
15
|
+
void reporter.onTestComplete({}, {
|
|
16
16
|
testResults: [
|
|
17
17
|
{ title: 'test1', status: 'failed' },
|
|
18
18
|
{ title: 'test2', status: 'passed' },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sprucelabs/jest-jira-reporter",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"files": [
|
|
5
5
|
"build"
|
|
6
6
|
],
|
|
@@ -16,57 +16,62 @@
|
|
|
16
16
|
],
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"skill": {
|
|
19
|
-
"namespace": "jest-jira-reporter"
|
|
19
|
+
"namespace": "jest-jira-reporter",
|
|
20
|
+
"upgradeIgnoreList": [
|
|
21
|
+
"@sprucelabs/spruce-core-schemas",
|
|
22
|
+
"@sprucelabs/spruce-skill-utils",
|
|
23
|
+
"@sprucelabs/spruce-test-fixtures"
|
|
24
|
+
]
|
|
20
25
|
},
|
|
21
26
|
"scripts": {
|
|
22
|
-
"build.ci": "yarn build.tsc && yarn build.resolve-paths && yarn lint",
|
|
23
|
-
"build.dev": "yarn build.tsc --sourceMap ; yarn resolve-paths.lint",
|
|
27
|
+
"build.ci": "yarn run build.tsc && yarn run build.resolve-paths && yarn run lint",
|
|
28
|
+
"build.dev": "yarn run build.tsc --sourceMap ; yarn run resolve-paths.lint",
|
|
24
29
|
"build.dist": "tsc --project tsconfig.dist.json && yarn build.resolve-paths && mv build esm && yarn build.esm-postbuild && yarn build.tsc && yarn build.resolve-paths && mv esm build/ && yarn clean.dist",
|
|
25
30
|
"build.copy-files": "mkdir -p build && rsync -avzq --exclude='*.ts' ./src/ ./build/",
|
|
26
|
-
"build.esm-postbuild": "esm-postbuild --target esm --patterns '**/*.js'",
|
|
31
|
+
"build.esm-postbuild": "esm-postbuild --target esm --patterns '**/*.js'",
|
|
27
32
|
"build.resolve-paths": "resolve-path-aliases --target build --patterns '**/*.js,**/*.d.ts'",
|
|
28
|
-
"build.tsc": "yarn build.copy-files && tsc",
|
|
29
|
-
"clean": "yarn clean.build",
|
|
30
|
-
"clean.all": "yarn clean.dependencies && yarn clean.build",
|
|
33
|
+
"build.tsc": "yarn run build.copy-files && tsc",
|
|
34
|
+
"clean": "yarn run clean.build",
|
|
35
|
+
"clean.all": "yarn run clean.dependencies && yarn run clean.build",
|
|
31
36
|
"clean.build": "rm -rf build/",
|
|
32
37
|
"clean.dependencies": "rm -rf node_modules/ package-lock.json yarn.lock",
|
|
33
38
|
"clean.dist": "rm -rf build/__tests__ build/esm/__tests__",
|
|
34
39
|
"fix.lint": "eslint --fix --cache '**/*.ts'",
|
|
35
40
|
"lint": "eslint --cache '**/*.ts'",
|
|
36
41
|
"lint.tsc": "tsc -p . --noEmit",
|
|
37
|
-
"post.watch.build": "yarn build.copy-files && yarn build.resolve-paths",
|
|
38
|
-
"rebuild": "yarn clean.all && yarn && yarn build.dev",
|
|
42
|
+
"post.watch.build": "yarn run build.copy-files && yarn run build.resolve-paths",
|
|
43
|
+
"rebuild": "yarn run clean.all && yarn install && yarn run build.dev",
|
|
39
44
|
"release": "semantic-release",
|
|
40
|
-
"resolve-paths.lint": "yarn build.resolve-paths ; yarn lint",
|
|
45
|
+
"resolve-paths.lint": "yarn run build.resolve-paths ; yarn run lint",
|
|
41
46
|
"test": "jest",
|
|
42
|
-
"update.dependencies": "yarn clean.dependencies && yarn",
|
|
43
|
-
"watch.build.dev": "tsc-watch --sourceMap --onCompilationComplete 'yarn post.watch.build'",
|
|
44
|
-
"watch.lint": "concurrently 'yarn lint' \"chokidar 'src/**/*' -c 'yarn lint.tsc'\"",
|
|
45
|
-
"watch.rebuild": "yarn clean.all && yarn && yarn watch.build.dev",
|
|
47
|
+
"update.dependencies": "yarn run clean.dependencies && yarn",
|
|
48
|
+
"watch.build.dev": "tsc-watch --sourceMap --onCompilationComplete 'yarn run post.watch.build'",
|
|
49
|
+
"watch.lint": "concurrently 'yarn run lint' \"chokidar 'src/**/*' -c 'yarn run lint.tsc'\"",
|
|
50
|
+
"watch.rebuild": "yarn run clean.all && yarn install && yarn run watch.build.dev",
|
|
46
51
|
"watch.tsc": "tsc -w"
|
|
47
52
|
},
|
|
48
53
|
"devDependencies": {
|
|
49
|
-
"@sprucelabs/esm-postbuild": "^
|
|
50
|
-
"@sprucelabs/jest-json-reporter": "^
|
|
51
|
-
"@sprucelabs/resolve-path-aliases": "^
|
|
52
|
-
"@sprucelabs/semantic-release": "^
|
|
53
|
-
"@sprucelabs/spruce-test-fixtures": "^
|
|
54
|
-
"@sprucelabs/test": "^
|
|
55
|
-
"@sprucelabs/test-utils": "^
|
|
56
|
-
"@types/jira-client": "^7.1.
|
|
57
|
-
"@types/node": "^20.
|
|
58
|
-
"@types/photoshop": "^25.0.
|
|
54
|
+
"@sprucelabs/esm-postbuild": "^6.0.5",
|
|
55
|
+
"@sprucelabs/jest-json-reporter": "^8.0.4",
|
|
56
|
+
"@sprucelabs/resolve-path-aliases": "^2.0.7",
|
|
57
|
+
"@sprucelabs/semantic-release": "^5.0.1",
|
|
58
|
+
"@sprucelabs/spruce-test-fixtures": "^61.1.35",
|
|
59
|
+
"@sprucelabs/test": "^9.0.6",
|
|
60
|
+
"@sprucelabs/test-utils": "^5.0.5",
|
|
61
|
+
"@types/jira-client": "^7.1.9",
|
|
62
|
+
"@types/node": "^20.12.7",
|
|
63
|
+
"@types/photoshop": "^25.0.4",
|
|
59
64
|
"chokidar-cli": "^3.0.0",
|
|
60
|
-
"concurrently": "^8.2.
|
|
61
|
-
"eslint": "^
|
|
62
|
-
"eslint-config-spruce": "^
|
|
63
|
-
"jest": "^29.
|
|
64
|
-
"jest-circus": "^29.
|
|
65
|
-
"prettier": "2.
|
|
66
|
-
"ts-node": "^10.9.
|
|
67
|
-
"tsc-watch": "^6.0
|
|
65
|
+
"concurrently": "^8.2.2",
|
|
66
|
+
"eslint": "^9.1.1",
|
|
67
|
+
"eslint-config-spruce": "^11.2.12",
|
|
68
|
+
"jest": "^29.7.0",
|
|
69
|
+
"jest-circus": "^29.7.0",
|
|
70
|
+
"prettier": "^3.2.5",
|
|
71
|
+
"ts-node": "^10.9.2",
|
|
72
|
+
"tsc-watch": "^6.2.0",
|
|
68
73
|
"tsconfig-paths": "^4.2.0",
|
|
69
|
-
"typescript": "^5.
|
|
74
|
+
"typescript": "^5.4.5"
|
|
70
75
|
},
|
|
71
76
|
"jest": {
|
|
72
77
|
"testRunner": "jest-circus/runner",
|
|
@@ -87,10 +92,10 @@
|
|
|
87
92
|
}
|
|
88
93
|
},
|
|
89
94
|
"dependencies": {
|
|
90
|
-
"@sprucelabs/error": "^
|
|
91
|
-
"@sprucelabs/schema": "^
|
|
92
|
-
"@sprucelabs/spruce-core-schemas": "^39.0.
|
|
93
|
-
"@sprucelabs/spruce-skill-utils": "^
|
|
95
|
+
"@sprucelabs/error": "^6.0.5",
|
|
96
|
+
"@sprucelabs/schema": "^30.0.6",
|
|
97
|
+
"@sprucelabs/spruce-core-schemas": "^39.0.294",
|
|
98
|
+
"@sprucelabs/spruce-skill-utils": "^30.4.29",
|
|
94
99
|
"jira-client": "^8.2.2"
|
|
95
100
|
}
|
|
96
101
|
}
|