@sprucelabs/jest-sheets-reporter 1.2.319 → 1.3.3
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/build/SheetsReporter.js
CHANGED
|
@@ -41,11 +41,17 @@ class SheetsReporter {
|
|
|
41
41
|
if (!this.testMap[testName]) {
|
|
42
42
|
throw new Error(`Invalid test name. Got "${testName}" but expected one of the following: ${Object.keys(this.testMap).join(', ')}`);
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
let cell = this.testMap[testName];
|
|
45
|
+
let worksheetId = this.worksheetId;
|
|
46
|
+
if (cell.includes(':')) {
|
|
47
|
+
const parts = cell.split(':');
|
|
48
|
+
worksheetId = parts[0];
|
|
49
|
+
cell = parts[1];
|
|
50
|
+
}
|
|
45
51
|
try {
|
|
46
52
|
await this.adapter.updateCell({
|
|
47
53
|
sheetId: this.sheetId,
|
|
48
|
-
worksheetId
|
|
54
|
+
worksheetId,
|
|
49
55
|
cell,
|
|
50
56
|
value: status === 'passed' ? 1 : 0,
|
|
51
57
|
});
|
|
@@ -4,7 +4,7 @@ export default class SheetsReporterTest extends AbstractSheetsReporterTest {
|
|
|
4
4
|
private static sheetId;
|
|
5
5
|
private static worksheetId;
|
|
6
6
|
private static readonly testResults;
|
|
7
|
-
private static
|
|
7
|
+
private static testMap;
|
|
8
8
|
protected static beforeAll(): Promise<void>;
|
|
9
9
|
protected static beforeEach(): Promise<void>;
|
|
10
10
|
protected static afterAll(): Promise<void>;
|
|
@@ -12,4 +12,5 @@ export default class SheetsReporterTest extends AbstractSheetsReporterTest {
|
|
|
12
12
|
protected static failsWithBadTestName(): Promise<void>;
|
|
13
13
|
protected static canUpdateTestCell(): Promise<void>;
|
|
14
14
|
protected static canUpdateAllTestsAfterCompletion(): Promise<void>;
|
|
15
|
+
protected static canSetWorksheetIdInCell(cell: string): Promise<void>;
|
|
15
16
|
}
|
|
@@ -32,8 +32,8 @@ class SheetsReporterTest extends AbstractSheetsReporterTest_1.default {
|
|
|
32
32
|
await this.sheetsAdapter.deleteWorksheet(this.sheetId, this.worksheetId);
|
|
33
33
|
}
|
|
34
34
|
static async canFilterMappedTests() {
|
|
35
|
-
const testResults =
|
|
36
|
-
const testMap =
|
|
35
|
+
const testResults = this.testResults;
|
|
36
|
+
const testMap = this.testMap;
|
|
37
37
|
const results = SheetsReporterUtility_1.SheetsReporterUtility.getMappedTests(testMap, testResults);
|
|
38
38
|
const cliTest = results.map((r) => r.title === 'canBootCli');
|
|
39
39
|
const canSyncTest = results.map((r) => r.title === 'canSyncSchemas');
|
|
@@ -57,6 +57,13 @@ class SheetsReporterTest extends AbstractSheetsReporterTest_1.default {
|
|
|
57
57
|
const value2 = await this.sheetsAdapter.fetchCellValue(this.sheetId, this.worksheetId, 'B2');
|
|
58
58
|
test_1.assert.isEqual(value2, 0);
|
|
59
59
|
}
|
|
60
|
+
static async canSetWorksheetIdInCell(cell) {
|
|
61
|
+
const worksheetId = await this.sheetsAdapter.generateRandomWorksheet(this.sheetId);
|
|
62
|
+
this.testMap.canBootCliInDifferentWorksheet = `${worksheetId}:${cell}`;
|
|
63
|
+
await this.reporter.reportTestAsPassed('canBootCliInDifferentWorksheet');
|
|
64
|
+
const value = await this.sheetsAdapter.fetchCellValue(this.sheetId, worksheetId, cell);
|
|
65
|
+
test_1.assert.isEqual(value, 1);
|
|
66
|
+
}
|
|
60
67
|
}
|
|
61
68
|
SheetsReporterTest.sheetId = '1MFb9AkB8sm7rurYew8hgzrXTz3JDxOFhl4kN9sNQVxw';
|
|
62
69
|
SheetsReporterTest.testResults = [
|
|
@@ -76,6 +83,10 @@ SheetsReporterTest.testResults = [
|
|
|
76
83
|
title: 'canSyncSchemas',
|
|
77
84
|
status: constants_1.TEST_JEST_FAILED,
|
|
78
85
|
},
|
|
86
|
+
{
|
|
87
|
+
title: 'canBootCliInDifferentWorksheet',
|
|
88
|
+
status: constants_1.TEST_JEST_PASSED,
|
|
89
|
+
},
|
|
79
90
|
];
|
|
80
91
|
SheetsReporterTest.testMap = {
|
|
81
92
|
canBootCli: 'B1',
|
|
@@ -93,4 +104,8 @@ __decorate([
|
|
|
93
104
|
__decorate([
|
|
94
105
|
(0, test_1.test)()
|
|
95
106
|
], SheetsReporterTest, "canUpdateAllTestsAfterCompletion", null);
|
|
107
|
+
__decorate([
|
|
108
|
+
test_1.test.only('can update in another worksheet 1', 'B1'),
|
|
109
|
+
test_1.test.only('can update in another worksheet 2', 'B2')
|
|
110
|
+
], SheetsReporterTest, "canSetWorksheetIdInCell", null);
|
|
96
111
|
exports.default = SheetsReporterTest;
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@sprucelabs/resolve-path-aliases"
|
|
14
14
|
]
|
|
15
15
|
},
|
|
16
|
-
"version": "1.
|
|
16
|
+
"version": "1.3.3",
|
|
17
17
|
"main": "./build/SheetsReporter.js",
|
|
18
18
|
"types": "./build/SheetsReporter.d.ts",
|
|
19
19
|
"description": "Have your Jest tests update a Google Spreadsheet™®©. 📡",
|
|
@@ -56,20 +56,20 @@
|
|
|
56
56
|
"watch.tsc": "tsc -w"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"dotenv": "^
|
|
59
|
+
"dotenv": "^16.0.0",
|
|
60
60
|
"google-spreadsheet": "^3.2.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@sprucelabs/resolve-path-aliases": "^1.0.244",
|
|
64
64
|
"@sprucelabs/semantic-release": "^4.0.8",
|
|
65
|
-
"@sprucelabs/test": "^7.7.
|
|
65
|
+
"@sprucelabs/test": "^7.7.278",
|
|
66
66
|
"@types/google-spreadsheet": "^3.1.5",
|
|
67
|
-
"@types/node": "^17.0.
|
|
67
|
+
"@types/node": "^17.0.15",
|
|
68
68
|
"chokidar-cli": "^3.0.0",
|
|
69
69
|
"concurrently": "^7.0.0",
|
|
70
70
|
"eslint": "^8.8.0",
|
|
71
71
|
"eslint-config-spruce": "^10.11.2",
|
|
72
|
-
"jest": "^27.
|
|
72
|
+
"jest": "^27.5.0",
|
|
73
73
|
"jest-reporters": "^0.0.2",
|
|
74
74
|
"prettier": "^2.5.1",
|
|
75
75
|
"ts-node": "^10.4.0",
|