@sprucelabs/spruce-cli 18.1.5 → 18.1.6
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/CHANGELOG.md +4 -0
- package/build/__tests__/behavioral/WatchingSkillViews.test.d.ts +1 -9
- package/build/__tests__/behavioral/WatchingSkillViews.test.js +25 -463
- package/build/__tests__/behavioral/WatchingSkillViews.test.js.map +1 -1
- package/build/features/AbstractAction.d.ts +1 -1
- package/build/features/AbstractAction.js +4 -4
- package/build/features/AbstractAction.js.map +1 -1
- package/build/features/dependencies/actions/AddAction.js +1 -1
- package/build/features/dependencies/actions/AddAction.js.map +1 -1
- package/build/features/deploy/actions/HerokuAction.js +2 -2
- package/build/features/deploy/actions/HerokuAction.js.map +1 -1
- package/build/features/node/actions/UpdateDependenciesAction.js +1 -1
- package/build/features/node/actions/UpdateDependenciesAction.js.map +1 -1
- package/build/features/node/actions/UpgradeAction.js +1 -1
- package/build/features/node/actions/UpgradeAction.js.map +1 -1
- package/build/features/test/actions/CreateAction.js +2 -2
- package/build/features/test/actions/CreateAction.js.map +1 -1
- package/build/features/view/actions/WatchAction.d.ts +3 -16
- package/build/features/view/actions/WatchAction.js +32 -165
- package/build/features/view/actions/WatchAction.js.map +1 -1
- package/build/services/CommandService.d.ts +6 -6
- package/build/services/CommandService.js.map +1 -1
- package/node_modules/@typescript-eslint/parser/package.json +5 -5
- package/node_modules/@typescript-eslint/scope-manager/package.json +5 -5
- package/node_modules/@typescript-eslint/types/package.json +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/package.json +5 -5
- package/node_modules/@typescript-eslint/visitor-keys/package.json +3 -3
- package/package.json +3 -3
- package/src/__tests__/behavioral/WatchingSkillViews.test.ts +14 -227
- package/src/features/AbstractAction.ts +4 -4
- package/src/features/dependencies/actions/AddAction.ts +1 -1
- package/src/features/deploy/actions/HerokuAction.ts +2 -2
- package/src/features/node/actions/UpdateDependenciesAction.ts +1 -1
- package/src/features/node/actions/UpgradeAction.ts +1 -1
- package/src/features/test/actions/CreateAction.ts +2 -4
- package/src/features/view/actions/WatchAction.ts +25 -89
- package/src/services/CommandService.ts +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [18.1.6](https://github.com/sprucelabsai/spruce-cli-workspace/compare/v18.1.5...v18.1.6) (2022-11-16)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @sprucelabs/spruce-cli
|
|
9
|
+
|
|
6
10
|
## [18.1.5](https://github.com/sprucelabsai/spruce-cli-workspace/compare/v18.1.4...v18.1.5) (2022-11-10)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @sprucelabs/spruce-cli
|
|
@@ -2,16 +2,8 @@ import AbstractSkillTest from '../../tests/AbstractSkillTest';
|
|
|
2
2
|
export default class WatchingSkillViewsTest extends AbstractSkillTest {
|
|
3
3
|
protected static skillCacheKey: string;
|
|
4
4
|
protected static oldBootExecute: any;
|
|
5
|
-
|
|
5
|
+
private static action;
|
|
6
6
|
protected static beforeEach(): Promise<void>;
|
|
7
7
|
protected static hasWatchSkillViewsEvent(): Promise<void>;
|
|
8
8
|
protected static shouldCallBoot(): Promise<void>;
|
|
9
|
-
protected static shouldCallBootAgainOnFileChange(): Promise<void>;
|
|
10
|
-
protected static changesDuringBootOfSkillKillSkill(): Promise<void>;
|
|
11
|
-
protected static holdsOnAction(): Promise<void>;
|
|
12
|
-
protected static canKillAction(): Promise<void>;
|
|
13
|
-
protected static makeSureWatcherIsStartedAndStopped(): Promise<void>;
|
|
14
|
-
protected static killingActionKillsProcess(): Promise<void>;
|
|
15
|
-
private static assertProcessRunning;
|
|
16
|
-
private static emitFileChangeEvent;
|
|
17
9
|
}
|
|
@@ -15,16 +15,13 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
15
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
17
|
var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime/helpers/applyDecoratedDescriptor"));
|
|
18
|
-
var _spruceSkillUtils = require("@sprucelabs/spruce-skill-utils");
|
|
19
18
|
var _testUtils = require("@sprucelabs/test-utils");
|
|
20
|
-
var _psNode = _interopRequireDefault(require("ps-node"));
|
|
21
|
-
var _BootAction = _interopRequireDefault(require("../../features/skill/actions/BootAction"));
|
|
22
19
|
var _CommandService = _interopRequireDefault(require("../../services/CommandService"));
|
|
23
20
|
var _AbstractSkillTest2 = _interopRequireDefault(require("../../tests/AbstractSkillTest"));
|
|
24
|
-
var _dec, _dec2,
|
|
21
|
+
var _dec, _dec2, _class, _class2;
|
|
25
22
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
26
23
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
27
|
-
var WatchingSkillViewsTest = (_dec = (0, _testUtils.test)(), _dec2 = (0, _testUtils.test)(),
|
|
24
|
+
var WatchingSkillViewsTest = (_dec = (0, _testUtils.test)(), _dec2 = (0, _testUtils.test)(), (_class = (_class2 = /*#__PURE__*/function (_AbstractSkillTest) {
|
|
28
25
|
(0, _inherits2["default"])(WatchingSkillViewsTest, _AbstractSkillTest);
|
|
29
26
|
var _super = _createSuper(WatchingSkillViewsTest);
|
|
30
27
|
function WatchingSkillViewsTest() {
|
|
@@ -32,17 +29,17 @@ var WatchingSkillViewsTest = (_dec = (0, _testUtils.test)(), _dec2 = (0, _testUt
|
|
|
32
29
|
return _super.apply(this, arguments);
|
|
33
30
|
}
|
|
34
31
|
(0, _createClass2["default"])(WatchingSkillViewsTest, null, [{
|
|
35
|
-
key: "
|
|
32
|
+
key: "beforeEach",
|
|
36
33
|
value: function () {
|
|
37
|
-
var
|
|
34
|
+
var _beforeEach = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
38
35
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
39
36
|
while (1) {
|
|
40
37
|
switch (_context.prev = _context.next) {
|
|
41
38
|
case 0:
|
|
42
39
|
_context.next = 2;
|
|
43
|
-
return (0, _get2["default"])((0, _getPrototypeOf2["default"])(WatchingSkillViewsTest), "
|
|
40
|
+
return (0, _get2["default"])((0, _getPrototypeOf2["default"])(WatchingSkillViewsTest), "beforeEach", this).call(this);
|
|
44
41
|
case 2:
|
|
45
|
-
this.
|
|
42
|
+
this.action = this.Action('view', 'watch');
|
|
46
43
|
case 3:
|
|
47
44
|
case "end":
|
|
48
45
|
return _context.stop();
|
|
@@ -50,46 +47,6 @@ var WatchingSkillViewsTest = (_dec = (0, _testUtils.test)(), _dec2 = (0, _testUt
|
|
|
50
47
|
}
|
|
51
48
|
}, _callee, this);
|
|
52
49
|
}));
|
|
53
|
-
function beforeAll() {
|
|
54
|
-
return _beforeAll.apply(this, arguments);
|
|
55
|
-
}
|
|
56
|
-
return beforeAll;
|
|
57
|
-
}()
|
|
58
|
-
}, {
|
|
59
|
-
key: "beforeEach",
|
|
60
|
-
value: function () {
|
|
61
|
-
var _beforeEach = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
62
|
-
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
63
|
-
while (1) {
|
|
64
|
-
switch (_context3.prev = _context3.next) {
|
|
65
|
-
case 0:
|
|
66
|
-
_context3.next = 2;
|
|
67
|
-
return (0, _get2["default"])((0, _getPrototypeOf2["default"])(WatchingSkillViewsTest), "beforeEach", this).call(this);
|
|
68
|
-
case 2:
|
|
69
|
-
this.featureInstaller.isInstalled = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
70
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
71
|
-
while (1) {
|
|
72
|
-
switch (_context2.prev = _context2.next) {
|
|
73
|
-
case 0:
|
|
74
|
-
return _context2.abrupt("return", true);
|
|
75
|
-
case 1:
|
|
76
|
-
case "end":
|
|
77
|
-
return _context2.stop();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}, _callee2);
|
|
81
|
-
}));
|
|
82
|
-
_spruceSkillUtils.SettingsService.prototype.isMarkedAsInstalled = function () {
|
|
83
|
-
return true;
|
|
84
|
-
};
|
|
85
|
-
_BootAction["default"].prototype.execute = this.oldBootExecute;
|
|
86
|
-
case 5:
|
|
87
|
-
case "end":
|
|
88
|
-
return _context3.stop();
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}, _callee3, this);
|
|
92
|
-
}));
|
|
93
50
|
function beforeEach() {
|
|
94
51
|
return _beforeEach.apply(this, arguments);
|
|
95
52
|
}
|
|
@@ -98,18 +55,18 @@ var WatchingSkillViewsTest = (_dec = (0, _testUtils.test)(), _dec2 = (0, _testUt
|
|
|
98
55
|
}, {
|
|
99
56
|
key: "hasWatchSkillViewsEvent",
|
|
100
57
|
value: function () {
|
|
101
|
-
var _hasWatchSkillViewsEvent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
102
|
-
return _regenerator["default"].wrap(function
|
|
58
|
+
var _hasWatchSkillViewsEvent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
59
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
103
60
|
while (1) {
|
|
104
|
-
switch (
|
|
61
|
+
switch (_context2.prev = _context2.next) {
|
|
105
62
|
case 0:
|
|
106
|
-
_testUtils.assert.isFunction(this.
|
|
63
|
+
_testUtils.assert.isFunction(this.action.execute);
|
|
107
64
|
case 1:
|
|
108
65
|
case "end":
|
|
109
|
-
return
|
|
66
|
+
return _context2.stop();
|
|
110
67
|
}
|
|
111
68
|
}
|
|
112
|
-
},
|
|
69
|
+
}, _callee2, this);
|
|
113
70
|
}));
|
|
114
71
|
function hasWatchSkillViewsEvent() {
|
|
115
72
|
return _hasWatchSkillViewsEvent.apply(this, arguments);
|
|
@@ -119,433 +76,38 @@ var WatchingSkillViewsTest = (_dec = (0, _testUtils.test)(), _dec2 = (0, _testUt
|
|
|
119
76
|
}, {
|
|
120
77
|
key: "shouldCallBoot",
|
|
121
78
|
value: function () {
|
|
122
|
-
var _shouldCallBoot = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
123
|
-
var wasHit
|
|
124
|
-
return _regenerator["default"].wrap(function
|
|
79
|
+
var _shouldCallBoot = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
80
|
+
var wasHit;
|
|
81
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
125
82
|
while (1) {
|
|
126
|
-
switch (
|
|
83
|
+
switch (_context3.prev = _context3.next) {
|
|
127
84
|
case 0:
|
|
128
85
|
wasHit = false;
|
|
129
|
-
_CommandService["default"].fakeCommand(
|
|
130
|
-
code:
|
|
86
|
+
_CommandService["default"].fakeCommand('ENABLED_SKILL_FEATURES=view,event SHOULD_REGISTER_EVENTS_AND_LISTENERS=false SHOULD_WATCH_VIEWS=true MAXIMUM_LOG_PREFIXES_LENGTH=0 yarn boot', {
|
|
87
|
+
code: 200,
|
|
131
88
|
callback: function callback() {
|
|
132
89
|
wasHit = true;
|
|
133
90
|
}
|
|
134
91
|
});
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
_context5.next = 6;
|
|
92
|
+
void this.action.execute();
|
|
93
|
+
_context3.next = 5;
|
|
138
94
|
return this.wait(10);
|
|
139
|
-
case
|
|
95
|
+
case 5:
|
|
140
96
|
_testUtils.assert.isTrue(wasHit);
|
|
141
|
-
|
|
142
|
-
return watchAction.kill();
|
|
143
|
-
case 9:
|
|
97
|
+
case 6:
|
|
144
98
|
case "end":
|
|
145
|
-
return
|
|
99
|
+
return _context3.stop();
|
|
146
100
|
}
|
|
147
101
|
}
|
|
148
|
-
},
|
|
102
|
+
}, _callee3, this);
|
|
149
103
|
}));
|
|
150
104
|
function shouldCallBoot() {
|
|
151
105
|
return _shouldCallBoot.apply(this, arguments);
|
|
152
106
|
}
|
|
153
107
|
return shouldCallBoot;
|
|
154
108
|
}()
|
|
155
|
-
}, {
|
|
156
|
-
key: "shouldCallBootAgainOnFileChange",
|
|
157
|
-
value: function () {
|
|
158
|
-
var _shouldCallBootAgainOnFileChange = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
159
|
-
var hitCount, watchAction;
|
|
160
|
-
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
161
|
-
while (1) {
|
|
162
|
-
switch (_context6.prev = _context6.next) {
|
|
163
|
-
case 0:
|
|
164
|
-
hitCount = 0;
|
|
165
|
-
_CommandService["default"].fakeCommand(/yarn boot/gi, {
|
|
166
|
-
code: 0,
|
|
167
|
-
callback: function callback() {
|
|
168
|
-
hitCount++;
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
watchAction = this.Action('view', 'watch');
|
|
172
|
-
void watchAction.execute({});
|
|
173
|
-
_context6.next = 6;
|
|
174
|
-
return this.wait(10);
|
|
175
|
-
case 6:
|
|
176
|
-
_testUtils.assert.isEqual(hitCount, 1);
|
|
177
|
-
_context6.next = 9;
|
|
178
|
-
return this.emitFileChangeEvent();
|
|
179
|
-
case 9:
|
|
180
|
-
_testUtils.assert.isEqual(hitCount, 2);
|
|
181
|
-
_context6.next = 12;
|
|
182
|
-
return watchAction.kill();
|
|
183
|
-
case 12:
|
|
184
|
-
case "end":
|
|
185
|
-
return _context6.stop();
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}, _callee6, this);
|
|
189
|
-
}));
|
|
190
|
-
function shouldCallBootAgainOnFileChange() {
|
|
191
|
-
return _shouldCallBootAgainOnFileChange.apply(this, arguments);
|
|
192
|
-
}
|
|
193
|
-
return shouldCallBootAgainOnFileChange;
|
|
194
|
-
}()
|
|
195
|
-
}, {
|
|
196
|
-
key: "changesDuringBootOfSkillKillSkill",
|
|
197
|
-
value: function () {
|
|
198
|
-
var _changesDuringBootOfSkillKillSkill = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
199
|
-
var watchAction, passedOptions;
|
|
200
|
-
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
201
|
-
while (1) {
|
|
202
|
-
switch (_context7.prev = _context7.next) {
|
|
203
|
-
case 0:
|
|
204
|
-
_CommandService["default"].fakeCommand(/yarn boot/gi, {
|
|
205
|
-
code: 0
|
|
206
|
-
});
|
|
207
|
-
watchAction = this.Action('view', 'watch');
|
|
208
|
-
passedOptions = null; //@ts-ignore
|
|
209
|
-
_BootAction["default"].prototype.execute = function (options) {
|
|
210
|
-
passedOptions = options;
|
|
211
|
-
};
|
|
212
|
-
void watchAction.execute();
|
|
213
|
-
_context7.next = 7;
|
|
214
|
-
return this.wait(100);
|
|
215
|
-
case 7:
|
|
216
|
-
_testUtils.assert.isTrue(passedOptions.shouldReturnImmediately);
|
|
217
|
-
_context7.next = 10;
|
|
218
|
-
return watchAction.kill();
|
|
219
|
-
case 10:
|
|
220
|
-
case "end":
|
|
221
|
-
return _context7.stop();
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}, _callee7, this);
|
|
225
|
-
}));
|
|
226
|
-
function changesDuringBootOfSkillKillSkill() {
|
|
227
|
-
return _changesDuringBootOfSkillKillSkill.apply(this, arguments);
|
|
228
|
-
}
|
|
229
|
-
return changesDuringBootOfSkillKillSkill;
|
|
230
|
-
}()
|
|
231
|
-
}, {
|
|
232
|
-
key: "holdsOnAction",
|
|
233
|
-
value: function () {
|
|
234
|
-
var _holdsOnAction = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
|
|
235
|
-
var watchAction, actionPromise, didWait, waitPromise;
|
|
236
|
-
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
237
|
-
while (1) {
|
|
238
|
-
switch (_context9.prev = _context9.next) {
|
|
239
|
-
case 0:
|
|
240
|
-
_CommandService["default"].fakeCommand(/yarn boot/gi, {
|
|
241
|
-
code: 0
|
|
242
|
-
});
|
|
243
|
-
watchAction = this.Action('view', 'watch');
|
|
244
|
-
actionPromise = watchAction.execute();
|
|
245
|
-
didWait = false;
|
|
246
|
-
waitPromise = new Promise(function (resolve) {
|
|
247
|
-
setTimeout( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
248
|
-
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
249
|
-
while (1) {
|
|
250
|
-
switch (_context8.prev = _context8.next) {
|
|
251
|
-
case 0:
|
|
252
|
-
didWait = true;
|
|
253
|
-
_context8.next = 3;
|
|
254
|
-
return watchAction.kill();
|
|
255
|
-
case 3:
|
|
256
|
-
resolve(null);
|
|
257
|
-
case 4:
|
|
258
|
-
case "end":
|
|
259
|
-
return _context8.stop();
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}, _callee8);
|
|
263
|
-
})), 1000);
|
|
264
|
-
});
|
|
265
|
-
_context9.next = 7;
|
|
266
|
-
return actionPromise;
|
|
267
|
-
case 7:
|
|
268
|
-
_context9.next = 9;
|
|
269
|
-
return waitPromise;
|
|
270
|
-
case 9:
|
|
271
|
-
_testUtils.assert.isTrue(didWait);
|
|
272
|
-
_context9.next = 12;
|
|
273
|
-
return watchAction.kill();
|
|
274
|
-
case 12:
|
|
275
|
-
case "end":
|
|
276
|
-
return _context9.stop();
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}, _callee9, this);
|
|
280
|
-
}));
|
|
281
|
-
function holdsOnAction() {
|
|
282
|
-
return _holdsOnAction.apply(this, arguments);
|
|
283
|
-
}
|
|
284
|
-
return holdsOnAction;
|
|
285
|
-
}()
|
|
286
|
-
}, {
|
|
287
|
-
key: "canKillAction",
|
|
288
|
-
value: function () {
|
|
289
|
-
var _canKillAction = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
|
|
290
|
-
var watchAction, actionPromise, didWait, waitPromise;
|
|
291
|
-
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
292
|
-
while (1) {
|
|
293
|
-
switch (_context10.prev = _context10.next) {
|
|
294
|
-
case 0:
|
|
295
|
-
_CommandService["default"].fakeCommand(/yarn boot/gi, {
|
|
296
|
-
code: 0
|
|
297
|
-
});
|
|
298
|
-
watchAction = this.Action('view', 'watch');
|
|
299
|
-
actionPromise = watchAction.execute();
|
|
300
|
-
didWait = false;
|
|
301
|
-
waitPromise = new Promise(function (resolve) {
|
|
302
|
-
setTimeout(function () {
|
|
303
|
-
didWait = true;
|
|
304
|
-
resolve(null);
|
|
305
|
-
}, 1000);
|
|
306
|
-
});
|
|
307
|
-
_context10.next = 7;
|
|
308
|
-
return this.wait(100);
|
|
309
|
-
case 7:
|
|
310
|
-
_context10.next = 9;
|
|
311
|
-
return watchAction.kill();
|
|
312
|
-
case 9:
|
|
313
|
-
_context10.next = 11;
|
|
314
|
-
return actionPromise;
|
|
315
|
-
case 11:
|
|
316
|
-
_testUtils.assert.isFalse(didWait);
|
|
317
|
-
_context10.next = 14;
|
|
318
|
-
return waitPromise;
|
|
319
|
-
case 14:
|
|
320
|
-
_context10.next = 16;
|
|
321
|
-
return watchAction.kill();
|
|
322
|
-
case 16:
|
|
323
|
-
case "end":
|
|
324
|
-
return _context10.stop();
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}, _callee10, this);
|
|
328
|
-
}));
|
|
329
|
-
function canKillAction() {
|
|
330
|
-
return _canKillAction.apply(this, arguments);
|
|
331
|
-
}
|
|
332
|
-
return canKillAction;
|
|
333
|
-
}()
|
|
334
|
-
}, {
|
|
335
|
-
key: "makeSureWatcherIsStartedAndStopped",
|
|
336
|
-
value: function () {
|
|
337
|
-
var _makeSureWatcherIsStartedAndStopped = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13() {
|
|
338
|
-
var watchFeature, wasStarted, wasStopped, watchAction;
|
|
339
|
-
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
|
340
|
-
while (1) {
|
|
341
|
-
switch (_context13.prev = _context13.next) {
|
|
342
|
-
case 0:
|
|
343
|
-
_CommandService["default"].fakeCommand(/yarn boot/gi, {
|
|
344
|
-
code: 0
|
|
345
|
-
});
|
|
346
|
-
watchFeature = this.featureInstaller.getFeature('watch');
|
|
347
|
-
wasStarted = false;
|
|
348
|
-
wasStopped = false;
|
|
349
|
-
watchFeature.startWatching = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
|
|
350
|
-
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
351
|
-
while (1) {
|
|
352
|
-
switch (_context11.prev = _context11.next) {
|
|
353
|
-
case 0:
|
|
354
|
-
wasStarted = true;
|
|
355
|
-
case 1:
|
|
356
|
-
case "end":
|
|
357
|
-
return _context11.stop();
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}, _callee11);
|
|
361
|
-
}));
|
|
362
|
-
watchFeature.stopWatching = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
|
|
363
|
-
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
364
|
-
while (1) {
|
|
365
|
-
switch (_context12.prev = _context12.next) {
|
|
366
|
-
case 0:
|
|
367
|
-
wasStopped = true;
|
|
368
|
-
case 1:
|
|
369
|
-
case "end":
|
|
370
|
-
return _context12.stop();
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}, _callee12);
|
|
374
|
-
}));
|
|
375
|
-
watchAction = this.Action('view', 'watch');
|
|
376
|
-
void watchAction.execute();
|
|
377
|
-
_context13.next = 10;
|
|
378
|
-
return this.wait(100);
|
|
379
|
-
case 10:
|
|
380
|
-
_testUtils.assert.isTrue(wasStarted);
|
|
381
|
-
_testUtils.assert.isFalse(wasStopped);
|
|
382
|
-
_context13.next = 14;
|
|
383
|
-
return watchAction.kill();
|
|
384
|
-
case 14:
|
|
385
|
-
_context13.next = 16;
|
|
386
|
-
return this.wait(100);
|
|
387
|
-
case 16:
|
|
388
|
-
_testUtils.assert.isTrue(wasStarted);
|
|
389
|
-
_testUtils.assert.isTrue(wasStopped);
|
|
390
|
-
case 18:
|
|
391
|
-
case "end":
|
|
392
|
-
return _context13.stop();
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
}, _callee13, this);
|
|
396
|
-
}));
|
|
397
|
-
function makeSureWatcherIsStartedAndStopped() {
|
|
398
|
-
return _makeSureWatcherIsStartedAndStopped.apply(this, arguments);
|
|
399
|
-
}
|
|
400
|
-
return makeSureWatcherIsStartedAndStopped;
|
|
401
|
-
}()
|
|
402
|
-
}, {
|
|
403
|
-
key: "killingActionKillsProcess",
|
|
404
|
-
value: function () {
|
|
405
|
-
var _killingActionKillsProcess = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14() {
|
|
406
|
-
var _results$meta,
|
|
407
|
-
_this = this;
|
|
408
|
-
var watchAction, results, pid;
|
|
409
|
-
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
|
410
|
-
while (1) {
|
|
411
|
-
switch (_context14.prev = _context14.next) {
|
|
412
|
-
case 0:
|
|
413
|
-
_context14.next = 2;
|
|
414
|
-
return this.FeatureFixture().installCachedFeatures('events');
|
|
415
|
-
case 2:
|
|
416
|
-
_context14.next = 4;
|
|
417
|
-
return this.getSkillFixture().registerCurrentSkill({
|
|
418
|
-
name: "Watching skill views"
|
|
419
|
-
});
|
|
420
|
-
case 4:
|
|
421
|
-
_context14.next = 6;
|
|
422
|
-
return this.getViewFixture().createViewController({
|
|
423
|
-
nameKebab: 'root',
|
|
424
|
-
namePascal: 'Root'
|
|
425
|
-
});
|
|
426
|
-
case 6:
|
|
427
|
-
_context14.next = 8;
|
|
428
|
-
return this.Action('view', 'sync').execute({});
|
|
429
|
-
case 8:
|
|
430
|
-
_context14.next = 10;
|
|
431
|
-
return this.Service('build').build();
|
|
432
|
-
case 10:
|
|
433
|
-
watchAction = this.Action('view', 'watch');
|
|
434
|
-
_context14.next = 13;
|
|
435
|
-
return watchAction.execute({
|
|
436
|
-
shouldReturnImmediately: true
|
|
437
|
-
});
|
|
438
|
-
case 13:
|
|
439
|
-
results = _context14.sent;
|
|
440
|
-
_testUtils.assert.isFalsy(results.errors);
|
|
441
|
-
pid = watchAction.getPid();
|
|
442
|
-
case 16:
|
|
443
|
-
if (pid) {
|
|
444
|
-
_context14.next = 22;
|
|
445
|
-
break;
|
|
446
|
-
}
|
|
447
|
-
_context14.next = 19;
|
|
448
|
-
return this.wait(100);
|
|
449
|
-
case 19:
|
|
450
|
-
pid = watchAction.getPid();
|
|
451
|
-
_context14.next = 16;
|
|
452
|
-
break;
|
|
453
|
-
case 22:
|
|
454
|
-
_context14.next = 24;
|
|
455
|
-
return (_results$meta = results.meta) === null || _results$meta === void 0 ? void 0 : _results$meta.bootPromise;
|
|
456
|
-
case 24:
|
|
457
|
-
_context14.next = 26;
|
|
458
|
-
return this.assertProcessRunning(pid);
|
|
459
|
-
case 26:
|
|
460
|
-
_context14.next = 28;
|
|
461
|
-
return watchAction.kill();
|
|
462
|
-
case 28:
|
|
463
|
-
_context14.next = 30;
|
|
464
|
-
return this.wait(500);
|
|
465
|
-
case 30:
|
|
466
|
-
_context14.next = 32;
|
|
467
|
-
return _testUtils.assert.doesThrowAsync(function () {
|
|
468
|
-
return _this.assertProcessRunning(pid);
|
|
469
|
-
});
|
|
470
|
-
case 32:
|
|
471
|
-
case "end":
|
|
472
|
-
return _context14.stop();
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
}, _callee14, this);
|
|
476
|
-
}));
|
|
477
|
-
function killingActionKillsProcess() {
|
|
478
|
-
return _killingActionKillsProcess.apply(this, arguments);
|
|
479
|
-
}
|
|
480
|
-
return killingActionKillsProcess;
|
|
481
|
-
}()
|
|
482
|
-
}, {
|
|
483
|
-
key: "assertProcessRunning",
|
|
484
|
-
value: function () {
|
|
485
|
-
var _assertProcessRunning = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(pid) {
|
|
486
|
-
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
|
487
|
-
while (1) {
|
|
488
|
-
switch (_context15.prev = _context15.next) {
|
|
489
|
-
case 0:
|
|
490
|
-
_context15.next = 2;
|
|
491
|
-
return new Promise(function (resolve, reject) {
|
|
492
|
-
_psNode["default"].lookup({
|
|
493
|
-
pid: pid
|
|
494
|
-
}, function (err, results) {
|
|
495
|
-
if (err || results.length !== 1) {
|
|
496
|
-
reject('boot process not running');
|
|
497
|
-
}
|
|
498
|
-
resolve(results);
|
|
499
|
-
});
|
|
500
|
-
});
|
|
501
|
-
case 2:
|
|
502
|
-
case "end":
|
|
503
|
-
return _context15.stop();
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
}, _callee15);
|
|
507
|
-
}));
|
|
508
|
-
function assertProcessRunning(_x) {
|
|
509
|
-
return _assertProcessRunning.apply(this, arguments);
|
|
510
|
-
}
|
|
511
|
-
return assertProcessRunning;
|
|
512
|
-
}()
|
|
513
|
-
}, {
|
|
514
|
-
key: "emitFileChangeEvent",
|
|
515
|
-
value: function () {
|
|
516
|
-
var _emitFileChangeEvent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16() {
|
|
517
|
-
var emitter;
|
|
518
|
-
return _regenerator["default"].wrap(function _callee16$(_context16) {
|
|
519
|
-
while (1) {
|
|
520
|
-
switch (_context16.prev = _context16.next) {
|
|
521
|
-
case 0:
|
|
522
|
-
emitter = this.emitter;
|
|
523
|
-
_context16.next = 3;
|
|
524
|
-
return emitter.emit('watcher.did-detect-change', {
|
|
525
|
-
changes: [{
|
|
526
|
-
schemaId: 'generatedFile',
|
|
527
|
-
version: 'v2020_07_22',
|
|
528
|
-
values: {
|
|
529
|
-
action: 'updated',
|
|
530
|
-
name: 'Cool name!',
|
|
531
|
-
path: '/'
|
|
532
|
-
}
|
|
533
|
-
}]
|
|
534
|
-
});
|
|
535
|
-
case 3:
|
|
536
|
-
case "end":
|
|
537
|
-
return _context16.stop();
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
}, _callee16, this);
|
|
541
|
-
}));
|
|
542
|
-
function emitFileChangeEvent() {
|
|
543
|
-
return _emitFileChangeEvent.apply(this, arguments);
|
|
544
|
-
}
|
|
545
|
-
return emitFileChangeEvent;
|
|
546
|
-
}()
|
|
547
109
|
}]);
|
|
548
110
|
return WatchingSkillViewsTest;
|
|
549
|
-
}(_AbstractSkillTest2["default"]), (0, _defineProperty2["default"])(_class2, "skillCacheKey", 'views'), (0, _defineProperty2["default"])(_class2, "oldBootExecute", void 0),
|
|
111
|
+
}(_AbstractSkillTest2["default"]), (0, _defineProperty2["default"])(_class2, "skillCacheKey", 'views'), (0, _defineProperty2["default"])(_class2, "oldBootExecute", void 0), (0, _defineProperty2["default"])(_class2, "action", void 0), _class2), ((0, _applyDecoratedDescriptor2["default"])(_class, "hasWatchSkillViewsEvent", [_dec], Object.getOwnPropertyDescriptor(_class, "hasWatchSkillViewsEvent"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "shouldCallBoot", [_dec2], Object.getOwnPropertyDescriptor(_class, "shouldCallBoot"), _class)), _class));
|
|
550
112
|
exports["default"] = WatchingSkillViewsTest;
|
|
551
113
|
//# sourceMappingURL=WatchingSkillViews.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WatchingSkillViews.test.js","names":["WatchingSkillViewsTest","test","oldBootExecute","BootAction","prototype","execute","featureInstaller","isInstalled","SettingsService","isMarkedAsInstalled","assert","isFunction","Action","wasHit","CommandService","fakeCommand","code","callback","watchAction","wait","isTrue","kill","hitCount","isEqual","emitFileChangeEvent","passedOptions","options","shouldReturnImmediately","actionPromise","didWait","waitPromise","Promise","resolve","setTimeout","isFalse","watchFeature","getFeature","wasStarted","wasStopped","startWatching","stopWatching","FeatureFixture","installCachedFeatures","getSkillFixture","registerCurrentSkill","name","getViewFixture","createViewController","nameKebab","namePascal","Service","build","results","isFalsy","errors","pid","getPid","meta","bootPromise","assertProcessRunning","doesThrowAsync","reject","ps","lookup","err","length","emitter","emit","changes","schemaId","version","values","action","path","AbstractSkillTest"],"sources":["../../../src/__tests__/behavioral/WatchingSkillViews.test.ts"],"sourcesContent":["import { SettingsService } from '@sprucelabs/spruce-skill-utils'\nimport { test, assert } from '@sprucelabs/test-utils'\nimport ps from 'ps-node'\nimport BootAction from '../../features/skill/actions/BootAction'\nimport WatchAction from '../../features/view/actions/WatchAction'\nimport CommandService from '../../services/CommandService'\nimport AbstractSkillTest from '../../tests/AbstractSkillTest'\n\nexport default class WatchingSkillViewsTest extends AbstractSkillTest {\n\tprotected static skillCacheKey = 'views'\n\tprotected static oldBootExecute: any\n\n\tprotected static async beforeAll() {\n\t\tawait super.beforeAll()\n\t\tthis.oldBootExecute = BootAction.prototype.execute\n\t}\n\n\tprotected static async beforeEach() {\n\t\tawait super.beforeEach()\n\t\tthis.featureInstaller.isInstalled = async () => true\n\t\tSettingsService.prototype.isMarkedAsInstalled = () => true\n\t\tBootAction.prototype.execute = this.oldBootExecute\n\t}\n\n\t@test()\n\tprotected static async hasWatchSkillViewsEvent() {\n\t\tassert.isFunction(this.Action('view', 'watch').execute)\n\t}\n\n\t@test()\n\tprotected static async shouldCallBoot() {\n\t\tlet wasHit = false\n\n\t\tCommandService.fakeCommand(/yarn boot/gis, {\n\t\t\tcode: 0,\n\t\t\tcallback: () => {\n\t\t\t\twasHit = true\n\t\t\t},\n\t\t})\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\t\tvoid watchAction.execute({})\n\t\tawait this.wait(10)\n\t\tassert.isTrue(wasHit)\n\n\t\tawait watchAction.kill()\n\t}\n\n\t@test()\n\tprotected static async shouldCallBootAgainOnFileChange() {\n\t\tlet hitCount = 0\n\t\tCommandService.fakeCommand(/yarn boot/gis, {\n\t\t\tcode: 0,\n\t\t\tcallback: () => {\n\t\t\t\thitCount++\n\t\t\t},\n\t\t})\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\n\t\tvoid watchAction.execute({})\n\n\t\tawait this.wait(10)\n\n\t\tassert.isEqual(hitCount, 1)\n\n\t\tawait this.emitFileChangeEvent()\n\n\t\tassert.isEqual(hitCount, 2)\n\t\tawait watchAction.kill()\n\t}\n\n\t@test()\n\tprotected static async changesDuringBootOfSkillKillSkill() {\n\t\tCommandService.fakeCommand(/yarn boot/gis, {\n\t\t\tcode: 0,\n\t\t})\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\n\t\tlet passedOptions: any = null\n\n\t\t//@ts-ignore\n\t\tBootAction.prototype.execute = (options: any) => {\n\t\t\tpassedOptions = options\n\t\t}\n\n\t\tvoid watchAction.execute()\n\n\t\tawait this.wait(100)\n\n\t\tassert.isTrue(passedOptions.shouldReturnImmediately)\n\n\t\tawait watchAction.kill()\n\t}\n\n\t@test()\n\tprotected static async holdsOnAction() {\n\t\tCommandService.fakeCommand(/yarn boot/gis, {\n\t\t\tcode: 0,\n\t\t})\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\t\tconst actionPromise = watchAction.execute()\n\t\tlet didWait = false\n\t\tconst waitPromise = new Promise((resolve) => {\n\t\t\tsetTimeout(async () => {\n\t\t\t\tdidWait = true\n\t\t\t\tawait watchAction.kill()\n\t\t\t\tresolve(null)\n\t\t\t}, 1000)\n\t\t})\n\n\t\tawait actionPromise\n\t\tawait waitPromise\n\n\t\tassert.isTrue(didWait)\n\n\t\tawait watchAction.kill()\n\t}\n\n\t@test()\n\tprotected static async canKillAction() {\n\t\tCommandService.fakeCommand(/yarn boot/gis, {\n\t\t\tcode: 0,\n\t\t})\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\t\tconst actionPromise = watchAction.execute()\n\n\t\tlet didWait = false\n\t\tconst waitPromise = new Promise((resolve) => {\n\t\t\tsetTimeout(() => {\n\t\t\t\tdidWait = true\n\t\t\t\tresolve(null)\n\t\t\t}, 1000)\n\t\t})\n\n\t\tawait this.wait(100)\n\n\t\tawait watchAction.kill()\n\n\t\tawait actionPromise\n\n\t\tassert.isFalse(didWait)\n\n\t\tawait waitPromise\n\n\t\tawait watchAction.kill()\n\t}\n\n\t@test()\n\tprotected static async makeSureWatcherIsStartedAndStopped() {\n\t\tCommandService.fakeCommand(/yarn boot/gis, {\n\t\t\tcode: 0,\n\t\t})\n\n\t\tconst watchFeature = this.featureInstaller.getFeature('watch')\n\t\tlet wasStarted = false\n\t\tlet wasStopped = false\n\n\t\twatchFeature.startWatching = async () => {\n\t\t\twasStarted = true\n\t\t}\n\n\t\twatchFeature.stopWatching = async () => {\n\t\t\twasStopped = true\n\t\t}\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\t\tvoid watchAction.execute()\n\n\t\tawait this.wait(100)\n\n\t\tassert.isTrue(wasStarted)\n\t\tassert.isFalse(wasStopped)\n\n\t\tawait watchAction.kill()\n\t\tawait this.wait(100)\n\n\t\tassert.isTrue(wasStarted)\n\t\tassert.isTrue(wasStopped)\n\t}\n\n\t@test()\n\tprotected static async killingActionKillsProcess() {\n\t\tawait this.FeatureFixture().installCachedFeatures('events')\n\t\tawait this.getSkillFixture().registerCurrentSkill({\n\t\t\tname: `Watching skill views`,\n\t\t})\n\n\t\tawait this.getViewFixture().createViewController({\n\t\t\tnameKebab: 'root',\n\t\t\tnamePascal: 'Root',\n\t\t})\n\n\t\tawait this.Action('view', 'sync').execute({})\n\n\t\tawait this.Service('build').build()\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\t\tconst results = await watchAction.execute({ shouldReturnImmediately: true })\n\n\t\tassert.isFalsy(results.errors)\n\n\t\tlet pid = watchAction.getPid()\n\n\t\twhile (!pid) {\n\t\t\tawait this.wait(100)\n\t\t\tpid = watchAction.getPid()\n\t\t}\n\n\t\tawait results.meta?.bootPromise\n\n\t\tawait this.assertProcessRunning(pid)\n\n\t\tawait watchAction.kill()\n\n\t\tawait this.wait(500)\n\n\t\tawait assert.doesThrowAsync(() => this.assertProcessRunning(pid as number))\n\t}\n\n\tprivate static async assertProcessRunning(pid: number) {\n\t\tawait new Promise((resolve, reject) => {\n\t\t\tps.lookup({ pid }, (err: any, results: any) => {\n\t\t\t\tif (err || results.length !== 1) {\n\t\t\t\t\treject('boot process not running')\n\t\t\t\t}\n\n\t\t\t\tresolve(results)\n\t\t\t})\n\t\t})\n\t}\n\n\tprivate static async emitFileChangeEvent() {\n\t\tconst emitter = this.emitter\n\n\t\tawait emitter.emit('watcher.did-detect-change', {\n\t\t\tchanges: [\n\t\t\t\t{\n\t\t\t\t\tschemaId: 'generatedFile',\n\t\t\t\t\tversion: 'v2020_07_22',\n\t\t\t\t\tvalues: {\n\t\t\t\t\t\taction: 'updated',\n\t\t\t\t\t\tname: 'Cool name!',\n\t\t\t\t\t\tpath: '/',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t})\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AAEA;AACA;AAA6D;AAAA;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;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,CAC3E;MAAA;QAAA;MAAA;MAAA;IAAA;EAAA;IAAA;IAAA;MAAA,0GAED,mBAA0CA,GAAW;QAAA;UAAA;YAAA;cAAA;gBAAA;gBAAA,OAC9C,IAAIxB,OAAO,CAAC,UAACC,OAAO,EAAE6B,MAAM,EAAK;kBACtCC,kBAAE,CAACC,MAAM,CAAC;oBAAER,GAAG,EAAHA;kBAAI,CAAC,EAAE,UAACS,GAAQ,EAAEZ,OAAY,EAAK;oBAC9C,IAAIY,GAAG,IAAIZ,OAAO,CAACa,MAAM,KAAK,CAAC,EAAE;sBAChCJ,MAAM,CAAC,0BAA0B,CAAC;oBACnC;oBAEA7B,OAAO,CAACoB,OAAO,CAAC;kBACjB,CAAC,CAAC;gBACH,CAAC,CAAC;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,CACF;MAAA;QAAA;MAAA;MAAA;IAAA;EAAA;IAAA;IAAA;MAAA,yGAED;QAAA;QAAA;UAAA;YAAA;cAAA;gBACOc,OAAO,GAAG,IAAI,CAACA,OAAO;gBAAA;gBAAA,OAEtBA,OAAO,CAACC,IAAI,CAAC,2BAA2B,EAAE;kBAC/CC,OAAO,EAAE,CACR;oBACCC,QAAQ,EAAE,eAAe;oBACzBC,OAAO,EAAE,aAAa;oBACtBC,MAAM,EAAE;sBACPC,MAAM,EAAE,SAAS;sBACjB3B,IAAI,EAAE,YAAY;sBAClB4B,IAAI,EAAE;oBACP;kBACD,CAAC;gBAEH,CAAC,CAAC;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,CACF;MAAA;QAAA;MAAA;MAAA;IAAA;EAAA;EAAA;AAAA,EAnPkDC,8BAAiB,8DACnC,OAAO;AAAA"}
|
|
1
|
+
{"version":3,"file":"WatchingSkillViews.test.js","names":["WatchingSkillViewsTest","test","action","Action","assert","isFunction","execute","wasHit","CommandService","fakeCommand","code","callback","wait","isTrue","AbstractSkillTest"],"sources":["../../../src/__tests__/behavioral/WatchingSkillViews.test.ts"],"sourcesContent":["import { test, assert } from '@sprucelabs/test-utils'\nimport WatchAction from '../../features/view/actions/WatchAction'\nimport CommandService from '../../services/CommandService'\nimport AbstractSkillTest from '../../tests/AbstractSkillTest'\n\nexport default class WatchingSkillViewsTest extends AbstractSkillTest {\n\tprotected static skillCacheKey = 'views'\n\tprotected static oldBootExecute: any\n\tprivate static action: WatchAction\n\n\tprotected static async beforeEach() {\n\t\tawait super.beforeEach()\n\t\tthis.action = this.Action('view', 'watch')\n\t}\n\n\t@test()\n\tprotected static async hasWatchSkillViewsEvent() {\n\t\tassert.isFunction(this.action.execute)\n\t}\n\n\t@test()\n\tprotected static async shouldCallBoot() {\n\t\tlet wasHit = false\n\t\tCommandService.fakeCommand(\n\t\t\t'ENABLED_SKILL_FEATURES=view,event SHOULD_REGISTER_EVENTS_AND_LISTENERS=false SHOULD_WATCH_VIEWS=true MAXIMUM_LOG_PREFIXES_LENGTH=0 yarn boot',\n\t\t\t{\n\t\t\t\tcode: 200,\n\t\t\t\tcallback: () => {\n\t\t\t\t\twasHit = true\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\n\t\tvoid this.action.execute()\n\n\t\tawait this.wait(10)\n\n\t\tassert.isTrue(wasHit)\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAEA;AACA;AAA6D;AAAA;AAAA;AAAA,IAExCA,sBAAsB,WAUzC,IAAAC,eAAI,GAAE,UAKN,IAAAA,eAAI,GAAE;EAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;MAAA,gGAVP;QAAA;UAAA;YAAA;cAAA;gBAAA;gBAAA;cAAA;gBAEC,IAAI,CAACC,MAAM,GAAG,IAAI,CAACC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,CAC1C;MAAA;QAAA;MAAA;MAAA;IAAA;EAAA;IAAA;IAAA;MAAA,6GAED;QAAA;UAAA;YAAA;cAAA;gBAECC,iBAAM,CAACC,UAAU,CAAC,IAAI,CAACH,MAAM,CAACI,OAAO,CAAC;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,CACtC;MAAA;QAAA;MAAA;MAAA;IAAA;EAAA;IAAA;IAAA;MAAA,oGAED;QAAA;QAAA;UAAA;YAAA;cAAA;gBAEKC,MAAM,GAAG,KAAK;gBAClBC,0BAAc,CAACC,WAAW,CACzB,8IAA8I,EAC9I;kBACCC,IAAI,EAAE,GAAG;kBACTC,QAAQ,EAAE,oBAAM;oBACfJ,MAAM,GAAG,IAAI;kBACd;gBACD,CAAC,CACD;gBAED,KAAK,IAAI,CAACL,MAAM,CAACI,OAAO,EAAE;gBAAA;gBAAA,OAEpB,IAAI,CAACM,IAAI,CAAC,EAAE,CAAC;cAAA;gBAEnBR,iBAAM,CAACS,MAAM,CAACN,MAAM,CAAC;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,CACrB;MAAA;QAAA;MAAA;MAAA;IAAA;EAAA;EAAA;AAAA,EAjCkDO,8BAAiB,8DACnC,OAAO;AAAA"}
|
|
@@ -15,7 +15,7 @@ export default abstract class AbstractAction<S extends Schema = Schema> implemen
|
|
|
15
15
|
readonly commandAliases: string[];
|
|
16
16
|
abstract invocationMessage: string;
|
|
17
17
|
protected parent: AbstractFeature;
|
|
18
|
-
protected
|
|
18
|
+
protected features: FeatureInstaller;
|
|
19
19
|
protected cwd: string;
|
|
20
20
|
protected templates: Templates;
|
|
21
21
|
protected ui: GraphicsInterface;
|