@mui/internal-test-utils 2.0.15 → 2.0.16
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/{src/chai.types.ts → chai.types.d.ts} +7 -40
- package/chai.types.js +5 -0
- package/chaiPlugin.d.ts +4 -0
- package/chaiPlugin.js +287 -0
- package/{build/components.d.ts → components.d.ts} +18 -19
- package/components.js +64 -0
- package/createDOM.d.ts +2 -0
- package/{src/createDOM.js → createDOM.js} +17 -35
- package/createDescribe.d.ts +7 -0
- package/createDescribe.js +26 -0
- package/createRenderer.d.ts +214 -0
- package/createRenderer.js +428 -0
- package/createRenderer.test.d.ts +1 -0
- package/describeConformance.d.ts +200 -0
- package/describeConformance.js +1038 -0
- package/env.d.ts +1 -0
- package/env.js +11 -0
- package/esm/chai.types.d.ts +74 -0
- package/esm/chai.types.js +3 -0
- package/esm/chaiPlugin.d.ts +4 -0
- package/esm/chaiPlugin.js +281 -0
- package/esm/components.d.ts +35 -0
- package/esm/components.js +56 -0
- package/esm/createDOM.d.ts +2 -0
- package/esm/createDOM.js +47 -0
- package/esm/createDescribe.d.ts +7 -0
- package/esm/createDescribe.js +19 -0
- package/esm/createRenderer.d.ts +214 -0
- package/esm/createRenderer.js +390 -0
- package/esm/createRenderer.test.d.ts +1 -0
- package/esm/describeConformance.d.ts +200 -0
- package/esm/describeConformance.js +1024 -0
- package/esm/env.d.ts +1 -0
- package/esm/env.js +5 -0
- package/{build → esm}/fireDiscreteEvent.d.ts +1 -2
- package/{src/fireDiscreteEvent.ts → esm/fireDiscreteEvent.js} +10 -18
- package/esm/flushMicrotasks.d.ts +1 -0
- package/{src/flushMicrotasks.ts → esm/flushMicrotasks.js} +2 -3
- package/{build → esm}/focusVisible.d.ts +1 -2
- package/{src/focusVisible.ts → esm/focusVisible.js} +10 -9
- package/esm/index.d.ts +18 -0
- package/esm/index.js +27 -0
- package/esm/init.d.ts +1 -0
- package/{src → esm}/init.js +4 -2
- package/esm/initMatchers.d.ts +1 -0
- package/esm/initMatchers.js +6 -0
- package/esm/initMatchers.test.d.ts +1 -0
- package/esm/initPlaywrightMatchers.d.ts +24 -0
- package/esm/initPlaywrightMatchers.js +40 -0
- package/esm/package.json +1 -0
- package/esm/reactMajor.d.ts +2 -0
- package/esm/reactMajor.js +2 -0
- package/esm/setup.d.ts +1 -0
- package/{src → esm}/setup.js +2 -4
- package/esm/setupVitest.d.ts +1 -0
- package/esm/setupVitest.js +28 -0
- package/esm/setupVitestBrowser.d.ts +1 -0
- package/esm/setupVitestBrowser.js +30 -0
- package/fireDiscreteEvent.d.ts +6 -0
- package/fireDiscreteEvent.js +79 -0
- package/flushMicrotasks.d.ts +1 -0
- package/flushMicrotasks.js +10 -0
- package/focusVisible.d.ts +7 -0
- package/focusVisible.js +44 -0
- package/index.d.ts +18 -0
- package/index.js +139 -0
- package/init.d.ts +1 -0
- package/init.js +15 -0
- package/initMatchers.d.ts +1 -0
- package/initMatchers.js +10 -0
- package/initMatchers.test.d.ts +1 -0
- package/initPlaywrightMatchers.d.ts +24 -0
- package/initPlaywrightMatchers.js +42 -0
- package/package.json +89 -46
- package/reactMajor.d.ts +2 -0
- package/reactMajor.js +9 -0
- package/setup.d.ts +1 -0
- package/setup.js +10 -0
- package/setupVitest.d.ts +1 -0
- package/setupVitest.js +32 -0
- package/setupVitestBrowser.d.ts +1 -0
- package/setupVitestBrowser.js +34 -0
- package/build/.tsbuildinfo +0 -1
- package/build/KarmaReporterReactProfiler.d.ts +0 -51
- package/build/KarmaReporterReactProfiler.d.ts.map +0 -1
- package/build/KarmaReporterReactProfiler.js +0 -66
- package/build/KarmaReporterReactProfiler.js.map +0 -1
- package/build/chai.types.d.ts +0 -75
- package/build/chai.types.d.ts.map +0 -1
- package/build/chai.types.js +0 -3
- package/build/chai.types.js.map +0 -1
- package/build/chaiPlugin.d.ts +0 -5
- package/build/chaiPlugin.d.ts.map +0 -1
- package/build/chaiPlugin.js +0 -416
- package/build/chaiPlugin.js.map +0 -1
- package/build/components.d.ts.map +0 -1
- package/build/components.js +0 -88
- package/build/components.js.map +0 -1
- package/build/createDOM.d.ts +0 -3
- package/build/createDOM.d.ts.map +0 -1
- package/build/createDOM.js +0 -60
- package/build/createDOM.js.map +0 -1
- package/build/createDescribe.d.ts +0 -8
- package/build/createDescribe.d.ts.map +0 -1
- package/build/createDescribe.js +0 -22
- package/build/createDescribe.js.map +0 -1
- package/build/createRenderer.d.ts +0 -215
- package/build/createRenderer.d.ts.map +0 -1
- package/build/createRenderer.js +0 -564
- package/build/createRenderer.js.map +0 -1
- package/build/createRenderer.test.d.ts +0 -2
- package/build/createRenderer.test.d.ts.map +0 -1
- package/build/createRenderer.test.js +0 -58
- package/build/createRenderer.test.js.map +0 -1
- package/build/describeConformance.d.ts +0 -201
- package/build/describeConformance.d.ts.map +0 -1
- package/build/describeConformance.js +0 -859
- package/build/describeConformance.js.map +0 -1
- package/build/describeSkipIf.d.ts +0 -4
- package/build/describeSkipIf.d.ts.map +0 -1
- package/build/describeSkipIf.js +0 -10
- package/build/describeSkipIf.js.map +0 -1
- package/build/fireDiscreteEvent.d.ts.map +0 -1
- package/build/fireDiscreteEvent.js +0 -77
- package/build/fireDiscreteEvent.js.map +0 -1
- package/build/flushMicrotasks.d.ts +0 -2
- package/build/flushMicrotasks.d.ts.map +0 -1
- package/build/flushMicrotasks.js +0 -8
- package/build/flushMicrotasks.js.map +0 -1
- package/build/focusVisible.d.ts.map +0 -1
- package/build/focusVisible.js +0 -38
- package/build/focusVisible.js.map +0 -1
- package/build/index.d.ts +0 -18
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -68
- package/build/index.js.map +0 -1
- package/build/init.d.ts +0 -2
- package/build/init.d.ts.map +0 -1
- package/build/init.js +0 -46
- package/build/init.js.map +0 -1
- package/build/initMatchers.d.ts +0 -2
- package/build/initMatchers.d.ts.map +0 -1
- package/build/initMatchers.js +0 -45
- package/build/initMatchers.js.map +0 -1
- package/build/initMatchers.test.d.ts +0 -2
- package/build/initMatchers.test.d.ts.map +0 -1
- package/build/initMatchers.test.js +0 -101
- package/build/initMatchers.test.js.map +0 -1
- package/build/initPlaywrightMatchers.d.ts +0 -25
- package/build/initPlaywrightMatchers.d.ts.map +0 -1
- package/build/initPlaywrightMatchers.js +0 -73
- package/build/initPlaywrightMatchers.js.map +0 -1
- package/build/mochaHooks.d.ts +0 -24
- package/build/mochaHooks.d.ts.map +0 -1
- package/build/mochaHooks.js +0 -165
- package/build/mochaHooks.js.map +0 -1
- package/build/mochaHooks.test.d.ts +0 -2
- package/build/mochaHooks.test.d.ts.map +0 -1
- package/build/mochaHooks.test.js +0 -128
- package/build/mochaHooks.test.js.map +0 -1
- package/build/reactMajor.d.ts +0 -3
- package/build/reactMajor.d.ts.map +0 -1
- package/build/reactMajor.js +0 -38
- package/build/reactMajor.js.map +0 -1
- package/build/setup.d.ts +0 -2
- package/build/setup.d.ts.map +0 -1
- package/build/setup.js +0 -10
- package/build/setup.js.map +0 -1
- package/build/setupBabel.d.ts +0 -2
- package/build/setupBabel.d.ts.map +0 -1
- package/build/setupBabel.js +0 -5
- package/build/setupBabel.js.map +0 -1
- package/build/setupBabelPlaywright.d.ts +0 -2
- package/build/setupBabelPlaywright.d.ts.map +0 -1
- package/build/setupBabelPlaywright.js +0 -14
- package/build/setupBabelPlaywright.js.map +0 -1
- package/build/setupJSDOM.d.ts +0 -7
- package/build/setupJSDOM.d.ts.map +0 -1
- package/build/setupJSDOM.js +0 -17
- package/build/setupJSDOM.js.map +0 -1
- package/build/setupKarma.d.ts +0 -2
- package/build/setupKarma.d.ts.map +0 -1
- package/build/setupKarma.js +0 -56
- package/build/setupKarma.js.map +0 -1
- package/build/setupVitest.d.ts +0 -2
- package/build/setupVitest.d.ts.map +0 -1
- package/build/setupVitest.js +0 -131
- package/build/setupVitest.js.map +0 -1
- package/src/KarmaReporterReactProfiler.js +0 -82
- package/src/chai-augmentation.d.ts +0 -8
- package/src/chaiPlugin.ts +0 -515
- package/src/components.tsx +0 -61
- package/src/createDOM.d.ts +0 -9
- package/src/createDescribe.ts +0 -31
- package/src/createRenderer.test.js +0 -31
- package/src/createRenderer.tsx +0 -808
- package/src/describeConformance.tsx +0 -1257
- package/src/describeSkipIf.tsx +0 -11
- package/src/index.ts +0 -25
- package/src/initMatchers.test.js +0 -124
- package/src/initMatchers.ts +0 -7
- package/src/initPlaywrightMatchers.ts +0 -101
- package/src/mochaHooks.js +0 -200
- package/src/mochaHooks.test.js +0 -116
- package/src/reactMajor.ts +0 -3
- package/src/setupBabel.js +0 -3
- package/src/setupBabelPlaywright.js +0 -13
- package/src/setupJSDOM.js +0 -20
- package/src/setupKarma.js +0 -65
- package/src/setupVitest.ts +0 -117
- package/tsconfig.build.json +0 -16
- package/tsconfig.json +0 -17
package/build/setupKarma.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/* global before, after, beforeEach, afterEach */
|
|
4
|
-
const mochaHooks_1 = require("./mochaHooks");
|
|
5
|
-
const mochaHooks = (0, mochaHooks_1.createMochaHooks)(window.Mocha);
|
|
6
|
-
/**
|
|
7
|
-
* Emit events from `DispatchingProfiler` as `browser_info` karma events.
|
|
8
|
-
*/
|
|
9
|
-
function handleReactProfilerResults(event) {
|
|
10
|
-
// Only own properties are persisted when sending the object.
|
|
11
|
-
const info = { type: event.type, detail: event.detail };
|
|
12
|
-
// eslint-disable-next-line no-underscore-dangle -- public: http://karma-runner.github.io/5.2/dev/plugins.html
|
|
13
|
-
window.__karma__.info(info);
|
|
14
|
-
}
|
|
15
|
-
before(function beforeAllHook() {
|
|
16
|
-
mochaHooks.beforeAll.forEach((mochaHook) => {
|
|
17
|
-
mochaHook.call(this);
|
|
18
|
-
});
|
|
19
|
-
window.addEventListener('reactProfilerResults', handleReactProfilerResults);
|
|
20
|
-
});
|
|
21
|
-
after(function afterAllHook() {
|
|
22
|
-
window.removeEventListener('reactProfilerResults', handleReactProfilerResults);
|
|
23
|
-
mochaHooks.afterAll.forEach((mochaHook) => {
|
|
24
|
-
mochaHook.call(this);
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
beforeEach(function beforeEachHook() {
|
|
28
|
-
mochaHooks.beforeEach.forEach((mochaHook) => {
|
|
29
|
-
mochaHook.call(this);
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
afterEach(function afterEachHook() {
|
|
33
|
-
mochaHooks.afterEach.forEach((mochaHook) => {
|
|
34
|
-
mochaHook.call(this);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
// Ensure that uncaught exceptions between tests result in the tests failing.
|
|
38
|
-
// This works around an issue with mocha / karma-mocha, see
|
|
39
|
-
// https://github.com/karma-runner/karma-mocha/issues/227
|
|
40
|
-
let pendingError = null;
|
|
41
|
-
let pendingErrorNotice = null;
|
|
42
|
-
window.addEventListener('error', (event) => {
|
|
43
|
-
pendingError = event.error;
|
|
44
|
-
pendingErrorNotice = 'An uncaught exception was thrown between tests';
|
|
45
|
-
});
|
|
46
|
-
window.addEventListener('unhandledrejection', (event) => {
|
|
47
|
-
pendingError = event.reason;
|
|
48
|
-
pendingErrorNotice = 'An uncaught promise rejection occurred between tests';
|
|
49
|
-
});
|
|
50
|
-
afterEach(() => {
|
|
51
|
-
if (pendingError) {
|
|
52
|
-
console.error(pendingErrorNotice);
|
|
53
|
-
throw pendingError;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
//# sourceMappingURL=setupKarma.js.map
|
package/build/setupKarma.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setupKarma.js","sourceRoot":"","sources":["../src/setupKarma.js"],"names":[],"mappings":";;AAAA,iDAAiD;AACjD,6CAAgD;AAEhD,MAAM,UAAU,GAAG,IAAA,6BAAgB,EAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAElD;;GAEG;AACH,SAAS,0BAA0B,CAAC,KAAK;IACvC,6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;AAE9B,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;IACzC,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC;IAC3B,kBAAkB,GAAG,gDAAgD,CAAC;AACxE,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,CAAC,KAAK,EAAE,EAAE;IACtD,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC;IAC5B,kBAAkB,GAAG,sDAAsD,CAAC;AAC9E,CAAC,CAAC,CAAC;AAEH,SAAS,CAAC,GAAG,EAAE;IACb,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QAClC,MAAM,YAAY,CAAC;IACrB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
package/build/setupVitest.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setupVitest.d.ts","sourceRoot":"","sources":["../src/setupVitest.ts"],"names":[],"mappings":"AAGA,OAAO,gBAAgB,CAAC"}
|
package/build/setupVitest.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
const vitest_1 = require("vitest");
|
|
40
|
-
const testingLibrary = __importStar(require("@testing-library/dom"));
|
|
41
|
-
const vitest_fail_on_console_1 = __importDefault(require("vitest-fail-on-console"));
|
|
42
|
-
require("./initMatchers");
|
|
43
|
-
// checking if an element is hidden is quite expensive
|
|
44
|
-
// this is only done in CI as a fail safe. It can still explicitly be checked
|
|
45
|
-
// in the test files which helps documenting what is part of the DOM but hidden
|
|
46
|
-
// from assistive technology
|
|
47
|
-
const defaultHidden = !process.env.CI;
|
|
48
|
-
// adds verbosity for something that might be confusing
|
|
49
|
-
console.warn(`${defaultHidden ? 'including' : 'excluding'} inaccessible elements by default`);
|
|
50
|
-
testingLibrary.configure({
|
|
51
|
-
// JSDOM logs errors otherwise on `getComputedStyle(element, pseudoElement)` calls.
|
|
52
|
-
computedStyleSupportsPseudoElements: false,
|
|
53
|
-
defaultHidden,
|
|
54
|
-
});
|
|
55
|
-
// Enable missing act warnings: https://github.com/reactwg/react-18/discussions/102
|
|
56
|
-
globalThis.jest = null;
|
|
57
|
-
globalThis.IS_REACT_ACT_ENVIRONMENT = true;
|
|
58
|
-
(0, vitest_fail_on_console_1.default)({
|
|
59
|
-
silenceMessage: (message) => {
|
|
60
|
-
if (process.env.NODE_ENV === 'production') {
|
|
61
|
-
// TODO: mock scheduler
|
|
62
|
-
if (message.includes('act(...) is not supported in production builds of React')) {
|
|
63
|
-
return true;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (message.includes('Warning: useLayoutEffect does nothing on the server')) {
|
|
67
|
-
// Controversial warning that is commonly ignored by switching to `useEffect` on the server.
|
|
68
|
-
// https://github.com/facebook/react/issues/14927
|
|
69
|
-
// However, this switch doesn't work since it relies on environment sniffing and we test SSR in a browser environment.
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
// Unclear why this is an issue for the current occurrences of this warning.
|
|
73
|
-
// TODO: Revisit once https://github.com/facebook/react/issues/22796 is resolved
|
|
74
|
-
if (message.includes('Detected multiple renderers concurrently rendering the same context provider.')) {
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
return false;
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
function wrapIt(itFn) {
|
|
81
|
-
return function wrapper(name, fn) {
|
|
82
|
-
return itFn(name, (context) => {
|
|
83
|
-
return fn?.call({
|
|
84
|
-
...context,
|
|
85
|
-
currentTest: {
|
|
86
|
-
fullTitle: () => context.task.name,
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
const wrappedIt = wrapIt(vitest_1.it);
|
|
93
|
-
wrappedIt.skip = wrapIt(vitest_1.it.skip);
|
|
94
|
-
wrappedIt.only = wrapIt(vitest_1.it.only);
|
|
95
|
-
globalThis.it = wrappedIt;
|
|
96
|
-
if (!globalThis.before) {
|
|
97
|
-
globalThis.before = vitest_1.beforeAll;
|
|
98
|
-
}
|
|
99
|
-
if (!globalThis.after) {
|
|
100
|
-
globalThis.after = vitest_1.afterAll;
|
|
101
|
-
}
|
|
102
|
-
if (!globalThis.specify) {
|
|
103
|
-
globalThis.specify = wrappedIt;
|
|
104
|
-
}
|
|
105
|
-
const isJsdom = typeof window !== 'undefined' && window.navigator.userAgent.includes('jsdom');
|
|
106
|
-
// Only necessary when not in browser mode.
|
|
107
|
-
if (isJsdom) {
|
|
108
|
-
class Touch {
|
|
109
|
-
constructor(instance) {
|
|
110
|
-
this.instance = instance;
|
|
111
|
-
}
|
|
112
|
-
get identifier() {
|
|
113
|
-
return this.instance.identifier;
|
|
114
|
-
}
|
|
115
|
-
get pageX() {
|
|
116
|
-
return this.instance.pageX;
|
|
117
|
-
}
|
|
118
|
-
get pageY() {
|
|
119
|
-
return this.instance.pageY;
|
|
120
|
-
}
|
|
121
|
-
get clientX() {
|
|
122
|
-
return this.instance.clientX;
|
|
123
|
-
}
|
|
124
|
-
get clientY() {
|
|
125
|
-
return this.instance.clientY;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
// @ts-expect-error
|
|
129
|
-
globalThis.window.Touch = Touch;
|
|
130
|
-
}
|
|
131
|
-
//# sourceMappingURL=setupVitest.js.map
|
package/build/setupVitest.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setupVitest.js","sourceRoot":"","sources":["../src/setupVitest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAiD;AACjD,qEAAuD;AACvD,oFAAmD;AACnD,0BAAwB;AAExB,sDAAsD;AACtD,6EAA6E;AAC7E,+EAA+E;AAC/E,4BAA4B;AAC5B,MAAM,aAAa,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;AAEtC,uDAAuD;AACvD,OAAO,CAAC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nB,UAAU,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;AAClC,CAAC"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
// File is not transpiled.
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const fs = require('node:fs');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @typedef {object} Browser
|
|
7
|
-
* @property {string} id - Seem random
|
|
8
|
-
* @property {string} name - Includes name, version and OS
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Records results from the Profiler injected
|
|
13
|
-
* @param {*} karmaConfig
|
|
14
|
-
*/
|
|
15
|
-
function KarmaReporterReactProfiler(karmaConfig) {
|
|
16
|
-
/**
|
|
17
|
-
* Mapping from browser.id to all profiler results it received
|
|
18
|
-
* @type {Map<string, Record<string, unknown[]>}
|
|
19
|
-
*/
|
|
20
|
-
const allRenders = new Map();
|
|
21
|
-
|
|
22
|
-
const { outputDir } = karmaConfig.reactProfilerReporter || {};
|
|
23
|
-
if (typeof outputDir !== 'string') {
|
|
24
|
-
throw new TypeError(
|
|
25
|
-
`Expected karma config to contain reactProfilerReporter.outputDir of type 'string' but got type '${typeof outputDir}'.`,
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
fs.mkdirSync(outputDir, { recursive: true });
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @param {Browser} browser
|
|
32
|
-
* @param {unknown | { type: 'reactProfilerResults', detail: Record<string, unknown[]>}} info
|
|
33
|
-
*/
|
|
34
|
-
function handleBrowserInfo(browser, info) {
|
|
35
|
-
// `info?.type`
|
|
36
|
-
if (info != null && info.type === 'reactProfilerResults') {
|
|
37
|
-
Object.assign(allRenders.get(browser.id), info.detail);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* @param {Browser} browser
|
|
43
|
-
*/
|
|
44
|
-
this.onBrowserStart = (browser) => {
|
|
45
|
-
allRenders.set(browser.id, {});
|
|
46
|
-
// Create it on start to signal to users where the files will appear
|
|
47
|
-
fs.mkdirSync(path.join(outputDir, browser.name), { recursive: true });
|
|
48
|
-
|
|
49
|
-
browser.emitter.addListener('browser_info', handleBrowserInfo);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @param {Browser} browser
|
|
54
|
-
*/
|
|
55
|
-
this.onBrowserComplete = (browser) => {
|
|
56
|
-
browser.emitter.removeListener('browser_info', handleBrowserInfo);
|
|
57
|
-
|
|
58
|
-
const browserRenders = allRenders.get(browser.id);
|
|
59
|
-
if (browserRenders === undefined) {
|
|
60
|
-
// Can be undefined if the run for this browser never started.
|
|
61
|
-
// For example, when starting the browser timed out in https://app.circleci.com/pipelines/github/mui/material-ui/32869/workflows/a2f398d9-2eb4-4390-a912-40c1b8d458d8/jobs/211413.
|
|
62
|
-
console.warn(
|
|
63
|
-
`Unable to find browser renders for '${browser.id}'. ` +
|
|
64
|
-
`Only recorded renders for '${Array.from(allRenders.keys()).join("', '")}. ` +
|
|
65
|
-
`Maybe the browser never started?'`,
|
|
66
|
-
);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
fs.mkdirSync(path.join(outputDir, browser.name), { recursive: true });
|
|
71
|
-
fs.writeFileSync(
|
|
72
|
-
path.join(outputDir, browser.name, `${Date.now()}.json`),
|
|
73
|
-
JSON.stringify(browserRenders, null, 2),
|
|
74
|
-
);
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
KarmaReporterReactProfiler.$inject = ['config'];
|
|
79
|
-
|
|
80
|
-
module.exports = {
|
|
81
|
-
'reporter:profiler': ['type', KarmaReporterReactProfiler],
|
|
82
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/prefer-default-export */
|
|
2
|
-
import 'chai';
|
|
3
|
-
import type { AssertionError as RealAssertionError } from 'assertion-error';
|
|
4
|
-
|
|
5
|
-
declare module 'chai' {
|
|
6
|
-
// Looks like they forgot to export the AssertionError type in @types/chai
|
|
7
|
-
export const AssertionError: typeof RealAssertionError;
|
|
8
|
-
}
|