@teambit/mocha 0.0.217 → 0.0.219
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/dist/index.js +0 -5
- package/dist/index.js.map +1 -1
- package/dist/mocha.aspect.js +0 -5
- package/dist/mocha.aspect.js.map +1 -1
- package/dist/mocha.composition.js +0 -6
- package/dist/mocha.composition.js.map +1 -1
- package/dist/mocha.main.runtime.js +2 -25
- package/dist/mocha.main.runtime.js.map +1 -1
- package/dist/mocha.tester.js +1 -39
- package/dist/mocha.tester.js.map +1 -1
- package/package-tar/teambit-mocha-0.0.219.tgz +0 -0
- package/package.json +6 -6
- package/{preview-1666312873430.js → preview-1666496165706.js} +2 -2
- package/package-tar/teambit-mocha-0.0.217.tgz +0 -0
package/dist/index.js
CHANGED
|
@@ -10,19 +10,14 @@ Object.defineProperty(exports, "MochaAspect", {
|
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
exports.default = void 0;
|
|
13
|
-
|
|
14
13
|
function _mocha() {
|
|
15
14
|
const data = require("./mocha.aspect");
|
|
16
|
-
|
|
17
15
|
_mocha = function () {
|
|
18
16
|
return data;
|
|
19
17
|
};
|
|
20
|
-
|
|
21
18
|
return data;
|
|
22
19
|
}
|
|
23
|
-
|
|
24
20
|
var _default = _mocha().MochaAspect;
|
|
25
|
-
|
|
26
21
|
exports.default = _default;
|
|
27
22
|
|
|
28
23
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MochaAspect"],"sources":["index.ts"],"sourcesContent":["import { MochaAspect } from './mocha.aspect';\n\nexport type { MochaMain } from './mocha.main.runtime';\nexport default MochaAspect;\nexport { MochaAspect };\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["MochaAspect"],"sources":["index.ts"],"sourcesContent":["import { MochaAspect } from './mocha.aspect';\n\nexport type { MochaMain } from './mocha.main.runtime';\nexport default MochaAspect;\nexport { MochaAspect };\n"],"mappings":";;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA6C,eAG9BA,oBAAW;AAAA"}
|
package/dist/mocha.aspect.js
CHANGED
|
@@ -4,21 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.MochaAspect = void 0;
|
|
7
|
-
|
|
8
7
|
function _harmony() {
|
|
9
8
|
const data = require("@teambit/harmony");
|
|
10
|
-
|
|
11
9
|
_harmony = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
const MochaAspect = _harmony().Aspect.create({
|
|
19
15
|
id: 'teambit.defender/mocha'
|
|
20
16
|
});
|
|
21
|
-
|
|
22
17
|
exports.MochaAspect = MochaAspect;
|
|
23
18
|
|
|
24
19
|
//# sourceMappingURL=mocha.aspect.js.map
|
package/dist/mocha.aspect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MochaAspect","Aspect","create","id"],"sources":["mocha.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const MochaAspect = Aspect.create({\n id: 'teambit.defender/mocha',\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["MochaAspect","Aspect","create","id"],"sources":["mocha.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const MochaAspect = Aspect.create({\n id: 'teambit.defender/mocha',\n});\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,WAAW,GAAGC,iBAAM,CAACC,MAAM,CAAC;EACvCC,EAAE,EAAE;AACN,CAAC,CAAC;AAAC"}
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.Logo = void 0;
|
|
9
|
-
|
|
10
8
|
function _react() {
|
|
11
9
|
const data = _interopRequireDefault(require("react"));
|
|
12
|
-
|
|
13
10
|
_react = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
|
|
21
16
|
style: {
|
|
22
17
|
height: '100%',
|
|
@@ -29,7 +24,6 @@ const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
|
|
|
29
24
|
},
|
|
30
25
|
src: "https://static.bit.dev/extensions-icons/mocha.svg"
|
|
31
26
|
}));
|
|
32
|
-
|
|
33
27
|
exports.Logo = Logo;
|
|
34
28
|
|
|
35
29
|
//# sourceMappingURL=mocha.composition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["mocha.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/mocha.svg\" />\n </div>\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["mocha.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/mocha.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAG,CAAE;EAAC,GAAG,EAAC;AAAmD,EAAG,CAExF;AAAC"}
|
|
@@ -1,88 +1,65 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.promise.js");
|
|
8
|
-
|
|
9
6
|
Object.defineProperty(exports, "__esModule", {
|
|
10
7
|
value: true
|
|
11
8
|
});
|
|
12
9
|
exports.MochaMain = void 0;
|
|
13
|
-
|
|
14
10
|
function _defineProperty2() {
|
|
15
11
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
|
|
17
12
|
_defineProperty2 = function () {
|
|
18
13
|
return data;
|
|
19
14
|
};
|
|
20
|
-
|
|
21
15
|
return data;
|
|
22
16
|
}
|
|
23
|
-
|
|
24
17
|
function _cli() {
|
|
25
18
|
const data = require("@teambit/cli");
|
|
26
|
-
|
|
27
19
|
_cli = function () {
|
|
28
20
|
return data;
|
|
29
21
|
};
|
|
30
|
-
|
|
31
22
|
return data;
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
function _logger() {
|
|
35
25
|
const data = require("@teambit/logger");
|
|
36
|
-
|
|
37
26
|
_logger = function () {
|
|
38
27
|
return data;
|
|
39
28
|
};
|
|
40
|
-
|
|
41
29
|
return data;
|
|
42
30
|
}
|
|
43
|
-
|
|
44
31
|
function _mocha() {
|
|
45
32
|
const data = require("./mocha.aspect");
|
|
46
|
-
|
|
47
33
|
_mocha = function () {
|
|
48
34
|
return data;
|
|
49
35
|
};
|
|
50
|
-
|
|
51
36
|
return data;
|
|
52
37
|
}
|
|
53
|
-
|
|
54
38
|
function _mocha2() {
|
|
55
39
|
const data = require("./mocha.tester");
|
|
56
|
-
|
|
57
40
|
_mocha2 = function () {
|
|
58
41
|
return data;
|
|
59
42
|
};
|
|
60
|
-
|
|
61
43
|
return data;
|
|
62
44
|
}
|
|
63
|
-
|
|
64
45
|
class MochaMain {
|
|
65
46
|
constructor(logger) {
|
|
66
47
|
this.logger = logger;
|
|
67
48
|
}
|
|
68
|
-
|
|
69
|
-
|
|
49
|
+
createTester(mochaConfig = {}, babelConfig = {},
|
|
50
|
+
// eslint-disable-next-line global-require
|
|
70
51
|
mochaModule = require('mocha')) {
|
|
71
52
|
return new (_mocha2().MochaTester)(_mocha().MochaAspect.id, this.logger, mochaConfig, babelConfig, mochaModule);
|
|
72
53
|
}
|
|
73
|
-
|
|
74
54
|
static async provider([loggerMain]) {
|
|
75
55
|
const logger = loggerMain.createLogger(_mocha().MochaAspect.id);
|
|
76
56
|
return new MochaMain(logger);
|
|
77
57
|
}
|
|
78
|
-
|
|
79
58
|
}
|
|
80
|
-
|
|
81
59
|
exports.MochaMain = MochaMain;
|
|
82
60
|
(0, _defineProperty2().default)(MochaMain, "slots", []);
|
|
83
61
|
(0, _defineProperty2().default)(MochaMain, "dependencies", [_logger().LoggerAspect]);
|
|
84
62
|
(0, _defineProperty2().default)(MochaMain, "runtime", _cli().MainRuntime);
|
|
85
|
-
|
|
86
63
|
_mocha().MochaAspect.addRuntime(MochaMain);
|
|
87
64
|
|
|
88
65
|
//# sourceMappingURL=mocha.main.runtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MochaMain","constructor","logger","createTester","mochaConfig","babelConfig","mochaModule","require","MochaTester","MochaAspect","id","provider","loggerMain","createLogger","LoggerAspect","MainRuntime","addRuntime"],"sources":["mocha.main.runtime.ts"],"sourcesContent":["import { MainRuntime } from '@teambit/cli';\nimport type { TransformOptions } from '@babel/core';\nimport type Mocha from 'mocha';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { MochaAspect } from './mocha.aspect';\nimport { MochaTester } from './mocha.tester';\n\nexport class MochaMain {\n constructor(private logger: Logger) {}\n\n createTester(\n mochaConfig: Mocha.MochaOptions = {},\n babelConfig: TransformOptions = {},\n // eslint-disable-next-line global-require\n mochaModule = require('mocha')\n ) {\n return new MochaTester(MochaAspect.id, this.logger, mochaConfig, babelConfig, mochaModule);\n }\n\n static slots = [];\n static dependencies = [LoggerAspect];\n static runtime = MainRuntime;\n static async provider([loggerMain]: [LoggerMain]) {\n const logger = loggerMain.createLogger(MochaAspect.id);\n return new MochaMain(logger);\n }\n}\n\nMochaAspect.addRuntime(MochaMain);\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["MochaMain","constructor","logger","createTester","mochaConfig","babelConfig","mochaModule","require","MochaTester","MochaAspect","id","provider","loggerMain","createLogger","LoggerAspect","MainRuntime","addRuntime"],"sources":["mocha.main.runtime.ts"],"sourcesContent":["import { MainRuntime } from '@teambit/cli';\nimport type { TransformOptions } from '@babel/core';\nimport type Mocha from 'mocha';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { MochaAspect } from './mocha.aspect';\nimport { MochaTester } from './mocha.tester';\n\nexport class MochaMain {\n constructor(private logger: Logger) {}\n\n createTester(\n mochaConfig: Mocha.MochaOptions = {},\n babelConfig: TransformOptions = {},\n // eslint-disable-next-line global-require\n mochaModule = require('mocha')\n ) {\n return new MochaTester(MochaAspect.id, this.logger, mochaConfig, babelConfig, mochaModule);\n }\n\n static slots = [];\n static dependencies = [LoggerAspect];\n static runtime = MainRuntime;\n static async provider([loggerMain]: [LoggerMain]) {\n const logger = loggerMain.createLogger(MochaAspect.id);\n return new MochaMain(logger);\n }\n}\n\nMochaAspect.addRuntime(MochaMain);\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,SAAS,CAAC;EACrBC,WAAW,CAASC,MAAc,EAAE;IAAA,KAAhBA,MAAc,GAAdA,MAAc;EAAG;EAErCC,YAAY,CACVC,WAA+B,GAAG,CAAC,CAAC,EACpCC,WAA6B,GAAG,CAAC,CAAC;EAClC;EACAC,WAAW,GAAGC,OAAO,CAAC,OAAO,CAAC,EAC9B;IACA,OAAO,KAAIC,qBAAW,EAACC,oBAAW,CAACC,EAAE,EAAE,IAAI,CAACR,MAAM,EAAEE,WAAW,EAAEC,WAAW,EAAEC,WAAW,CAAC;EAC5F;EAKA,aAAaK,QAAQ,CAAC,CAACC,UAAU,CAAe,EAAE;IAChD,MAAMV,MAAM,GAAGU,UAAU,CAACC,YAAY,CAACJ,oBAAW,CAACC,EAAE,CAAC;IACtD,OAAO,IAAIV,SAAS,CAACE,MAAM,CAAC;EAC9B;AACF;AAAC;AAAA,gCAnBYF,SAAS,WAYL,EAAE;AAAA,gCAZNA,SAAS,kBAaE,CAACc,sBAAY,CAAC;AAAA,gCAbzBd,SAAS,aAcHe,kBAAW;AAO9BN,oBAAW,CAACO,UAAU,CAAChB,SAAS,CAAC"}
|
package/dist/mocha.tester.js
CHANGED
|
@@ -1,94 +1,65 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.array.flat.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.array.iterator.js");
|
|
8
|
-
|
|
9
6
|
require("core-js/modules/es.array.unscopables.flat.js");
|
|
10
|
-
|
|
11
7
|
require("core-js/modules/es.promise.js");
|
|
12
|
-
|
|
13
8
|
Object.defineProperty(exports, "__esModule", {
|
|
14
9
|
value: true
|
|
15
10
|
});
|
|
16
11
|
exports.MochaTester = void 0;
|
|
17
|
-
|
|
18
12
|
function _defineProperty2() {
|
|
19
13
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
20
|
-
|
|
21
14
|
_defineProperty2 = function () {
|
|
22
15
|
return data;
|
|
23
16
|
};
|
|
24
|
-
|
|
25
17
|
return data;
|
|
26
18
|
}
|
|
27
|
-
|
|
28
19
|
function _tester() {
|
|
29
20
|
const data = require("@teambit/tester");
|
|
30
|
-
|
|
31
21
|
_tester = function () {
|
|
32
22
|
return data;
|
|
33
23
|
};
|
|
34
|
-
|
|
35
24
|
return data;
|
|
36
25
|
}
|
|
37
|
-
|
|
38
26
|
function _mocha() {
|
|
39
27
|
const data = _interopRequireDefault(require("mocha"));
|
|
40
|
-
|
|
41
28
|
_mocha = function () {
|
|
42
29
|
return data;
|
|
43
30
|
};
|
|
44
|
-
|
|
45
31
|
return data;
|
|
46
32
|
}
|
|
47
|
-
|
|
48
33
|
function _register() {
|
|
49
34
|
const data = _interopRequireDefault(require("@babel/register"));
|
|
50
|
-
|
|
51
35
|
_register = function () {
|
|
52
36
|
return data;
|
|
53
37
|
};
|
|
54
|
-
|
|
55
38
|
return data;
|
|
56
39
|
}
|
|
57
|
-
|
|
58
40
|
function _testsResults() {
|
|
59
41
|
const data = require("@teambit/tests-results");
|
|
60
|
-
|
|
61
42
|
_testsResults = function () {
|
|
62
43
|
return data;
|
|
63
44
|
};
|
|
64
|
-
|
|
65
45
|
return data;
|
|
66
46
|
}
|
|
67
|
-
|
|
68
47
|
function _pMapSeries() {
|
|
69
48
|
const data = _interopRequireDefault(require("p-map-series"));
|
|
70
|
-
|
|
71
49
|
_pMapSeries = function () {
|
|
72
50
|
return data;
|
|
73
51
|
};
|
|
74
|
-
|
|
75
52
|
return data;
|
|
76
53
|
}
|
|
77
|
-
|
|
78
54
|
function _lodash() {
|
|
79
55
|
const data = require("lodash");
|
|
80
|
-
|
|
81
56
|
_lodash = function () {
|
|
82
57
|
return data;
|
|
83
58
|
};
|
|
84
|
-
|
|
85
59
|
return data;
|
|
86
60
|
}
|
|
87
|
-
|
|
88
61
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
89
|
-
|
|
90
62
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
91
|
-
|
|
92
63
|
class MochaTester {
|
|
93
64
|
constructor(id, logger, mochaConfig,
|
|
94
65
|
/**
|
|
@@ -104,7 +75,6 @@ class MochaTester {
|
|
|
104
75
|
(0, _defineProperty2().default)(this, "_callback", void 0);
|
|
105
76
|
(0, _defineProperty2().default)(this, "displayName", 'Mocha');
|
|
106
77
|
}
|
|
107
|
-
|
|
108
78
|
async test(context) {
|
|
109
79
|
const specsPerComp = context.specFiles.toArray();
|
|
110
80
|
const allSpecsFiles = specsPerComp.map(([, specFiles]) => specFiles.map(specFile => specFile.path)).flat();
|
|
@@ -132,25 +102,20 @@ class MochaTester {
|
|
|
132
102
|
});
|
|
133
103
|
return new (_tester().Tests)(componentsResults);
|
|
134
104
|
}
|
|
105
|
+
|
|
135
106
|
/**
|
|
136
107
|
* @todo: make this work. currently, it doesn't update the UI upon changes.
|
|
137
108
|
*/
|
|
138
|
-
|
|
139
|
-
|
|
140
109
|
async watch(context) {
|
|
141
110
|
const results = await this.test(context);
|
|
142
|
-
|
|
143
111
|
if (this._callback) {
|
|
144
112
|
this._callback(results);
|
|
145
113
|
}
|
|
146
|
-
|
|
147
114
|
return results;
|
|
148
115
|
}
|
|
149
|
-
|
|
150
116
|
async onTestRunComplete(callback) {
|
|
151
117
|
this._callback = callback;
|
|
152
118
|
}
|
|
153
|
-
|
|
154
119
|
async runMochaOnOneFile(file) {
|
|
155
120
|
const mocha = new this.MochaModule(this.mochaConfig);
|
|
156
121
|
mocha.addFile(file.path);
|
|
@@ -168,14 +133,11 @@ class MochaTester {
|
|
|
168
133
|
});
|
|
169
134
|
});
|
|
170
135
|
}
|
|
171
|
-
|
|
172
136
|
version() {
|
|
173
137
|
// @ts-ignore
|
|
174
138
|
return _mocha().default.prototype.version || 'N/A';
|
|
175
139
|
}
|
|
176
|
-
|
|
177
140
|
}
|
|
178
|
-
|
|
179
141
|
exports.MochaTester = MochaTester;
|
|
180
142
|
|
|
181
143
|
//# sourceMappingURL=mocha.tester.js.map
|
package/dist/mocha.tester.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MochaTester","constructor","id","logger","mochaConfig","babelConfig","MochaModule","test","context","specsPerComp","specFiles","toArray","allSpecsFiles","map","specFile","path","flat","babelRegister","only","filePath","includes","extensions","componentsResults","pMapSeries","component","files","testsFiles","file","runMochaOnOneFile","err","errMsg","message","error","consoleFailure","TestsFiles","relative","undefined","allComponentErrors","testFile","tests","failureErrOrStr","componentId","results","TestsResult","errors","compact","Tests","watch","_callback","onTestRunComplete","callback","mocha","addFile","testResults","Promise","resolve","runner","run","on","state","Error","title","push","TestResult","titlePath","duration","stats","testsFile","passes","failures","pending","version","Mocha","prototype"],"sources":["mocha.tester.ts"],"sourcesContent":["import { Logger } from '@teambit/logger';\nimport { ComponentsResults, Tester, CallbackFn, TesterContext, Tests } from '@teambit/tester';\nimport Mocha from 'mocha';\nimport babelRegister from '@babel/register';\nimport type { TransformOptions } from '@babel/core';\nimport { TestResult, TestsFiles, TestsResult } from '@teambit/tests-results';\nimport pMapSeries from 'p-map-series';\nimport { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\nimport { compact } from 'lodash';\n\nexport class MochaTester implements Tester {\n _callback: CallbackFn | undefined;\n displayName = 'Mocha';\n constructor(\n readonly id: string,\n private logger: Logger,\n readonly mochaConfig: Mocha.MochaOptions,\n /**\n * babel config are needed when the spec files are not native javascript and need to be compiled.\n * pass the same config you pass to your babel compiler if you're using one.\n */\n private babelConfig: TransformOptions,\n private MochaModule: typeof Mocha\n ) {}\n async test(context: TesterContext): Promise<Tests> {\n const specsPerComp = context.specFiles.toArray();\n const allSpecsFiles = specsPerComp.map(([, specFiles]) => specFiles.map((specFile) => specFile.path)).flat();\n babelRegister({\n only: [(filePath: string) => allSpecsFiles.includes(filePath)],\n extensions: ['.es6', '.es', '.jsx', '.js', '.mjs', '.ts', '.tsx'],\n ...(this.babelConfig || {}),\n });\n const componentsResults: ComponentsResults[] = await pMapSeries(specsPerComp, async ([component, files]) => {\n const testsFiles: TestsFiles[] = await pMapSeries(files, async (file) => {\n try {\n return await this.runMochaOnOneFile(file);\n } catch (err: any) {\n const errMsg = `Mocha found an error while working on \"${file.path}\". ${err.message}`;\n this.logger.error(errMsg, err);\n this.logger.consoleFailure(errMsg);\n return new TestsFiles(file.relative, [], 0, 0, 0, undefined, undefined, err);\n }\n });\n const allComponentErrors = testsFiles\n .map((testFile) => testFile.error || testFile.tests.map((test) => test.failureErrOrStr as Error))\n .flat();\n return {\n componentId: component.id,\n results: new TestsResult(testsFiles),\n errors: compact(allComponentErrors),\n };\n });\n return new Tests(componentsResults);\n }\n\n /**\n * @todo: make this work. currently, it doesn't update the UI upon changes.\n */\n async watch(context: TesterContext): Promise<Tests> {\n const results = await this.test(context);\n if (this._callback) {\n this._callback(results);\n }\n return results;\n }\n\n async onTestRunComplete(callback: CallbackFn) {\n this._callback = callback;\n }\n\n private async runMochaOnOneFile(file: AbstractVinyl): Promise<TestsFiles> {\n const mocha = new this.MochaModule(this.mochaConfig);\n mocha.addFile(file.path);\n const testResults: TestResult[] = [];\n return new Promise((resolve) => {\n const runner = mocha\n .run()\n .on('test end', function (test) {\n const state = test.state;\n if (!state)\n throw new Error(`the test.state of \"${test.title}\", file \"${file.path}\" is neither passed nor failed`);\n testResults.push(new TestResult(test.titlePath(), test.title, state, test.duration, undefined, test.err));\n })\n .on('end', function () {\n const stats = runner.stats;\n if (!stats) throw new Error('stats is missing');\n const testsFile = new TestsFiles(\n file.relative,\n testResults,\n stats.passes,\n stats.failures,\n stats.pending,\n stats.duration\n );\n resolve(testsFile);\n });\n });\n }\n\n version(): string {\n // @ts-ignore\n return Mocha.prototype.version || 'N/A';\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["MochaTester","constructor","id","logger","mochaConfig","babelConfig","MochaModule","test","context","specsPerComp","specFiles","toArray","allSpecsFiles","map","specFile","path","flat","babelRegister","only","filePath","includes","extensions","componentsResults","pMapSeries","component","files","testsFiles","file","runMochaOnOneFile","err","errMsg","message","error","consoleFailure","TestsFiles","relative","undefined","allComponentErrors","testFile","tests","failureErrOrStr","componentId","results","TestsResult","errors","compact","Tests","watch","_callback","onTestRunComplete","callback","mocha","addFile","testResults","Promise","resolve","runner","run","on","state","Error","title","push","TestResult","titlePath","duration","stats","testsFile","passes","failures","pending","version","Mocha","prototype"],"sources":["mocha.tester.ts"],"sourcesContent":["import { Logger } from '@teambit/logger';\nimport { ComponentsResults, Tester, CallbackFn, TesterContext, Tests } from '@teambit/tester';\nimport Mocha from 'mocha';\nimport babelRegister from '@babel/register';\nimport type { TransformOptions } from '@babel/core';\nimport { TestResult, TestsFiles, TestsResult } from '@teambit/tests-results';\nimport pMapSeries from 'p-map-series';\nimport { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\nimport { compact } from 'lodash';\n\nexport class MochaTester implements Tester {\n _callback: CallbackFn | undefined;\n displayName = 'Mocha';\n constructor(\n readonly id: string,\n private logger: Logger,\n readonly mochaConfig: Mocha.MochaOptions,\n /**\n * babel config are needed when the spec files are not native javascript and need to be compiled.\n * pass the same config you pass to your babel compiler if you're using one.\n */\n private babelConfig: TransformOptions,\n private MochaModule: typeof Mocha\n ) {}\n async test(context: TesterContext): Promise<Tests> {\n const specsPerComp = context.specFiles.toArray();\n const allSpecsFiles = specsPerComp.map(([, specFiles]) => specFiles.map((specFile) => specFile.path)).flat();\n babelRegister({\n only: [(filePath: string) => allSpecsFiles.includes(filePath)],\n extensions: ['.es6', '.es', '.jsx', '.js', '.mjs', '.ts', '.tsx'],\n ...(this.babelConfig || {}),\n });\n const componentsResults: ComponentsResults[] = await pMapSeries(specsPerComp, async ([component, files]) => {\n const testsFiles: TestsFiles[] = await pMapSeries(files, async (file) => {\n try {\n return await this.runMochaOnOneFile(file);\n } catch (err: any) {\n const errMsg = `Mocha found an error while working on \"${file.path}\". ${err.message}`;\n this.logger.error(errMsg, err);\n this.logger.consoleFailure(errMsg);\n return new TestsFiles(file.relative, [], 0, 0, 0, undefined, undefined, err);\n }\n });\n const allComponentErrors = testsFiles\n .map((testFile) => testFile.error || testFile.tests.map((test) => test.failureErrOrStr as Error))\n .flat();\n return {\n componentId: component.id,\n results: new TestsResult(testsFiles),\n errors: compact(allComponentErrors),\n };\n });\n return new Tests(componentsResults);\n }\n\n /**\n * @todo: make this work. currently, it doesn't update the UI upon changes.\n */\n async watch(context: TesterContext): Promise<Tests> {\n const results = await this.test(context);\n if (this._callback) {\n this._callback(results);\n }\n return results;\n }\n\n async onTestRunComplete(callback: CallbackFn) {\n this._callback = callback;\n }\n\n private async runMochaOnOneFile(file: AbstractVinyl): Promise<TestsFiles> {\n const mocha = new this.MochaModule(this.mochaConfig);\n mocha.addFile(file.path);\n const testResults: TestResult[] = [];\n return new Promise((resolve) => {\n const runner = mocha\n .run()\n .on('test end', function (test) {\n const state = test.state;\n if (!state)\n throw new Error(`the test.state of \"${test.title}\", file \"${file.path}\" is neither passed nor failed`);\n testResults.push(new TestResult(test.titlePath(), test.title, state, test.duration, undefined, test.err));\n })\n .on('end', function () {\n const stats = runner.stats;\n if (!stats) throw new Error('stats is missing');\n const testsFile = new TestsFiles(\n file.relative,\n testResults,\n stats.passes,\n stats.failures,\n stats.pending,\n stats.duration\n );\n resolve(testsFile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WAAW,EACXa,KAAK,CAACE,MAAM,EACZF,KAAK,CAACG,QAAQ,EACdH,KAAK,CAACI,OAAO,EACbJ,KAAK,CAACD,QAAQ,CACf;QACDV,OAAO,CAACY,SAAS,CAAC;MACpB,CAAC,CAAC;IACN,CAAC,CAAC;EACJ;EAEAI,OAAO,GAAW;IAChB;IACA,OAAOC,gBAAK,CAACC,SAAS,CAACF,OAAO,IAAI,KAAK;EACzC;AACF;AAAC"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/mocha",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.219",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/defender/mocha",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.defender",
|
|
8
8
|
"name": "mocha",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.219"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@babel/core": "7.12.17",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"@babel/runtime": "7.12.18",
|
|
18
18
|
"core-js": "^3.0.0",
|
|
19
19
|
"@teambit/harmony": "0.3.3",
|
|
20
|
-
"@teambit/cli": "0.0.
|
|
21
|
-
"@teambit/logger": "0.0.
|
|
22
|
-
"@teambit/tester": "0.0.
|
|
20
|
+
"@teambit/cli": "0.0.591",
|
|
21
|
+
"@teambit/logger": "0.0.684",
|
|
22
|
+
"@teambit/tester": "0.0.882",
|
|
23
23
|
"@teambit/tests-results": "0.0.103"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@types/node": "12.20.4"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@teambit/legacy": "1.0.
|
|
35
|
+
"@teambit/legacy": "1.0.374",
|
|
36
36
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
37
37
|
"react": "^16.8.0 || ^17.0.0"
|
|
38
38
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_mocha@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_mocha@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_mocha@0.0.219/dist/mocha.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_mocha@0.0.219/dist/mocha.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
Binary file
|