@jupyterlab/testutils 4.0.0-alpha.9 → 4.0.0-beta.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/lib/babel.config.d.ts +1 -0
- package/lib/babel.config.js +30 -11
- package/lib/babel.config.js.map +1 -1
- package/lib/index.d.ts +7 -7
- package/lib/index.js +29 -28
- package/lib/index.js.map +1 -1
- package/lib/jest-config.js +6 -38
- package/lib/jest-config.js.map +1 -1
- package/lib/mock.d.ts +2 -100
- package/lib/mock.js +16 -608
- package/lib/mock.js.map +1 -1
- package/package.json +10 -40
- package/src/babel.config.ts +8 -0
- package/src/index.ts +31 -0
- package/src/jest-config.ts +8 -0
- package/src/mock.ts +20 -0
- package/default-45.json +0 -168
- package/default.json +0 -160
- package/lib/common.d.ts +0 -118
- package/lib/common.js +0 -330
- package/lib/common.js.map +0 -1
- package/lib/compare-lighthouse.d.ts +0 -1
- package/lib/compare-lighthouse.js +0 -29
- package/lib/compare-lighthouse.js.map +0 -1
- package/lib/flakyIt.d.ts +0 -15
- package/lib/flakyIt.js +0 -57
- package/lib/flakyIt.js.map +0 -1
- package/lib/jest-file-mock.d.ts +0 -0
- package/lib/jest-file-mock.js +0 -2
- package/lib/jest-file-mock.js.map +0 -1
- package/lib/jest-shim.d.ts +0 -3
- package/lib/jest-shim.js +0 -90
- package/lib/jest-shim.js.map +0 -1
- package/lib/notebook-utils.d.ts +0 -66
- package/lib/notebook-utils.js +0 -197
- package/lib/notebook-utils.js.map +0 -1
- package/lib/rendermime.d.ts +0 -5
- package/lib/rendermime.js +0 -46
- package/lib/rendermime.js.map +0 -1
- package/lib/start_jupyter_server.d.ts +0 -62
- package/lib/start_jupyter_server.js +0 -320
- package/lib/start_jupyter_server.js.map +0 -1
package/lib/common.js
DELETED
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dismissDialog = exports.dangerDialog = exports.acceptDialog = exports.waitForDialog = exports.initNotebookContext = exports.createFileContextWithKernel = exports.createFileContext = exports.createSession = exports.createSessionContext = exports.sleep = exports.framePromise = exports.isFulfilled = exports.signalToPromise = exports.signalToPromises = exports.doLater = exports.expectFailure = exports.testEmission = void 0;
|
|
4
|
-
const simulate_event_1 = require("simulate-event");
|
|
5
|
-
const services_1 = require("@jupyterlab/services");
|
|
6
|
-
const apputils_1 = require("@jupyterlab/apputils");
|
|
7
|
-
const coreutils_1 = require("@lumino/coreutils");
|
|
8
|
-
const signaling_1 = require("@lumino/signaling");
|
|
9
|
-
const docregistry_1 = require("@jupyterlab/docregistry");
|
|
10
|
-
const notebook_1 = require("@jupyterlab/notebook");
|
|
11
|
-
/**
|
|
12
|
-
* Test a single emission from a signal.
|
|
13
|
-
*
|
|
14
|
-
* @param signal - The signal we are listening to.
|
|
15
|
-
* @param find - An optional function to determine which emission to test,
|
|
16
|
-
* defaulting to the first emission.
|
|
17
|
-
* @param test - An optional function which contains the tests for the emission, and should throw an error if the tests fail.
|
|
18
|
-
* @param value - An optional value that the promise resolves to if the test is
|
|
19
|
-
* successful.
|
|
20
|
-
*
|
|
21
|
-
* @returns a promise that rejects if the function throws an error (e.g., if an
|
|
22
|
-
* expect test doesn't pass), and resolves otherwise.
|
|
23
|
-
*
|
|
24
|
-
* #### Notes
|
|
25
|
-
* The first emission for which the find function returns true will be tested in
|
|
26
|
-
* the test function. If the find function is not given, the first signal
|
|
27
|
-
* emission will be tested.
|
|
28
|
-
*
|
|
29
|
-
* You can test to see if any signal comes which matches a criteria by just
|
|
30
|
-
* giving a find function. You can test the very first signal by just giving a
|
|
31
|
-
* test function. And you can test the first signal matching the find criteria
|
|
32
|
-
* by giving both.
|
|
33
|
-
*
|
|
34
|
-
* The reason this function is asynchronous is so that the thing causing the
|
|
35
|
-
* signal emission (such as a websocket message) can be asynchronous.
|
|
36
|
-
*/
|
|
37
|
-
async function testEmission(signal, options = {}) {
|
|
38
|
-
const done = new coreutils_1.PromiseDelegate();
|
|
39
|
-
const object = {};
|
|
40
|
-
signal.connect((sender, args) => {
|
|
41
|
-
var _a, _b, _c;
|
|
42
|
-
if ((_b = (_a = options.find) === null || _a === void 0 ? void 0 : _a.call(options, sender, args)) !== null && _b !== void 0 ? _b : true) {
|
|
43
|
-
try {
|
|
44
|
-
signaling_1.Signal.disconnectReceiver(object);
|
|
45
|
-
if (options.test) {
|
|
46
|
-
options.test(sender, args);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
catch (e) {
|
|
50
|
-
done.reject(e);
|
|
51
|
-
}
|
|
52
|
-
done.resolve((_c = options.value) !== null && _c !== void 0 ? _c : undefined);
|
|
53
|
-
}
|
|
54
|
-
}, object);
|
|
55
|
-
return done.promise;
|
|
56
|
-
}
|
|
57
|
-
exports.testEmission = testEmission;
|
|
58
|
-
/**
|
|
59
|
-
* Expect a failure on a promise with the given message.
|
|
60
|
-
*/
|
|
61
|
-
async function expectFailure(promise, message) {
|
|
62
|
-
let called = false;
|
|
63
|
-
try {
|
|
64
|
-
await promise;
|
|
65
|
-
called = true;
|
|
66
|
-
}
|
|
67
|
-
catch (err) {
|
|
68
|
-
if (message && err.message.indexOf(message) === -1) {
|
|
69
|
-
throw Error(`Error "${message}" not in: "${err.message}"`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (called) {
|
|
73
|
-
throw Error(`Failure was not triggered, message was: ${message}`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.expectFailure = expectFailure;
|
|
77
|
-
/**
|
|
78
|
-
* Do something in the future ensuring total ordering with respect to promises.
|
|
79
|
-
*/
|
|
80
|
-
async function doLater(cb) {
|
|
81
|
-
await Promise.resolve(void 0);
|
|
82
|
-
cb();
|
|
83
|
-
}
|
|
84
|
-
exports.doLater = doLater;
|
|
85
|
-
/**
|
|
86
|
-
* Convert a signal into an array of promises.
|
|
87
|
-
*
|
|
88
|
-
* @param signal - The signal we are listening to.
|
|
89
|
-
* @param numberValues - The number of values to store.
|
|
90
|
-
*
|
|
91
|
-
* @returns a Promise that resolves with an array of `(sender, args)` pairs.
|
|
92
|
-
*/
|
|
93
|
-
function signalToPromises(signal, numberValues) {
|
|
94
|
-
const values = new Array(numberValues);
|
|
95
|
-
const resolvers = new Array(numberValues);
|
|
96
|
-
for (let i = 0; i < numberValues; i++) {
|
|
97
|
-
values[i] = new Promise(resolve => {
|
|
98
|
-
resolvers[i] = resolve;
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
let current = 0;
|
|
102
|
-
function slot(sender, args) {
|
|
103
|
-
resolvers[current++]([sender, args]);
|
|
104
|
-
if (current === numberValues) {
|
|
105
|
-
cleanup();
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
signal.connect(slot);
|
|
109
|
-
function cleanup() {
|
|
110
|
-
signal.disconnect(slot);
|
|
111
|
-
}
|
|
112
|
-
return values;
|
|
113
|
-
}
|
|
114
|
-
exports.signalToPromises = signalToPromises;
|
|
115
|
-
/**
|
|
116
|
-
* Convert a signal into a promise for the first emitted value.
|
|
117
|
-
*
|
|
118
|
-
* @param signal - The signal we are listening to.
|
|
119
|
-
*
|
|
120
|
-
* @returns a Promise that resolves with a `(sender, args)` pair.
|
|
121
|
-
*/
|
|
122
|
-
function signalToPromise(signal) {
|
|
123
|
-
return signalToPromises(signal, 1)[0];
|
|
124
|
-
}
|
|
125
|
-
exports.signalToPromise = signalToPromise;
|
|
126
|
-
/**
|
|
127
|
-
* Test to see if a promise is fulfilled.
|
|
128
|
-
*
|
|
129
|
-
* @param delay - optional delay in milliseconds before checking
|
|
130
|
-
* @returns true if the promise is fulfilled (either resolved or rejected), and
|
|
131
|
-
* false if the promise is still pending.
|
|
132
|
-
*/
|
|
133
|
-
async function isFulfilled(p, delay = 0) {
|
|
134
|
-
const x = Object.create(null);
|
|
135
|
-
let race;
|
|
136
|
-
if (delay > 0) {
|
|
137
|
-
race = sleep(delay, x);
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
race = x;
|
|
141
|
-
}
|
|
142
|
-
const result = await Promise.race([p, race]).catch(() => false);
|
|
143
|
-
return result !== x;
|
|
144
|
-
}
|
|
145
|
-
exports.isFulfilled = isFulfilled;
|
|
146
|
-
/**
|
|
147
|
-
* Convert a requestAnimationFrame into a Promise.
|
|
148
|
-
*/
|
|
149
|
-
function framePromise() {
|
|
150
|
-
const done = new coreutils_1.PromiseDelegate();
|
|
151
|
-
requestAnimationFrame(() => {
|
|
152
|
-
done.resolve(void 0);
|
|
153
|
-
});
|
|
154
|
-
return done.promise;
|
|
155
|
-
}
|
|
156
|
-
exports.framePromise = framePromise;
|
|
157
|
-
function sleep(milliseconds = 0,
|
|
158
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
159
|
-
value) {
|
|
160
|
-
return new Promise((resolve, reject) => {
|
|
161
|
-
setTimeout(() => {
|
|
162
|
-
resolve(value);
|
|
163
|
-
}, milliseconds);
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
exports.sleep = sleep;
|
|
167
|
-
/**
|
|
168
|
-
* Create a client session object.
|
|
169
|
-
*/
|
|
170
|
-
async function createSessionContext(options = {}) {
|
|
171
|
-
var _a, _b, _c, _d, _e;
|
|
172
|
-
const manager = (_a = options.sessionManager) !== null && _a !== void 0 ? _a : Private.getManager().sessions;
|
|
173
|
-
const specsManager = (_b = options.specsManager) !== null && _b !== void 0 ? _b : Private.getManager().kernelspecs;
|
|
174
|
-
await Promise.all([manager.ready, specsManager.ready]);
|
|
175
|
-
return new apputils_1.SessionContext({
|
|
176
|
-
sessionManager: manager,
|
|
177
|
-
specsManager,
|
|
178
|
-
path: (_c = options.path) !== null && _c !== void 0 ? _c : coreutils_1.UUID.uuid4(),
|
|
179
|
-
name: options.name,
|
|
180
|
-
type: options.type,
|
|
181
|
-
kernelPreference: (_d = options.kernelPreference) !== null && _d !== void 0 ? _d : {
|
|
182
|
-
shouldStart: true,
|
|
183
|
-
canStart: true,
|
|
184
|
-
name: (_e = specsManager.specs) === null || _e === void 0 ? void 0 : _e.default
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
exports.createSessionContext = createSessionContext;
|
|
189
|
-
/**
|
|
190
|
-
* Create a session and return a session connection.
|
|
191
|
-
*/
|
|
192
|
-
async function createSession(options) {
|
|
193
|
-
const manager = Private.getManager().sessions;
|
|
194
|
-
await manager.ready;
|
|
195
|
-
return manager.startNew(options);
|
|
196
|
-
}
|
|
197
|
-
exports.createSession = createSession;
|
|
198
|
-
/**
|
|
199
|
-
* Create a context for a file.
|
|
200
|
-
*/
|
|
201
|
-
function createFileContext(path = coreutils_1.UUID.uuid4() + '.txt', manager = Private.getManager()) {
|
|
202
|
-
const factory = Private.textFactory;
|
|
203
|
-
return new docregistry_1.Context({ manager, factory, path });
|
|
204
|
-
}
|
|
205
|
-
exports.createFileContext = createFileContext;
|
|
206
|
-
async function createFileContextWithKernel(path = coreutils_1.UUID.uuid4() + '.txt', manager = Private.getManager()) {
|
|
207
|
-
var _a;
|
|
208
|
-
const factory = Private.textFactory;
|
|
209
|
-
const specsManager = manager.kernelspecs;
|
|
210
|
-
await specsManager.ready;
|
|
211
|
-
return new docregistry_1.Context({
|
|
212
|
-
manager,
|
|
213
|
-
factory,
|
|
214
|
-
path,
|
|
215
|
-
kernelPreference: {
|
|
216
|
-
shouldStart: true,
|
|
217
|
-
canStart: true,
|
|
218
|
-
name: (_a = specsManager.specs) === null || _a === void 0 ? void 0 : _a.default
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
exports.createFileContextWithKernel = createFileContextWithKernel;
|
|
223
|
-
/**
|
|
224
|
-
* Create and initialize context for a notebook.
|
|
225
|
-
*/
|
|
226
|
-
async function initNotebookContext(options = {}) {
|
|
227
|
-
var _a, _b, _c;
|
|
228
|
-
const factory = Private.notebookFactory;
|
|
229
|
-
const manager = options.manager || Private.getManager();
|
|
230
|
-
const path = options.path || coreutils_1.UUID.uuid4() + '.ipynb';
|
|
231
|
-
console.debug('Initializing notebook context for', path, 'kernel:', options.startKernel);
|
|
232
|
-
const startKernel = options.startKernel === undefined ? false : options.startKernel;
|
|
233
|
-
await manager.ready;
|
|
234
|
-
const context = new docregistry_1.Context({
|
|
235
|
-
manager,
|
|
236
|
-
factory,
|
|
237
|
-
path,
|
|
238
|
-
kernelPreference: {
|
|
239
|
-
shouldStart: startKernel,
|
|
240
|
-
canStart: startKernel,
|
|
241
|
-
shutdownOnDispose: true,
|
|
242
|
-
name: (_a = manager.kernelspecs.specs) === null || _a === void 0 ? void 0 : _a.default
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
await context.initialize(true);
|
|
246
|
-
if (startKernel) {
|
|
247
|
-
await context.sessionContext.initialize();
|
|
248
|
-
await ((_c = (_b = context.sessionContext.session) === null || _b === void 0 ? void 0 : _b.kernel) === null || _c === void 0 ? void 0 : _c.info);
|
|
249
|
-
}
|
|
250
|
-
return context;
|
|
251
|
-
}
|
|
252
|
-
exports.initNotebookContext = initNotebookContext;
|
|
253
|
-
/**
|
|
254
|
-
* Wait for a dialog to be attached to an element.
|
|
255
|
-
*/
|
|
256
|
-
async function waitForDialog(host = document.body, timeout = 250) {
|
|
257
|
-
const interval = 25;
|
|
258
|
-
const limit = Math.floor(timeout / interval);
|
|
259
|
-
for (let counter = 0; counter < limit; counter++) {
|
|
260
|
-
if (host.getElementsByClassName('jp-Dialog')[0]) {
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
await sleep(interval);
|
|
264
|
-
}
|
|
265
|
-
throw new Error('Dialog not found');
|
|
266
|
-
}
|
|
267
|
-
exports.waitForDialog = waitForDialog;
|
|
268
|
-
/**
|
|
269
|
-
* Accept a dialog after it is attached by accepting the default button.
|
|
270
|
-
*/
|
|
271
|
-
async function acceptDialog(host = document.body, timeout = 250) {
|
|
272
|
-
await waitForDialog(host, timeout);
|
|
273
|
-
const node = host.getElementsByClassName('jp-Dialog')[0];
|
|
274
|
-
if (node) {
|
|
275
|
-
(0, simulate_event_1.simulate)(node, 'keydown', { keyCode: 13 });
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
exports.acceptDialog = acceptDialog;
|
|
279
|
-
/**
|
|
280
|
-
* Click on the warning button in a dialog after it is attached
|
|
281
|
-
*/
|
|
282
|
-
async function dangerDialog(host = document.body, timeout = 250) {
|
|
283
|
-
await waitForDialog(host, timeout);
|
|
284
|
-
const node = host.getElementsByClassName('jp-mod-warn')[0];
|
|
285
|
-
if (node) {
|
|
286
|
-
(0, simulate_event_1.simulate)(node, 'click', { button: 1 });
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
exports.dangerDialog = dangerDialog;
|
|
290
|
-
/**
|
|
291
|
-
* Dismiss a dialog after it is attached.
|
|
292
|
-
*
|
|
293
|
-
* #### Notes
|
|
294
|
-
* This promise will always resolve successfully.
|
|
295
|
-
*/
|
|
296
|
-
async function dismissDialog(host = document.body, timeout = 250) {
|
|
297
|
-
try {
|
|
298
|
-
await waitForDialog(host, timeout);
|
|
299
|
-
}
|
|
300
|
-
catch (error) {
|
|
301
|
-
return; // Ignore calls to dismiss the dialog if there is no dialog.
|
|
302
|
-
}
|
|
303
|
-
const node = host.getElementsByClassName('jp-Dialog')[0];
|
|
304
|
-
if (node) {
|
|
305
|
-
(0, simulate_event_1.simulate)(node, 'keydown', { keyCode: 27 });
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
exports.dismissDialog = dismissDialog;
|
|
309
|
-
/**
|
|
310
|
-
* A namespace for private data.
|
|
311
|
-
*/
|
|
312
|
-
var Private;
|
|
313
|
-
(function (Private) {
|
|
314
|
-
let manager;
|
|
315
|
-
Private.textFactory = new docregistry_1.TextModelFactory();
|
|
316
|
-
Private.notebookFactory = new notebook_1.NotebookModelFactory({
|
|
317
|
-
disableDocumentWideUndoRedo: false
|
|
318
|
-
});
|
|
319
|
-
/**
|
|
320
|
-
* Get or create the service manager singleton.
|
|
321
|
-
*/
|
|
322
|
-
function getManager() {
|
|
323
|
-
if (!manager) {
|
|
324
|
-
manager = new services_1.ServiceManager({ standby: 'never' });
|
|
325
|
-
}
|
|
326
|
-
return manager;
|
|
327
|
-
}
|
|
328
|
-
Private.getManager = getManager;
|
|
329
|
-
})(Private || (Private = {}));
|
|
330
|
-
//# sourceMappingURL=common.js.map
|
package/lib/common.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":";;;AAAA,mDAA0C;AAE1C,mDAA+D;AAE/D,mDAAsD;AAEtD,iDAA0D;AAE1D,iDAAoD;AACpD,yDAIiC;AAEjC,mDAA4E;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACI,KAAK,UAAU,YAAY,CAChC,MAAqB,EACrB,UAII,EAAE;IAEN,MAAM,IAAI,GAAG,IAAI,2BAAe,EAAiB,CAAC;IAClD,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,MAAM,CAAC,OAAO,CAAC,CAAC,MAAS,EAAE,IAAO,EAAE,EAAE;;QACpC,IAAI,MAAA,MAAA,OAAO,CAAC,IAAI,wDAAG,MAAM,EAAE,IAAI,CAAC,mCAAI,IAAI,EAAE;YACxC,IAAI;gBACF,kBAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;gBAClC,IAAI,OAAO,CAAC,IAAI,EAAE;oBAChB,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;iBAC5B;aACF;YAAC,OAAO,CAAC,EAAE;gBACV,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;aAChB;YACD,IAAI,CAAC,OAAO,CAAC,MAAA,OAAO,CAAC,KAAK,mCAAI,SAAS,CAAC,CAAC;SAC1C;IACH,CAAC,EAAE,MAAM,CAAC,CAAC;IACX,OAAO,IAAI,CAAC,OAAO,CAAC;AACtB,CAAC;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C;IAErC,uBAAe,GAAG,IAAI,+BAAoB,CAAC;QACtD,2BAA2B,EAAE,KAAK;KACnC,CAAC,CAAC;IAEH;;OAEG;IACH,SAAgB,UAAU;QACxB,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,IAAI,yBAAc,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;SACpD;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IALe,kBAAU,aAKzB,CAAA;AACH,CAAC,EAlBS,OAAO,KAAP,OAAO,QAkBhB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Compares two files lighthouse outputs, listing changes between the numeric audits.
|
|
5
|
-
*
|
|
6
|
-
* Outputs in Markdown for easy posting in Github.
|
|
7
|
-
*/
|
|
8
|
-
const fs_extra_1 = require("fs-extra");
|
|
9
|
-
const firstFilePath = process.argv[2];
|
|
10
|
-
const secondFilePath = process.argv[3];
|
|
11
|
-
console.debug(`\`${firstFilePath}\` -> \`${secondFilePath}\`\n\n`);
|
|
12
|
-
const first = JSON.parse((0, fs_extra_1.readFileSync)(firstFilePath).toString());
|
|
13
|
-
const second = JSON.parse((0, fs_extra_1.readFileSync)(secondFilePath).toString());
|
|
14
|
-
for (const auditName in first.audits) {
|
|
15
|
-
const firstAudit = first.audits[auditName];
|
|
16
|
-
// only compare numeric audits
|
|
17
|
-
if (firstAudit.scoreDisplayMode !== 'numeric') {
|
|
18
|
-
continue;
|
|
19
|
-
}
|
|
20
|
-
const secondAudit = second.audits[auditName];
|
|
21
|
-
const percentChange = ((secondAudit.numericValue - firstAudit.numericValue) /
|
|
22
|
-
firstAudit.numericValue) *
|
|
23
|
-
100;
|
|
24
|
-
if (isNaN(percentChange)) {
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
console.debug(`**${firstAudit.title}**\n* ${percentChange.toFixed(0)}% Δ\n* ${firstAudit.displayValue} -> ${secondAudit.displayValue}\n* ${firstAudit.description}\n`);
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=compare-lighthouse.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compare-lighthouse.js","sourceRoot":"","sources":["../src/compare-lighthouse.ts"],"names":[],"mappings":";;AAAA;;;;GAIG;AACH,uCAAwC;AAExC,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACtC,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEvC,OAAO,CAAC,KAAK,CAAC,KAAK,aAAa,WAAW,cAAc,QAAQ,CAAC,CAAC;AAcnE,MAAM,KAAK,GAAY,IAAI,CAAC,KAAK,CAAC,IAAA,uBAAY,EAAC,aAAa,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;AAC1E,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,IAAA,uBAAY,EAAC,cAAc,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;AAE5E,KAAK,MAAM,SAAS,IAAI,KAAK,CAAC,MAAM,EAAE;IACpC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAE3C,8BAA8B;IAC9B,IAAI,UAAU,CAAC,gBAAgB,KAAK,SAAS,EAAE;QAC7C,SAAS;KACV;IACD,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC7C,MAAM,aAAa,GACjB,CAAC,CAAC,WAAW,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;QACnD,UAAU,CAAC,YAAY,CAAC;QAC1B,GAAG,CAAC;IAEN,IAAI,KAAK,CAAC,aAAa,CAAC,EAAE;QACxB,SAAS;KACV;IACD,OAAO,CAAC,KAAK,CACX,KAAK,UAAU,CAAC,KAAK,SAAS,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,UACpD,UAAU,CAAC,YACb,OAAO,WAAW,CAAC,YAAY,OAAO,UAAU,CAAC,WAAW,IAAI,CACjE,CAAC;CACH"}
|
package/lib/flakyIt.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/// <reference types="jest" />
|
|
2
|
-
/**
|
|
3
|
-
* Run a flaky test with retries.
|
|
4
|
-
*
|
|
5
|
-
* @param name The name of the test
|
|
6
|
-
* @param fn The function of the test
|
|
7
|
-
* @param retries The number of retries
|
|
8
|
-
* @param wait The time to wait in milliseconds between retries
|
|
9
|
-
*/
|
|
10
|
-
export declare function flakyIt(name: string, fn: any, retries?: number, wait?: number): void;
|
|
11
|
-
export declare namespace flakyIt {
|
|
12
|
-
var only: jest.It;
|
|
13
|
-
var skip: jest.It;
|
|
14
|
-
var todo: jest.It;
|
|
15
|
-
}
|
package/lib/flakyIt.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Adapted from https://github.com/bluzi/jest-retries/blob/01a9713a7379edcfd2d1bccec7c0fbc66d4602da/src/retry.js
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.flakyIt = void 0;
|
|
5
|
-
// We explicitly reference the jest typings since the jest.d.ts file shipped
|
|
6
|
-
// with jest 26 masks the @types/jest typings
|
|
7
|
-
/// <reference types="jest" />
|
|
8
|
-
const common_1 = require("./common");
|
|
9
|
-
/**
|
|
10
|
-
* Run a test function.
|
|
11
|
-
*
|
|
12
|
-
* @param fn The function of the test
|
|
13
|
-
*/
|
|
14
|
-
async function runTest(fn) {
|
|
15
|
-
return new Promise((resolve, reject) => {
|
|
16
|
-
const result = fn((err) => (err ? reject(err) : resolve()));
|
|
17
|
-
if (result && result.then) {
|
|
18
|
-
result.catch(reject).then(resolve);
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
resolve();
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Run a flaky test with retries.
|
|
27
|
-
*
|
|
28
|
-
* @param name The name of the test
|
|
29
|
-
* @param fn The function of the test
|
|
30
|
-
* @param retries The number of retries
|
|
31
|
-
* @param wait The time to wait in milliseconds between retries
|
|
32
|
-
*/
|
|
33
|
-
/* eslint-disable jest/no-export */
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
35
|
-
function flakyIt(name, fn, retries = 3, wait = 1000) {
|
|
36
|
-
// eslint-disable-next-line jest/expect-expect, jest/valid-title
|
|
37
|
-
test(name, async () => {
|
|
38
|
-
let latestError;
|
|
39
|
-
for (let tries = 0; tries < retries; tries++) {
|
|
40
|
-
try {
|
|
41
|
-
await runTest(fn);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
latestError = error;
|
|
46
|
-
await (0, common_1.sleep)(wait);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
throw latestError;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
exports.flakyIt = flakyIt;
|
|
53
|
-
/* eslint-enable jest/no-export */
|
|
54
|
-
flakyIt.only = it.only;
|
|
55
|
-
flakyIt.skip = it.skip;
|
|
56
|
-
flakyIt.todo = it.todo;
|
|
57
|
-
//# sourceMappingURL=flakyIt.js.map
|
package/lib/flakyIt.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flakyIt.js","sourceRoot":"","sources":["../src/flakyIt.ts"],"names":[],"mappings":";AAAA,gHAAgH;;;AAEhH,4EAA4E;AAC5E,6CAA6C;AAE7C,8BAA8B;AAE9B,qCAAiC;AAEjC;;;;GAIG;AACH,KAAK,UAAU,OAAO,CAAC,EAAO;IAC5B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,MAAM,GAAG,EAAE,CAAC,CAAC,GAAU,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAEnE,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE;YACzB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACpC;aAAM;YACL,OAAO,EAAE,CAAC;SACX;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACH,mCAAmC;AACnC,6EAA6E;AAC7E,SAAgB,OAAO,CAAC,IAAY,EAAE,EAAO,EAAE,OAAO,GAAG,CAAC,EAAE,IAAI,GAAG,IAAI;IACrE,gEAAgE;IAChE,IAAI,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE;QACpB,IAAI,WAAW,CAAC;QAChB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,OAAO,EAAE,KAAK,EAAE,EAAE;YAC5C,IAAI;gBACF,MAAM,OAAO,CAAC,EAAE,CAAC,CAAC;gBAClB,OAAO;aACR;YAAC,OAAO,KAAK,EAAE;gBACd,WAAW,GAAG,KAAK,CAAC;gBACpB,MAAM,IAAA,cAAK,EAAC,IAAI,CAAC,CAAC;aACnB;SACF;QACD,MAAM,WAAW,CAAC;IACpB,CAAC,CAAC,CAAC;AACL,CAAC;AAfD,0BAeC;AACD,kCAAkC;AAElC,OAAO,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;AACvB,OAAO,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;AACvB,OAAO,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC"}
|
package/lib/jest-file-mock.d.ts
DELETED
|
File without changes
|
package/lib/jest-file-mock.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jest-file-mock.js","sourceRoot":"","sources":["../src/jest-file-mock.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,GAAG,gBAAgB,CAAC"}
|
package/lib/jest-shim.d.ts
DELETED
package/lib/jest-shim.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
// Shims originally adapted from https://github.com/nteract/nteract/blob/47f8b038ff129543e42c39395129efc433eb4e90/scripts/test-shim.js
|
|
2
|
-
const util = require('util');
|
|
3
|
-
global.TextDecoder = util.TextDecoder;
|
|
4
|
-
global.TextEncoder = util.TextEncoder;
|
|
5
|
-
const fetchMod = (window.fetch = require('node-fetch')); // tslint:disable-line
|
|
6
|
-
window.Request = fetchMod.Request;
|
|
7
|
-
window.Headers = fetchMod.Headers;
|
|
8
|
-
window.Response = fetchMod.Response;
|
|
9
|
-
global.Image = window.Image;
|
|
10
|
-
global.Range = function Range() {
|
|
11
|
-
/* no-op */
|
|
12
|
-
};
|
|
13
|
-
// HACK: Polyfill that allows CodeMirror to render in a JSDOM env.
|
|
14
|
-
const createContextualFragment = (html) => {
|
|
15
|
-
const div = document.createElement('div');
|
|
16
|
-
div.innerHTML = html;
|
|
17
|
-
return div.children[0]; // so hokey it's not even funny
|
|
18
|
-
};
|
|
19
|
-
global.Range.prototype.createContextualFragment = (html) => createContextualFragment(html);
|
|
20
|
-
window.document.createRange = function createRange() {
|
|
21
|
-
return {
|
|
22
|
-
setEnd: () => {
|
|
23
|
-
/* no-op */
|
|
24
|
-
},
|
|
25
|
-
setStart: () => {
|
|
26
|
-
/* no-op */
|
|
27
|
-
},
|
|
28
|
-
getBoundingClientRect: () => ({ right: 0 }),
|
|
29
|
-
getClientRects: () => [],
|
|
30
|
-
createContextualFragment
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
// end CodeMirror HACK
|
|
34
|
-
window.focus = () => {
|
|
35
|
-
/* JSDom throws "Not Implemented" */
|
|
36
|
-
};
|
|
37
|
-
window.document.elementFromPoint = (left, top) => document.body;
|
|
38
|
-
if (!window.hasOwnProperty('getSelection')) {
|
|
39
|
-
// Minimal getSelection() that supports a fake selection
|
|
40
|
-
window.getSelection = function getSelection() {
|
|
41
|
-
return {
|
|
42
|
-
_selection: '',
|
|
43
|
-
selectAllChildren: () => {
|
|
44
|
-
this._selection = 'foo';
|
|
45
|
-
},
|
|
46
|
-
toString: () => {
|
|
47
|
-
const val = this._selection;
|
|
48
|
-
this._selection = '';
|
|
49
|
-
return val;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
// Used by xterm.js
|
|
55
|
-
window.matchMedia = function (media) {
|
|
56
|
-
return {
|
|
57
|
-
matches: false,
|
|
58
|
-
media,
|
|
59
|
-
onchange: () => {
|
|
60
|
-
/* empty */
|
|
61
|
-
},
|
|
62
|
-
addEventListener: () => {
|
|
63
|
-
/* empty */
|
|
64
|
-
},
|
|
65
|
-
removeEventListener: () => {
|
|
66
|
-
/* empty */
|
|
67
|
-
},
|
|
68
|
-
dispatchEvent: () => {
|
|
69
|
-
return true;
|
|
70
|
-
},
|
|
71
|
-
addListener: () => {
|
|
72
|
-
/* empty */
|
|
73
|
-
},
|
|
74
|
-
removeListener: () => {
|
|
75
|
-
/* empty */
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
process.on('unhandledRejection', (error, promise) => {
|
|
80
|
-
console.error('Unhandled promise rejection somewhere in tests');
|
|
81
|
-
if (error) {
|
|
82
|
-
console.error(error);
|
|
83
|
-
const stack = error.stack;
|
|
84
|
-
if (stack) {
|
|
85
|
-
console.error(stack);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
promise.catch(err => console.error('promise rejected', err));
|
|
89
|
-
});
|
|
90
|
-
//# sourceMappingURL=jest-shim.js.map
|
package/lib/jest-shim.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jest-shim.js","sourceRoot":"","sources":["../src/jest-shim.ts"],"names":[],"mappings":"AAAA,sIAAsI;A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IAClD,OAAO,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;IAChE,IAAI,KAAK,EAAE;QACT,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,MAAM,KAAK,GAAI,KAAa,CAAC,KAAK,CAAC;QACnC,IAAI,KAAK,EAAE;YACT,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACtB;KACF;IACD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC,CAAC;AAC/D,CAAC,CAAC,CAAC"}
|
package/lib/notebook-utils.d.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { CodeEditorWrapper } from '@jupyterlab/codeeditor';
|
|
2
|
-
import * as nbformat from '@jupyterlab/nbformat';
|
|
3
|
-
import { Context, DocumentRegistry } from '@jupyterlab/docregistry';
|
|
4
|
-
import { INotebookModel, Notebook, NotebookPanel, NotebookWidgetFactory } from '@jupyterlab/notebook';
|
|
5
|
-
import { RenderMimeRegistry } from '@jupyterlab/rendermime';
|
|
6
|
-
import { Cell, CodeCellModel } from '@jupyterlab/cells';
|
|
7
|
-
/**
|
|
8
|
-
* The default notebook content.
|
|
9
|
-
*/
|
|
10
|
-
export declare namespace NBTestUtils {
|
|
11
|
-
/**
|
|
12
|
-
* The default outputs used for testing.
|
|
13
|
-
*/
|
|
14
|
-
const DEFAULT_OUTPUTS: nbformat.IOutput[];
|
|
15
|
-
const DEFAULT_CONTENT: nbformat.INotebookContent;
|
|
16
|
-
const DEFAULT_CONTENT_45: nbformat.INotebookContent;
|
|
17
|
-
const defaultEditorConfig: {
|
|
18
|
-
code: Partial<import("@jupyterlab/codeeditor").CodeEditor.IConfig>;
|
|
19
|
-
markdown: Partial<import("@jupyterlab/codeeditor").CodeEditor.IConfig>;
|
|
20
|
-
raw: Partial<import("@jupyterlab/codeeditor").CodeEditor.IConfig>;
|
|
21
|
-
};
|
|
22
|
-
const editorFactory: any;
|
|
23
|
-
const mimeTypeService: import("@jupyterlab/codeeditor").IEditorMimeTypeService;
|
|
24
|
-
/**
|
|
25
|
-
* Get a copy of the default rendermime instance.
|
|
26
|
-
*/
|
|
27
|
-
function defaultRenderMime(): RenderMimeRegistry;
|
|
28
|
-
const clipboard: import("@lumino/coreutils").MimeData;
|
|
29
|
-
/**
|
|
30
|
-
* Create a base cell content factory.
|
|
31
|
-
*/
|
|
32
|
-
function createBaseCellFactory(): Cell.IContentFactory;
|
|
33
|
-
/**
|
|
34
|
-
* Create a new code cell content factory.
|
|
35
|
-
*/
|
|
36
|
-
function createCodeCellFactory(): Cell.IContentFactory;
|
|
37
|
-
/**
|
|
38
|
-
* Create a cell editor widget.
|
|
39
|
-
*/
|
|
40
|
-
function createCellEditor(model?: CodeCellModel): CodeEditorWrapper;
|
|
41
|
-
/**
|
|
42
|
-
* Create a default notebook content factory.
|
|
43
|
-
*/
|
|
44
|
-
function createNotebookFactory(): Notebook.IContentFactory;
|
|
45
|
-
/**
|
|
46
|
-
* Create a default notebook panel content factory.
|
|
47
|
-
*/
|
|
48
|
-
function createNotebookPanelFactory(): NotebookPanel.IContentFactory;
|
|
49
|
-
/**
|
|
50
|
-
* Create a notebook widget.
|
|
51
|
-
*/
|
|
52
|
-
function createNotebook(): Notebook;
|
|
53
|
-
/**
|
|
54
|
-
* Create a notebook panel widget.
|
|
55
|
-
*/
|
|
56
|
-
function createNotebookPanel(context: Context<INotebookModel>): NotebookPanel;
|
|
57
|
-
/**
|
|
58
|
-
* Populate a notebook with default content.
|
|
59
|
-
*/
|
|
60
|
-
function populateNotebook(notebook: Notebook): void;
|
|
61
|
-
function createNotebookWidgetFactory(toolbarFactory?: (widget: NotebookPanel) => DocumentRegistry.IToolbarItem[]): NotebookWidgetFactory;
|
|
62
|
-
/**
|
|
63
|
-
* Create a context for a file.
|
|
64
|
-
*/
|
|
65
|
-
function createMockContext(startKernel?: boolean): Promise<Context<INotebookModel>>;
|
|
66
|
-
}
|