build-raptor-jest-reporter 0.131.0 → 0.133.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.
@@ -0,0 +1,47 @@
1
+ (() => {
2
+ const fs = require(`fs`)
3
+ const path = require(`path`)
4
+ const dist = path.dirname(__dirname)
5
+ const distNodeModules = path.join(dist, `node_modules`)
6
+ const distDeps = path.join(dist, `deps`)
7
+ fs.rmSync(distNodeModules, {force: true, recursive: true})
8
+ fs.mkdirSync(distNodeModules, {recursive: true})
9
+ if (fs.existsSync(distDeps)) {
10
+ for (const p of fs.readdirSync(distDeps)) {
11
+ fs.symlinkSync(`../deps/${p}`, `${distNodeModules}/${p}`)
12
+ }
13
+ }
14
+ })()
15
+ const path = require('path')
16
+ const fs = require('fs')
17
+
18
+ module.exports = class BuildRaptorJestReporter {
19
+ constructor(config) {
20
+ if (!config.outputFile) {
21
+ throw new Error(`outputFile is missing (must be specified in the config)`)
22
+ }
23
+
24
+ this.file = path.isAbsolute(config.outputFile) ? config.outputFile : path.join(config.rootDir, config.outputFile)
25
+ this.cases = []
26
+ }
27
+
28
+ getLastError() {}
29
+ onRunStart() {}
30
+
31
+ onTestCaseResult(test, testCaseResult) {
32
+ this.cases.push({ testFile: test.path, testCaseResult })
33
+ }
34
+ onRunComplete() {
35
+ const cases = this.cases.map(at => ({
36
+ testCaseFullName: at.testCaseResult.fullName,
37
+ fileName: at.testFile,
38
+ ancestorTitles: at.testCaseResult.ancestorTitles,
39
+ title: at.testCaseResult.title,
40
+ status: at.testCaseResult.status,
41
+ duration: at.testCaseResult.duration ?? undefined,
42
+ message: at.testCaseResult.failureMessages?.join('\n'),
43
+ }))
44
+ const output = { cases }
45
+ fs.writeFileSync(this.file, JSON.stringify(output))
46
+ }
47
+ }
package/package.json CHANGED
@@ -1,11 +1,20 @@
1
1
  {
2
2
  "name": "build-raptor-jest-reporter",
3
- "version": "0.131.0",
4
- "type": "module",
5
- "main": "index.js",
6
- "types": "index.d.ts",
3
+ "version": "0.133.0",
4
+ "description": "",
5
+ "keywords": [],
6
+ "author": "",
7
+ "main": "dist/src/index.js",
7
8
  "files": [
8
- "index.js",
9
- "index.d.ts"
10
- ]
9
+ "dist"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsc -b && cp src/a.js dist/src/index.js",
13
+ "build:post": "cp src/a.js dist/src/index.js",
14
+ "test": "jest"
15
+ },
16
+ "jest": {
17
+ "preset": "../../jest.preset.js"
18
+ },
19
+ "nohoist": true
11
20
  }
package/index.js DELETED
@@ -1,53 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
- }) : x)(function(x) {
7
- if (typeof require !== "undefined") return require.apply(this, arguments);
8
- throw Error('Dynamic require of "' + x + '" is not supported');
9
- });
10
- var __commonJS = (cb, mod) => function __require2() {
11
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
- };
13
-
14
- // modules/build-raptor-jest-reporter/dist/src/index.js
15
- var require_index = __commonJS({
16
- "modules/build-raptor-jest-reporter/dist/src/index.js"(exports, module) {
17
- var path = __require("path");
18
- var fs = __require("fs");
19
- module.exports = class BuildRaptorJestReporter {
20
- static {
21
- __name(this, "BuildRaptorJestReporter");
22
- }
23
- constructor(config) {
24
- if (!config.outputFile) {
25
- throw new Error(`outputFile is missing (must be specified in the config)`);
26
- }
27
- this.file = path.isAbsolute(config.outputFile) ? config.outputFile : path.join(config.rootDir, config.outputFile);
28
- this.cases = [];
29
- }
30
- getLastError() {
31
- }
32
- onRunStart() {
33
- }
34
- onTestCaseResult(test, testCaseResult) {
35
- this.cases.push({ testFile: test.path, testCaseResult });
36
- }
37
- onRunComplete() {
38
- const cases = this.cases.map((at) => ({
39
- testCaseFullName: at.testCaseResult.fullName,
40
- fileName: at.testFile,
41
- ancestorTitles: at.testCaseResult.ancestorTitles,
42
- title: at.testCaseResult.title,
43
- status: at.testCaseResult.status,
44
- duration: at.testCaseResult.duration ?? void 0,
45
- message: at.testCaseResult.failureMessages?.join("\n")
46
- }));
47
- const output = { cases };
48
- fs.writeFileSync(this.file, JSON.stringify(output));
49
- }
50
- };
51
- }
52
- });
53
- export default require_index();
File without changes