@regressionproof/jest-reporter 0.2.25 → 0.3.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/build/config/loadConfig.d.ts +9 -0
- package/build/config/loadConfig.js +62 -0
- package/build/esm/config/loadConfig.d.ts +9 -0
- package/build/esm/config/loadConfig.js +57 -0
- package/build/esm/index.d.ts +10 -0
- package/build/esm/index.js +51 -0
- package/build/esm/transformers/transformResults.d.ts +3 -0
- package/build/esm/transformers/transformResults.js +30 -0
- package/build/index.d.ts +10 -0
- package/build/index.js +43 -0
- package/build/transformers/transformResults.d.ts +3 -0
- package/build/transformers/transformResults.js +36 -0
- package/package.json +6 -16
- package/.nvmrc +0 -1
- package/.vscode/launch.json +0 -58
- package/.vscode/settings.json +0 -67
- package/.vscode/tasks.json +0 -112
- package/CHANGELOG.md +0 -254
- package/eslint.config.mjs +0 -3
- package/src/config/loadConfig.ts +0 -76
- package/src/index.ts +0 -75
- package/src/transformers/transformResults.ts +0 -44
- package/tsconfig.dist.json +0 -26
- package/tsconfig.json +0 -27
- /package/{src → build}/.spruce/settings.json +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.loadConfig = loadConfig;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const os_1 = __importDefault(require("os"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
function loadConfig(cwd) {
|
|
12
|
+
const projectName = detectProjectName(cwd);
|
|
13
|
+
if (!projectName) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const baseDir = path_1.default.join(os_1.default.homedir(), '.regressionproof');
|
|
17
|
+
const configPath = path_1.default.join(baseDir, projectName, 'config.json');
|
|
18
|
+
if (!fs_1.default.existsSync(configPath)) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const config = JSON.parse(fs_1.default.readFileSync(configPath, 'utf-8'));
|
|
22
|
+
return {
|
|
23
|
+
projectName,
|
|
24
|
+
mirrorPath: path_1.default.join(baseDir, projectName, 'mirror'),
|
|
25
|
+
remote: {
|
|
26
|
+
url: config.remote.url,
|
|
27
|
+
token: config.remote.token,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function detectProjectName(cwd) {
|
|
32
|
+
const localConfigPath = path_1.default.join(cwd, '.regressionproof.json');
|
|
33
|
+
if (fs_1.default.existsSync(localConfigPath)) {
|
|
34
|
+
const localConfig = JSON.parse(fs_1.default.readFileSync(localConfigPath, 'utf-8'));
|
|
35
|
+
if (localConfig.projectName) {
|
|
36
|
+
return localConfig.projectName;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return getProjectNameFromGit(cwd);
|
|
40
|
+
}
|
|
41
|
+
function getProjectNameFromGit(cwd) {
|
|
42
|
+
try {
|
|
43
|
+
const remoteUrl = (0, child_process_1.execSync)('git remote get-url origin', {
|
|
44
|
+
cwd,
|
|
45
|
+
encoding: 'utf-8',
|
|
46
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
47
|
+
}).trim();
|
|
48
|
+
const match = remoteUrl.match(/[/:]([^/:]+?)(\.git)?$/);
|
|
49
|
+
return toSlug(match?.[1] ?? '') || null;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function toSlug(input) {
|
|
56
|
+
return input
|
|
57
|
+
.toLowerCase()
|
|
58
|
+
.replace(/\s+/g, '-')
|
|
59
|
+
.replace(/[^a-z0-9-_]/g, '')
|
|
60
|
+
.replace(/-+/g, '-')
|
|
61
|
+
.replace(/^-|-$/g, '');
|
|
62
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import os from 'os';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
export function loadConfig(cwd) {
|
|
6
|
+
const projectName = detectProjectName(cwd);
|
|
7
|
+
if (!projectName) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
const baseDir = path.join(os.homedir(), '.regressionproof');
|
|
11
|
+
const configPath = path.join(baseDir, projectName, 'config.json');
|
|
12
|
+
if (!fs.existsSync(configPath)) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
16
|
+
return {
|
|
17
|
+
projectName,
|
|
18
|
+
mirrorPath: path.join(baseDir, projectName, 'mirror'),
|
|
19
|
+
remote: {
|
|
20
|
+
url: config.remote.url,
|
|
21
|
+
token: config.remote.token,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function detectProjectName(cwd) {
|
|
26
|
+
const localConfigPath = path.join(cwd, '.regressionproof.json');
|
|
27
|
+
if (fs.existsSync(localConfigPath)) {
|
|
28
|
+
const localConfig = JSON.parse(fs.readFileSync(localConfigPath, 'utf-8'));
|
|
29
|
+
if (localConfig.projectName) {
|
|
30
|
+
return localConfig.projectName;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return getProjectNameFromGit(cwd);
|
|
34
|
+
}
|
|
35
|
+
function getProjectNameFromGit(cwd) {
|
|
36
|
+
var _a;
|
|
37
|
+
try {
|
|
38
|
+
const remoteUrl = execSync('git remote get-url origin', {
|
|
39
|
+
cwd,
|
|
40
|
+
encoding: 'utf-8',
|
|
41
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
42
|
+
}).trim();
|
|
43
|
+
const match = remoteUrl.match(/[/:]([^/:]+?)(\.git)?$/);
|
|
44
|
+
return toSlug((_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : '') || null;
|
|
45
|
+
}
|
|
46
|
+
catch (_b) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function toSlug(input) {
|
|
51
|
+
return input
|
|
52
|
+
.toLowerCase()
|
|
53
|
+
.replace(/\s+/g, '-')
|
|
54
|
+
.replace(/[^a-z0-9-_]/g, '')
|
|
55
|
+
.replace(/-+/g, '-')
|
|
56
|
+
.replace(/^-|-$/g, '');
|
|
57
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AggregatedResult, Reporter, ReporterOnStartOptions, Test, TestCaseResult, TestContext } from '@jest/reporters';
|
|
2
|
+
export default class RegressionProofReporter implements Reporter {
|
|
3
|
+
private cwd;
|
|
4
|
+
constructor(_globalConfig?: unknown, _reporterConfig?: unknown);
|
|
5
|
+
onRunStart(_results: AggregatedResult, _options: ReporterOnStartOptions): void;
|
|
6
|
+
onTestFileStart(_test: Test): void;
|
|
7
|
+
onTestCaseResult(_test: Test, _testCaseResult: TestCaseResult): void;
|
|
8
|
+
onRunComplete(_testContexts: Set<TestContext>, results: AggregatedResult): Promise<void>;
|
|
9
|
+
getLastError(): Error | void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { snapshot } from '@regressionproof/snapshotter';
|
|
11
|
+
import { loadConfig } from './config/loadConfig.js.js';
|
|
12
|
+
import { transformResults } from './transformers/transformResults.js.js';
|
|
13
|
+
export default class RegressionProofReporter {
|
|
14
|
+
constructor(_globalConfig, _reporterConfig) {
|
|
15
|
+
this.cwd = process.cwd();
|
|
16
|
+
}
|
|
17
|
+
onRunStart(_results, _options) { }
|
|
18
|
+
onTestFileStart(_test) { }
|
|
19
|
+
onTestCaseResult(_test, _testCaseResult) { }
|
|
20
|
+
onRunComplete(_testContexts, results) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const config = loadConfig(this.cwd);
|
|
23
|
+
if (!config) {
|
|
24
|
+
console.log('[RegressionProof] No config found. Run `regressionproof init` to set up.');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const testResults = transformResults(results, this.cwd);
|
|
28
|
+
console.log(`[RegressionProof] ${testResults.summary.passedTests}/${testResults.summary.totalTests} tests passed`);
|
|
29
|
+
try {
|
|
30
|
+
const committed = yield snapshot({
|
|
31
|
+
sourcePath: this.cwd,
|
|
32
|
+
mirrorPath: config.mirrorPath,
|
|
33
|
+
testResults,
|
|
34
|
+
remote: config.remote,
|
|
35
|
+
});
|
|
36
|
+
if (committed) {
|
|
37
|
+
console.log('[RegressionProof] Snapshot captured successfully');
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
console.log('[RegressionProof] No changes to snapshot');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
console.error('[RegressionProof] Failed to capture snapshot:', err instanceof Error ? err.message : err);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
getLastError() {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
export function transformResults(jestResults, cwd) {
|
|
3
|
+
const suites = jestResults.testResults.map((suiteResult) => {
|
|
4
|
+
const tests = suiteResult.testResults.map((test) => ({
|
|
5
|
+
name: test.fullName || test.title,
|
|
6
|
+
passed: test.status === 'passed',
|
|
7
|
+
error: test.status === 'failed' && test.failureMessages.length > 0
|
|
8
|
+
? test.failureMessages.join('\n\n')
|
|
9
|
+
: undefined,
|
|
10
|
+
}));
|
|
11
|
+
const suitePassed = tests.every((t) => t.passed);
|
|
12
|
+
return {
|
|
13
|
+
path: path.relative(cwd, suiteResult.testFilePath),
|
|
14
|
+
passed: suitePassed,
|
|
15
|
+
tests,
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
return {
|
|
19
|
+
timestamp: new Date().toISOString(),
|
|
20
|
+
summary: {
|
|
21
|
+
totalSuites: jestResults.numTotalTestSuites,
|
|
22
|
+
passedSuites: jestResults.numPassedTestSuites,
|
|
23
|
+
failedSuites: jestResults.numFailedTestSuites,
|
|
24
|
+
totalTests: jestResults.numTotalTests,
|
|
25
|
+
passedTests: jestResults.numPassedTests,
|
|
26
|
+
failedTests: jestResults.numFailedTests,
|
|
27
|
+
},
|
|
28
|
+
suites,
|
|
29
|
+
};
|
|
30
|
+
}
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AggregatedResult, Reporter, ReporterOnStartOptions, Test, TestCaseResult, TestContext } from '@jest/reporters';
|
|
2
|
+
export default class RegressionProofReporter implements Reporter {
|
|
3
|
+
private cwd;
|
|
4
|
+
constructor(_globalConfig?: unknown, _reporterConfig?: unknown);
|
|
5
|
+
onRunStart(_results: AggregatedResult, _options: ReporterOnStartOptions): void;
|
|
6
|
+
onTestFileStart(_test: Test): void;
|
|
7
|
+
onTestCaseResult(_test: Test, _testCaseResult: TestCaseResult): void;
|
|
8
|
+
onRunComplete(_testContexts: Set<TestContext>, results: AggregatedResult): Promise<void>;
|
|
9
|
+
getLastError(): Error | void;
|
|
10
|
+
}
|
package/build/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const snapshotter_1 = require("@regressionproof/snapshotter");
|
|
4
|
+
const loadConfig_js_1 = require("./config/loadConfig.js");
|
|
5
|
+
const transformResults_js_1 = require("./transformers/transformResults.js");
|
|
6
|
+
class RegressionProofReporter {
|
|
7
|
+
constructor(_globalConfig, _reporterConfig) {
|
|
8
|
+
this.cwd = process.cwd();
|
|
9
|
+
}
|
|
10
|
+
onRunStart(_results, _options) { }
|
|
11
|
+
onTestFileStart(_test) { }
|
|
12
|
+
onTestCaseResult(_test, _testCaseResult) { }
|
|
13
|
+
async onRunComplete(_testContexts, results) {
|
|
14
|
+
const config = (0, loadConfig_js_1.loadConfig)(this.cwd);
|
|
15
|
+
if (!config) {
|
|
16
|
+
console.log('[RegressionProof] No config found. Run `regressionproof init` to set up.');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const testResults = (0, transformResults_js_1.transformResults)(results, this.cwd);
|
|
20
|
+
console.log(`[RegressionProof] ${testResults.summary.passedTests}/${testResults.summary.totalTests} tests passed`);
|
|
21
|
+
try {
|
|
22
|
+
const committed = await (0, snapshotter_1.snapshot)({
|
|
23
|
+
sourcePath: this.cwd,
|
|
24
|
+
mirrorPath: config.mirrorPath,
|
|
25
|
+
testResults,
|
|
26
|
+
remote: config.remote,
|
|
27
|
+
});
|
|
28
|
+
if (committed) {
|
|
29
|
+
console.log('[RegressionProof] Snapshot captured successfully');
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
console.log('[RegressionProof] No changes to snapshot');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
console.error('[RegressionProof] Failed to capture snapshot:', err instanceof Error ? err.message : err);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
getLastError() {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.default = RegressionProofReporter;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.transformResults = transformResults;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
function transformResults(jestResults, cwd) {
|
|
9
|
+
const suites = jestResults.testResults.map((suiteResult) => {
|
|
10
|
+
const tests = suiteResult.testResults.map((test) => ({
|
|
11
|
+
name: test.fullName || test.title,
|
|
12
|
+
passed: test.status === 'passed',
|
|
13
|
+
error: test.status === 'failed' && test.failureMessages.length > 0
|
|
14
|
+
? test.failureMessages.join('\n\n')
|
|
15
|
+
: undefined,
|
|
16
|
+
}));
|
|
17
|
+
const suitePassed = tests.every((t) => t.passed);
|
|
18
|
+
return {
|
|
19
|
+
path: path_1.default.relative(cwd, suiteResult.testFilePath),
|
|
20
|
+
passed: suitePassed,
|
|
21
|
+
tests,
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
timestamp: new Date().toISOString(),
|
|
26
|
+
summary: {
|
|
27
|
+
totalSuites: jestResults.numTotalTestSuites,
|
|
28
|
+
passedSuites: jestResults.numPassedTestSuites,
|
|
29
|
+
failedSuites: jestResults.numFailedTestSuites,
|
|
30
|
+
totalTests: jestResults.numTotalTests,
|
|
31
|
+
passedTests: jestResults.numPassedTests,
|
|
32
|
+
failedTests: jestResults.numFailedTests,
|
|
33
|
+
},
|
|
34
|
+
suites,
|
|
35
|
+
};
|
|
36
|
+
}
|
package/package.json
CHANGED
|
@@ -1,25 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regressionproof/jest-reporter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"main": "./build/index.js",
|
|
8
8
|
"types": "./build/index.d.ts",
|
|
9
|
-
"module": "./build/esm/index.js",
|
|
10
9
|
"sideEffects": false,
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
"types": "./build/esm/index.d.ts",
|
|
15
|
-
"default": "./build/esm/index.js"
|
|
16
|
-
},
|
|
17
|
-
"require": {
|
|
18
|
-
"types": "./build/index.d.ts",
|
|
19
|
-
"default": "./build/index.js"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
},
|
|
10
|
+
"files": [
|
|
11
|
+
"build"
|
|
12
|
+
],
|
|
23
13
|
"scripts": {
|
|
24
14
|
"build.ci": "yarn run build.tsc && yarn run build.resolve-paths && yarn run lint",
|
|
25
15
|
"build.dev": "yarn run build.tsc --sourceMap ; yarn run resolve-paths.lint",
|
|
@@ -45,7 +35,7 @@
|
|
|
45
35
|
"watch.tsc": "tsc -w"
|
|
46
36
|
},
|
|
47
37
|
"dependencies": {
|
|
48
|
-
"@regressionproof/snapshotter": "^0.
|
|
38
|
+
"@regressionproof/snapshotter": "^0.3.0"
|
|
49
39
|
},
|
|
50
40
|
"devDependencies": {
|
|
51
41
|
"@jest/reporters": "^30.2.0",
|
|
@@ -88,5 +78,5 @@
|
|
|
88
78
|
"^#spruce/(.*)$": "<rootDir>/build/.spruce/$1"
|
|
89
79
|
}
|
|
90
80
|
},
|
|
91
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "9a486c294980127cbd63e79d91fd93a47c8246e1"
|
|
92
82
|
}
|
package/.nvmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
lts/*
|
package/.vscode/launch.json
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "0.2.0",
|
|
3
|
-
"configurations": [
|
|
4
|
-
{
|
|
5
|
-
"type": "node",
|
|
6
|
-
"request": "attach",
|
|
7
|
-
"name": "attach.tests",
|
|
8
|
-
"port": 5200,
|
|
9
|
-
"restart": true,
|
|
10
|
-
"timeout": 10000
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"type": "node",
|
|
14
|
-
"request": "launch",
|
|
15
|
-
"name": "test.file",
|
|
16
|
-
"runtimeExecutable": "node",
|
|
17
|
-
"runtimeArgs": [
|
|
18
|
-
"--inspect-brk",
|
|
19
|
-
"--trace-warnings",
|
|
20
|
-
"${workspaceFolder}/node_modules/.bin/jest",
|
|
21
|
-
"${fileBasenameNoExtension}",
|
|
22
|
-
"--detectOpenHandles"
|
|
23
|
-
],
|
|
24
|
-
"cwd": "${workspaceFolder}",
|
|
25
|
-
"console": "integratedTerminal",
|
|
26
|
-
"internalConsoleOptions": "neverOpen"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"type": "node",
|
|
30
|
-
"request": "launch",
|
|
31
|
-
"name": "test.all",
|
|
32
|
-
"runtimeExecutable": "node",
|
|
33
|
-
"runtimeArgs": [
|
|
34
|
-
"--inspect-brk",
|
|
35
|
-
"--trace-warnings",
|
|
36
|
-
"${workspaceFolder}/node_modules/.bin/jest"
|
|
37
|
-
],
|
|
38
|
-
"cwd": "${workspaceFolder}",
|
|
39
|
-
"console": "integratedTerminal",
|
|
40
|
-
"internalConsoleOptions": "neverOpen"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"type": "node",
|
|
44
|
-
"request": "launch",
|
|
45
|
-
"name": "boot",
|
|
46
|
-
"runtimeExecutable": "yarn",
|
|
47
|
-
"runtimeArgs": [
|
|
48
|
-
"run",
|
|
49
|
-
"--inspect-brk",
|
|
50
|
-
"--trace-warnings",
|
|
51
|
-
"boot"
|
|
52
|
-
],
|
|
53
|
-
"cwd": "${workspaceFolder}",
|
|
54
|
-
"console": "integratedTerminal",
|
|
55
|
-
"internalConsoleOptions": "neverOpen"
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
}
|
package/.vscode/settings.json
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"debug.node.autoAttach": "on",
|
|
3
|
-
"git.ignoreLimitWarning": true,
|
|
4
|
-
"javascript.validate.enable": false,
|
|
5
|
-
"files.watcherExclude": {
|
|
6
|
-
"**/.git/objects/**": true,
|
|
7
|
-
"**/.git/subtree-cache/**": true,
|
|
8
|
-
"**/build/**": true,
|
|
9
|
-
"**/node_modules/**": true,
|
|
10
|
-
},
|
|
11
|
-
"search.exclude": {
|
|
12
|
-
"**/build/**": true,
|
|
13
|
-
"**/node_modules/**": true,
|
|
14
|
-
"**/.next/**": true
|
|
15
|
-
},
|
|
16
|
-
"editor.maxTokenizationLineLength": 20000000,
|
|
17
|
-
"[javascript]": {
|
|
18
|
-
"editor.formatOnSave": false
|
|
19
|
-
},
|
|
20
|
-
"[javascriptreact]": {
|
|
21
|
-
"editor.formatOnSave": false
|
|
22
|
-
},
|
|
23
|
-
"[typescript]": {
|
|
24
|
-
"editor.formatOnSave": false
|
|
25
|
-
},
|
|
26
|
-
"[typescriptreact]": {
|
|
27
|
-
"editor.formatOnSave": false
|
|
28
|
-
},
|
|
29
|
-
"[handlebars]": {
|
|
30
|
-
"editor.formatOnSave": false
|
|
31
|
-
},
|
|
32
|
-
"typescript.tsdk": "node_modules/typescript/lib",
|
|
33
|
-
"cSpell.ignorePaths": [
|
|
34
|
-
"**/package-lock.json",
|
|
35
|
-
"**/node_modules/**",
|
|
36
|
-
"**/build/**",
|
|
37
|
-
"**/vscode-extension/**",
|
|
38
|
-
"**/.git/objects/**",
|
|
39
|
-
".vscode",
|
|
40
|
-
".spruce"
|
|
41
|
-
],
|
|
42
|
-
"cSpell.words": [
|
|
43
|
-
"arkit",
|
|
44
|
-
"autogenerated",
|
|
45
|
-
"scrollable",
|
|
46
|
-
"serializable"
|
|
47
|
-
],
|
|
48
|
-
"debug.javascript.unmapMissingSources": true,
|
|
49
|
-
"javascript.preferences.importModuleSpecifier": "relative",
|
|
50
|
-
"typescript.preferences.importModuleSpecifier": "relative",
|
|
51
|
-
"eslint.useFlatConfig": true,
|
|
52
|
-
"eslint.enable": true,
|
|
53
|
-
"eslint.validate": [
|
|
54
|
-
"javascript",
|
|
55
|
-
"javascriptreact",
|
|
56
|
-
"typescript",
|
|
57
|
-
"typescriptreact"
|
|
58
|
-
],
|
|
59
|
-
"eslint.workingDirectories": [
|
|
60
|
-
"./"
|
|
61
|
-
],
|
|
62
|
-
"typescript.validate.enable": true,
|
|
63
|
-
"editor.formatOnSave": false,
|
|
64
|
-
"editor.codeActionsOnSave": {
|
|
65
|
-
"source.fixAll.eslint": "always"
|
|
66
|
-
}
|
|
67
|
-
}
|
package/.vscode/tasks.json
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "2.0.0",
|
|
3
|
-
"tasks": [
|
|
4
|
-
{
|
|
5
|
-
"type": "npm",
|
|
6
|
-
"script": "watch.build.dev",
|
|
7
|
-
"group": "build",
|
|
8
|
-
"label": "watch.build.dev & problem.watcher",
|
|
9
|
-
"isBackground": true,
|
|
10
|
-
"runOptions": {
|
|
11
|
-
"runOn": "folderOpen"
|
|
12
|
-
},
|
|
13
|
-
"promptOnClose": false,
|
|
14
|
-
"presentation": {
|
|
15
|
-
"focus": false,
|
|
16
|
-
"reveal": "never"
|
|
17
|
-
},
|
|
18
|
-
"problemMatcher": {
|
|
19
|
-
"base": "$tsc-watch",
|
|
20
|
-
"applyTo": "allDocuments"
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"label": "test.file",
|
|
25
|
-
"command": "spruce",
|
|
26
|
-
"args": [
|
|
27
|
-
"test",
|
|
28
|
-
"--inspect",
|
|
29
|
-
"5200",
|
|
30
|
-
"--pattern",
|
|
31
|
-
"${fileBasenameNoExtension}",
|
|
32
|
-
"--watchMode",
|
|
33
|
-
"standard"
|
|
34
|
-
],
|
|
35
|
-
"promptOnClose": false,
|
|
36
|
-
"group": {
|
|
37
|
-
"kind": "test",
|
|
38
|
-
"isDefault": true
|
|
39
|
-
},
|
|
40
|
-
"presentation": {
|
|
41
|
-
"reveal": "always",
|
|
42
|
-
"panel": "dedicated",
|
|
43
|
-
},
|
|
44
|
-
"problemMatcher": []
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"label": "test.reporter",
|
|
48
|
-
"command": "spruce",
|
|
49
|
-
"args": [
|
|
50
|
-
"test",
|
|
51
|
-
"--shouldHoldAtStart",
|
|
52
|
-
"true",
|
|
53
|
-
"--watchMode",
|
|
54
|
-
"smart"
|
|
55
|
-
],
|
|
56
|
-
"promptOnClose": false,
|
|
57
|
-
"group": "test",
|
|
58
|
-
"runOptions": {
|
|
59
|
-
"runOn": "folderOpen"
|
|
60
|
-
},
|
|
61
|
-
"presentation": {
|
|
62
|
-
"panel": "shared",
|
|
63
|
-
"focus": true,
|
|
64
|
-
"reveal": "always"
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"label": "spruce",
|
|
69
|
-
"type": "shell",
|
|
70
|
-
"command": "spruce ${input:spruceCommand}",
|
|
71
|
-
"problemMatcher": [],
|
|
72
|
-
"presentation": {
|
|
73
|
-
"reveal": "always",
|
|
74
|
-
"focus": true,
|
|
75
|
-
"panel": "new",
|
|
76
|
-
"clear": false
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"label": "shell",
|
|
81
|
-
"type": "shell",
|
|
82
|
-
"command": "${input:command} ${input:optionsCommand}",
|
|
83
|
-
"problemMatcher": [],
|
|
84
|
-
"presentation": {
|
|
85
|
-
"reveal": "always",
|
|
86
|
-
"focus": true,
|
|
87
|
-
"panel": "new",
|
|
88
|
-
"clear": false
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
],
|
|
92
|
-
"inputs": [
|
|
93
|
-
{
|
|
94
|
-
"id": "spruceCommand",
|
|
95
|
-
"description": "spruce command",
|
|
96
|
-
"default": "create.test",
|
|
97
|
-
"type": "promptString"
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
"id": "command",
|
|
101
|
-
"description": "command",
|
|
102
|
-
"default": "yarn",
|
|
103
|
-
"type": "promptString"
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
"id": "optionsCommand",
|
|
107
|
-
"description": "optionsCommand",
|
|
108
|
-
"default": "add",
|
|
109
|
-
"type": "promptString"
|
|
110
|
-
}
|
|
111
|
-
]
|
|
112
|
-
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
## [0.2.25](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.24...v0.2.25) (2026-01-12)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## [0.2.24](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.23...v0.2.24) (2026-01-12)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## [0.2.23](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.22...v0.2.23) (2026-01-12)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
## [0.2.22](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.21...v0.2.22) (2026-01-12)
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## [0.2.21](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.20...v0.2.21) (2026-01-12)
|
|
39
|
-
|
|
40
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
## [0.2.20](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.19...v0.2.20) (2026-01-12)
|
|
47
|
-
|
|
48
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
## [0.2.19](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.18...v0.2.19) (2026-01-12)
|
|
55
|
-
|
|
56
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
## [0.2.18](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.17...v0.2.18) (2026-01-12)
|
|
63
|
-
|
|
64
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
## [0.2.17](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.16...v0.2.17) (2026-01-12)
|
|
71
|
-
|
|
72
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
## [0.2.16](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.15...v0.2.16) (2026-01-12)
|
|
79
|
-
|
|
80
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
## [0.2.15](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.14...v0.2.15) (2026-01-12)
|
|
87
|
-
|
|
88
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
## [0.2.14](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.13...v0.2.14) (2026-01-12)
|
|
95
|
-
|
|
96
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
## [0.2.13](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.12...v0.2.13) (2026-01-12)
|
|
103
|
-
|
|
104
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
## [0.2.12](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.11...v0.2.12) (2026-01-12)
|
|
111
|
-
|
|
112
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
## [0.2.11](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.10...v0.2.11) (2026-01-12)
|
|
119
|
-
|
|
120
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
## [0.2.10](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.9...v0.2.10) (2026-01-12)
|
|
127
|
-
|
|
128
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
## [0.2.9](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.8...v0.2.9) (2026-01-12)
|
|
135
|
-
|
|
136
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
## [0.2.8](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.7...v0.2.8) (2026-01-12)
|
|
143
|
-
|
|
144
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
## [0.2.7](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.6...v0.2.7) (2026-01-12)
|
|
151
|
-
|
|
152
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
## [0.2.6](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.5...v0.2.6) (2026-01-12)
|
|
159
|
-
|
|
160
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
## [0.2.5](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.4...v0.2.5) (2026-01-12)
|
|
167
|
-
|
|
168
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
## [0.2.4](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.3...v0.2.4) (2026-01-12)
|
|
175
|
-
|
|
176
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
## [0.2.3](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.2...v0.2.3) (2026-01-12)
|
|
183
|
-
|
|
184
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
## [0.2.2](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.1...v0.2.2) (2026-01-12)
|
|
191
|
-
|
|
192
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
## [0.2.1](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.0...v0.2.1) (2026-01-12)
|
|
199
|
-
|
|
200
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
# [0.2.0](https://github.com/sprucelabsai-community/regressionproof/compare/v0.1.3...v0.2.0) (2026-01-12)
|
|
207
|
-
|
|
208
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
## [0.1.3](https://github.com/sprucelabsai-community/regressionproof/compare/v0.1.2...v0.1.3) (2026-01-12)
|
|
215
|
-
|
|
216
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
## [0.1.2](https://github.com/sprucelabsai-community/regressionproof/compare/v0.1.1...v0.1.2) (2026-01-12)
|
|
223
|
-
|
|
224
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
## [0.1.1](https://github.com/sprucelabsai-community/regressionproof/compare/v0.1.0...v0.1.1) (2026-01-12)
|
|
231
|
-
|
|
232
|
-
**Note:** Version bump only for package @regressionproof/jest-reporter
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
# 0.1.0 (2026-01-12)
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
### Bug Fixes
|
|
242
|
-
|
|
243
|
-
* configure package publishing ([fe9f0ca](https://github.com/sprucelabsai-community/regressionproof/commit/fe9f0ca))
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
### Documentation
|
|
247
|
-
|
|
248
|
-
* simplify README, add ARCHITECTURE.md ([8246e6e](https://github.com/sprucelabsai-community/regressionproof/commit/8246e6e))
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
### Features
|
|
252
|
-
|
|
253
|
-
* implement jest-reporter with config loading and result transformation ([675e0b4](https://github.com/sprucelabsai-community/regressionproof/commit/675e0b4))
|
|
254
|
-
* lerna, CJS builds, slug validation, jest-reporter scaffold ([2516cac](https://github.com/sprucelabsai-community/regressionproof/commit/2516cac))
|
package/eslint.config.mjs
DELETED
package/src/config/loadConfig.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { execSync } from 'child_process'
|
|
2
|
-
import fs from 'fs'
|
|
3
|
-
import os from 'os'
|
|
4
|
-
import path from 'path'
|
|
5
|
-
|
|
6
|
-
export function loadConfig(cwd: string): ReporterConfig | null {
|
|
7
|
-
const projectName = detectProjectName(cwd)
|
|
8
|
-
if (!projectName) {
|
|
9
|
-
return null
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const baseDir = path.join(os.homedir(), '.regressionproof')
|
|
13
|
-
const configPath = path.join(baseDir, projectName, 'config.json')
|
|
14
|
-
|
|
15
|
-
if (!fs.existsSync(configPath)) {
|
|
16
|
-
return null
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'))
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
projectName,
|
|
23
|
-
mirrorPath: path.join(baseDir, projectName, 'mirror'),
|
|
24
|
-
remote: {
|
|
25
|
-
url: config.remote.url,
|
|
26
|
-
token: config.remote.token,
|
|
27
|
-
},
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function detectProjectName(cwd: string): string | null {
|
|
32
|
-
const localConfigPath = path.join(cwd, '.regressionproof.json')
|
|
33
|
-
if (fs.existsSync(localConfigPath)) {
|
|
34
|
-
const localConfig = JSON.parse(
|
|
35
|
-
fs.readFileSync(localConfigPath, 'utf-8')
|
|
36
|
-
)
|
|
37
|
-
if (localConfig.projectName) {
|
|
38
|
-
return localConfig.projectName
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return getProjectNameFromGit(cwd)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function getProjectNameFromGit(cwd: string): string | null {
|
|
46
|
-
try {
|
|
47
|
-
const remoteUrl = execSync('git remote get-url origin', {
|
|
48
|
-
cwd,
|
|
49
|
-
encoding: 'utf-8',
|
|
50
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
51
|
-
}).trim()
|
|
52
|
-
|
|
53
|
-
const match = remoteUrl.match(/[/:]([^/:]+?)(\.git)?$/)
|
|
54
|
-
return toSlug(match?.[1] ?? '') || null
|
|
55
|
-
} catch {
|
|
56
|
-
return null
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function toSlug(input: string): string {
|
|
61
|
-
return input
|
|
62
|
-
.toLowerCase()
|
|
63
|
-
.replace(/\s+/g, '-')
|
|
64
|
-
.replace(/[^a-z0-9-_]/g, '')
|
|
65
|
-
.replace(/-+/g, '-')
|
|
66
|
-
.replace(/^-|-$/g, '')
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface ReporterConfig {
|
|
70
|
-
projectName: string
|
|
71
|
-
mirrorPath: string
|
|
72
|
-
remote: {
|
|
73
|
-
url: string
|
|
74
|
-
token: string
|
|
75
|
-
}
|
|
76
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AggregatedResult,
|
|
3
|
-
Reporter,
|
|
4
|
-
ReporterOnStartOptions,
|
|
5
|
-
Test,
|
|
6
|
-
TestCaseResult,
|
|
7
|
-
TestContext,
|
|
8
|
-
} from '@jest/reporters'
|
|
9
|
-
import { snapshot } from '@regressionproof/snapshotter'
|
|
10
|
-
import { loadConfig } from './config/loadConfig.js'
|
|
11
|
-
import { transformResults } from './transformers/transformResults.js'
|
|
12
|
-
|
|
13
|
-
export default class RegressionProofReporter implements Reporter {
|
|
14
|
-
private cwd: string
|
|
15
|
-
|
|
16
|
-
public constructor(_globalConfig?: unknown, _reporterConfig?: unknown) {
|
|
17
|
-
this.cwd = process.cwd()
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public onRunStart(
|
|
21
|
-
_results: AggregatedResult,
|
|
22
|
-
_options: ReporterOnStartOptions
|
|
23
|
-
): void {}
|
|
24
|
-
|
|
25
|
-
public onTestFileStart(_test: Test): void {}
|
|
26
|
-
|
|
27
|
-
public onTestCaseResult(
|
|
28
|
-
_test: Test,
|
|
29
|
-
_testCaseResult: TestCaseResult
|
|
30
|
-
): void {}
|
|
31
|
-
|
|
32
|
-
public async onRunComplete(
|
|
33
|
-
_testContexts: Set<TestContext>,
|
|
34
|
-
results: AggregatedResult
|
|
35
|
-
): Promise<void> {
|
|
36
|
-
const config = loadConfig(this.cwd)
|
|
37
|
-
|
|
38
|
-
if (!config) {
|
|
39
|
-
console.log(
|
|
40
|
-
'[RegressionProof] No config found. Run `regressionproof init` to set up.'
|
|
41
|
-
)
|
|
42
|
-
return
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const testResults = transformResults(results, this.cwd)
|
|
46
|
-
|
|
47
|
-
console.log(
|
|
48
|
-
`[RegressionProof] ${testResults.summary.passedTests}/${testResults.summary.totalTests} tests passed`
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
try {
|
|
52
|
-
const committed = await snapshot({
|
|
53
|
-
sourcePath: this.cwd,
|
|
54
|
-
mirrorPath: config.mirrorPath,
|
|
55
|
-
testResults,
|
|
56
|
-
remote: config.remote,
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
if (committed) {
|
|
60
|
-
console.log('[RegressionProof] Snapshot captured successfully')
|
|
61
|
-
} else {
|
|
62
|
-
console.log('[RegressionProof] No changes to snapshot')
|
|
63
|
-
}
|
|
64
|
-
} catch (err) {
|
|
65
|
-
console.error(
|
|
66
|
-
'[RegressionProof] Failed to capture snapshot:',
|
|
67
|
-
err instanceof Error ? err.message : err
|
|
68
|
-
)
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
public getLastError(): Error | void {
|
|
73
|
-
return undefined
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import path from 'path'
|
|
2
|
-
import type { AggregatedResult } from '@jest/reporters'
|
|
3
|
-
import type {
|
|
4
|
-
TestResults,
|
|
5
|
-
SuiteResult,
|
|
6
|
-
TestResult,
|
|
7
|
-
} from '@regressionproof/snapshotter'
|
|
8
|
-
|
|
9
|
-
export function transformResults(
|
|
10
|
-
jestResults: AggregatedResult,
|
|
11
|
-
cwd: string
|
|
12
|
-
): TestResults {
|
|
13
|
-
const suites: SuiteResult[] = jestResults.testResults.map((suiteResult) => {
|
|
14
|
-
const tests: TestResult[] = suiteResult.testResults.map((test) => ({
|
|
15
|
-
name: test.fullName || test.title,
|
|
16
|
-
passed: test.status === 'passed',
|
|
17
|
-
error:
|
|
18
|
-
test.status === 'failed' && test.failureMessages.length > 0
|
|
19
|
-
? test.failureMessages.join('\n\n')
|
|
20
|
-
: undefined,
|
|
21
|
-
}))
|
|
22
|
-
|
|
23
|
-
const suitePassed = tests.every((t) => t.passed)
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
path: path.relative(cwd, suiteResult.testFilePath),
|
|
27
|
-
passed: suitePassed,
|
|
28
|
-
tests,
|
|
29
|
-
}
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
timestamp: new Date().toISOString(),
|
|
34
|
-
summary: {
|
|
35
|
-
totalSuites: jestResults.numTotalTestSuites,
|
|
36
|
-
passedSuites: jestResults.numPassedTestSuites,
|
|
37
|
-
failedSuites: jestResults.numFailedTestSuites,
|
|
38
|
-
totalTests: jestResults.numTotalTests,
|
|
39
|
-
passedTests: jestResults.numPassedTests,
|
|
40
|
-
failedTests: jestResults.numFailedTests,
|
|
41
|
-
},
|
|
42
|
-
suites,
|
|
43
|
-
}
|
|
44
|
-
}
|
package/tsconfig.dist.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "ES2020",
|
|
4
|
-
"target": "ES6",
|
|
5
|
-
"lib": ["ES2020", "DOM"],
|
|
6
|
-
"skipLibCheck": true,
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"moduleResolution": "node",
|
|
9
|
-
"declaration": true,
|
|
10
|
-
"noImplicitAny": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"noImplicitReturns": true,
|
|
13
|
-
"strict": true,
|
|
14
|
-
"noUnusedLocals": true,
|
|
15
|
-
"resolveJsonModule": true,
|
|
16
|
-
"sourceMap": false,
|
|
17
|
-
"outDir": "./build",
|
|
18
|
-
"baseUrl": "src",
|
|
19
|
-
"experimentalDecorators": true,
|
|
20
|
-
"paths": {
|
|
21
|
-
"#spruce/*": [".spruce/*"]
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"include": ["./src/*.ts", "./src/**/*.ts"],
|
|
25
|
-
"exclude": ["**/node_modules/*", "build/*", "esm/*"]
|
|
26
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"skipLibCheck": true,
|
|
4
|
-
"module": "CommonJS",
|
|
5
|
-
"esModuleInterop": true,
|
|
6
|
-
"target": "ES2020",
|
|
7
|
-
"lib": ["DOM", "ES2022"],
|
|
8
|
-
"declaration": true,
|
|
9
|
-
"noImplicitAny": true,
|
|
10
|
-
"allowJs": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"noImplicitReturns": true,
|
|
13
|
-
"strict": true,
|
|
14
|
-
"noUnusedLocals": true,
|
|
15
|
-
"resolveJsonModule": true,
|
|
16
|
-
"moduleResolution": "node",
|
|
17
|
-
"sourceMap": false,
|
|
18
|
-
"outDir": "build",
|
|
19
|
-
"baseUrl": "src",
|
|
20
|
-
"experimentalDecorators": true,
|
|
21
|
-
"paths": {
|
|
22
|
-
"#spruce/*": [".spruce/*"]
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"include": ["./src/*.ts", "./src/**/*.ts", "./src/.spruce/**/*"],
|
|
26
|
-
"exclude": ["build", "esm"]
|
|
27
|
-
}
|
|
File without changes
|