@clary-so/measure 0.4.2
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/.postcssrc +5 -0
- package/CHANGELOG.md +81 -0
- package/LICENSE +21 -0
- package/dist/__tests__/measure.test.d.ts +1 -0
- package/dist/__tests__/measure.test.js +152 -0
- package/dist/__tests__/measure.test.js.map +1 -0
- package/dist/__tests__/server/ServerApp.test.d.ts +1 -0
- package/dist/__tests__/server/ServerApp.test.js +49 -0
- package/dist/__tests__/server/ServerApp.test.js.map +1 -0
- package/dist/__tests__/utils/removeCLIColors.d.ts +1 -0
- package/dist/__tests__/utils/removeCLIColors.js +10 -0
- package/dist/__tests__/utils/removeCLIColors.js.map +1 -0
- package/dist/__tests__/webapp/socket.test.d.ts +1 -0
- package/dist/__tests__/webapp/socket.test.js +73 -0
- package/dist/__tests__/webapp/socket.test.js.map +1 -0
- package/dist/common/useLogSocketEvents.d.ts +3 -0
- package/dist/common/useLogSocketEvents.js +18 -0
- package/dist/common/useLogSocketEvents.js.map +1 -0
- package/dist/index.87c99d25.js +88 -0
- package/dist/index.87c99d25.js.map +1 -0
- package/dist/index.html +1 -0
- package/dist/server/ServerApp.d.ts +10 -0
- package/dist/server/ServerApp.js +131 -0
- package/dist/server/ServerApp.js.map +1 -0
- package/dist/server/ServerSocketConnectionApp.d.ts +6 -0
- package/dist/server/ServerSocketConnectionApp.js +105 -0
- package/dist/server/ServerSocketConnectionApp.js.map +1 -0
- package/dist/server/bin.d.ts +2 -0
- package/dist/server/bin.js +63 -0
- package/dist/server/bin.js.map +1 -0
- package/dist/server/components/HostAndPortInfo.d.ts +4 -0
- package/dist/server/components/HostAndPortInfo.js +14 -0
- package/dist/server/components/HostAndPortInfo.js.map +1 -0
- package/dist/server/constants.d.ts +2 -0
- package/dist/server/constants.js +12 -0
- package/dist/server/constants.js.map +1 -0
- package/dist/server/socket/socketInterface.d.ts +37 -0
- package/dist/server/socket/socketInterface.js +17 -0
- package/dist/server/socket/socketInterface.js.map +1 -0
- package/dist/server/socket/socketState.d.ts +5 -0
- package/dist/server/socket/socketState.js +47 -0
- package/dist/server/socket/socketState.js.map +1 -0
- package/dist/server/useBundleIdControls.d.ts +2 -0
- package/dist/server/useBundleIdControls.js +33 -0
- package/dist/server/useBundleIdControls.js.map +1 -0
- package/dist/webapp/MeasureWebApp.d.ts +2 -0
- package/dist/webapp/MeasureWebApp.js +29 -0
- package/dist/webapp/MeasureWebApp.js.map +1 -0
- package/dist/webapp/components/AppBar.d.ts +4 -0
- package/dist/webapp/components/AppBar.js +19 -0
- package/dist/webapp/components/AppBar.js.map +1 -0
- package/dist/webapp/components/BundleIdSelector.d.ts +6 -0
- package/dist/webapp/components/BundleIdSelector.js +20 -0
- package/dist/webapp/components/BundleIdSelector.js.map +1 -0
- package/dist/webapp/components/SocketState.d.ts +2 -0
- package/dist/webapp/components/SocketState.js +95 -0
- package/dist/webapp/components/SocketState.js.map +1 -0
- package/dist/webapp/components/StartButton.d.ts +6 -0
- package/dist/webapp/components/StartButton.js +12 -0
- package/dist/webapp/components/StartButton.js.map +1 -0
- package/dist/webapp/components/TextField.d.ts +5 -0
- package/dist/webapp/components/TextField.js +81 -0
- package/dist/webapp/components/TextField.js.map +1 -0
- package/dist/webapp/socket.d.ts +3 -0
- package/dist/webapp/socket.js +8 -0
- package/dist/webapp/socket.js.map +1 -0
- package/dist/webapp/useMeasures.d.ts +10 -0
- package/dist/webapp/useMeasures.js +38 -0
- package/dist/webapp/useMeasures.js.map +1 -0
- package/package.json +48 -0
- package/src/__tests__/__snapshots__/measure.test.tsx.snap +4389 -0
- package/src/__tests__/measure.test.tsx +141 -0
- package/src/__tests__/server/ServerApp.test.ts +49 -0
- package/src/__tests__/utils/removeCLIColors.ts +5 -0
- package/src/__tests__/webapp/socket.test.ts +37 -0
- package/src/common/types/index.d.ts +3 -0
- package/src/common/useLogSocketEvents.ts +17 -0
- package/src/server/ServerApp.tsx +103 -0
- package/src/server/ServerSocketConnectionApp.tsx +82 -0
- package/src/server/bin.tsx +23 -0
- package/src/server/components/HostAndPortInfo.tsx +11 -0
- package/src/server/constants.ts +8 -0
- package/src/server/socket/socketInterface.ts +53 -0
- package/src/server/socket/socketState.ts +66 -0
- package/src/server/useBundleIdControls.ts +38 -0
- package/src/webapp/MeasureWebApp.tsx +43 -0
- package/src/webapp/components/AppBar.tsx +19 -0
- package/src/webapp/components/BundleIdSelector.tsx +26 -0
- package/src/webapp/components/SocketState.tsx +79 -0
- package/src/webapp/components/StartButton.tsx +22 -0
- package/src/webapp/components/TextField.tsx +54 -0
- package/src/webapp/globals.d.ts +9 -0
- package/src/webapp/index.html +30 -0
- package/src/webapp/index.js +9 -0
- package/src/webapp/socket.ts +12 -0
- package/src/webapp/useMeasures.ts +36 -0
- package/tailwind.config.js +7 -0
- package/tsconfig.json +8 -0
- package/tsconfig.tsbuildinfo +1 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## [0.4.2](https://github.com/bamlab/flashlight/compare/@perf-profiler/measure@0.4.1...@perf-profiler/measure@0.4.2) (2024-07-17)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @perf-profiler/measure
|
|
9
|
+
|
|
10
|
+
## [0.4.1](https://github.com/bamlab/flashlight/compare/@perf-profiler/measure@0.4.0...@perf-profiler/measure@0.4.1) (2024-06-28)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @perf-profiler/measure
|
|
13
|
+
|
|
14
|
+
# [0.4.0](https://github.com/bamlab/flashlight/compare/@perf-profiler/measure@0.3.0...@perf-profiler/measure@0.4.0) (2024-06-04)
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
- **cli:** improve cli performance a little bit ([#269](https://github.com/bamlab/flashlight/issues/269)) ([f646064](https://github.com/bamlab/flashlight/commit/f646064f58fbde5cb028628dab8ac1d4e96bc2e2))
|
|
19
|
+
- **deps:** update material-ui monorepo to v5.15.13 ([#242](https://github.com/bamlab/flashlight/issues/242)) ([cb4f91f](https://github.com/bamlab/flashlight/commit/cb4f91f9c38126dd4e887a54fac22f61e8d8f53a))
|
|
20
|
+
- **deps:** update react monorepo to v18 ([#215](https://github.com/bamlab/flashlight/issues/215)) ([d84fe11](https://github.com/bamlab/flashlight/commit/d84fe11944c58aac1ab69d55519f1b3b69c65ad0))
|
|
21
|
+
- **report:** remove video annotation if no videos ([#235](https://github.com/bamlab/flashlight/issues/235)) ([93c3b99](https://github.com/bamlab/flashlight/commit/93c3b99c3d671e99d1f24c8fcfe75514fb3dbace))
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
- **report:** make RN and Flutter threads stand out nicely ([#205](https://github.com/bamlab/flashlight/issues/205)) ([0e99a27](https://github.com/bamlab/flashlight/commit/0e99a2780c00fad342b2a13189a2adee51e5dd9c))
|
|
26
|
+
|
|
27
|
+
# [0.3.0](https://github.com/bamlab/flashlight/compare/@perf-profiler/measure@0.2.7...@perf-profiler/measure@0.3.0) (2024-03-01)
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
- **measure:** fix port option ([#192](https://github.com/bamlab/flashlight/issues/192)) ([1d8585f](https://github.com/bamlab/flashlight/commit/1d8585f099b91c944c6ea2741e7ca8ad9598c3b1))
|
|
32
|
+
- **measure:** UI buttons unresponsive/streamline socket URL handling ([#191](https://github.com/bamlab/flashlight/issues/191)) ([66b0899](https://github.com/bamlab/flashlight/commit/66b0899080ac3f7c4165db5925fb395396d0af7d))
|
|
33
|
+
- **report:** allow horizontal scrolling in threads table ([#168](https://github.com/bamlab/flashlight/issues/168)) ([0136567](https://github.com/bamlab/flashlight/commit/0136567f5baa2d7fe0365e9d01d174753c121a81))
|
|
34
|
+
- **report:** fix thread autoselection ([#169](https://github.com/bamlab/flashlight/issues/169)) ([eb28d01](https://github.com/bamlab/flashlight/commit/eb28d01af2dbb71afc08e3e7963b744486a370a6))
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
- **measure:** add optional --port flag to specify server port ([#186](https://github.com/bamlab/flashlight/issues/186)) ([1a44141](https://github.com/bamlab/flashlight/commit/1a441419a77d4157db6ebc793a45d2bb653d14fd))
|
|
39
|
+
- **report:** add difference in comparison view ([#163](https://github.com/bamlab/flashlight/issues/163)) ([#164](https://github.com/bamlab/flashlight/issues/164)) ([ac4c3bf](https://github.com/bamlab/flashlight/commit/ac4c3bfff5a28cf458fe128b67e007b53f0ae97b))
|
|
40
|
+
|
|
41
|
+
## [0.2.7](https://github.com/bamlab/android-performance-profiler/compare/@perf-profiler/measure@0.2.6...@perf-profiler/measure@0.2.7) (2023-09-14)
|
|
42
|
+
|
|
43
|
+
**Note:** Version bump only for package @perf-profiler/measure
|
|
44
|
+
|
|
45
|
+
## [0.2.6](https://github.com/bamlab/android-performance-profiler/compare/@perf-profiler/measure@0.2.5...@perf-profiler/measure@0.2.6) (2023-08-18)
|
|
46
|
+
|
|
47
|
+
**Note:** Version bump only for package @perf-profiler/measure
|
|
48
|
+
|
|
49
|
+
## [0.2.5](https://github.com/bamlab/android-performance-profiler/compare/@perf-profiler/measure@0.2.4...@perf-profiler/measure@0.2.5) (2023-07-31)
|
|
50
|
+
|
|
51
|
+
**Note:** Version bump only for package @perf-profiler/measure
|
|
52
|
+
|
|
53
|
+
## [0.2.4](https://github.com/bamlab/android-performance-profiler/compare/@perf-profiler/measure@0.2.3...@perf-profiler/measure@0.2.4) (2023-07-31)
|
|
54
|
+
|
|
55
|
+
**Note:** Version bump only for package @perf-profiler/measure
|
|
56
|
+
|
|
57
|
+
## [0.2.3](https://github.com/bamlab/android-performance-profiler/compare/@perf-profiler/measure@0.2.2...@perf-profiler/measure@0.2.3) (2023-07-31)
|
|
58
|
+
|
|
59
|
+
### Bug Fixes
|
|
60
|
+
|
|
61
|
+
- **profiler:** improve accuracy of CPU measures ([#140](https://github.com/bamlab/android-performance-profiler/issues/140)) ([5038cb7](https://github.com/bamlab/android-performance-profiler/commit/5038cb7704a551ca70ab67e1726bb6321d7f63b1))
|
|
62
|
+
|
|
63
|
+
## [0.2.2](https://github.com/bamlab/android-performance-profiler/compare/@perf-profiler/measure@0.2.1...@perf-profiler/measure@0.2.2) (2023-07-12)
|
|
64
|
+
|
|
65
|
+
**Note:** Version bump only for package @perf-profiler/measure
|
|
66
|
+
|
|
67
|
+
## [0.2.1](https://github.com/bamlab/android-performance-profiler/compare/@perf-profiler/measure@0.2.0...@perf-profiler/measure@0.2.1) (2023-07-12)
|
|
68
|
+
|
|
69
|
+
### Bug Fixes
|
|
70
|
+
|
|
71
|
+
- **profiler:** no such file /proc/{pid}/task ([#117](https://github.com/bamlab/android-performance-profiler/issues/117)) ([a3db43f](https://github.com/bamlab/android-performance-profiler/commit/a3db43f60beac4569dc7e96753497f26f7f8e605))
|
|
72
|
+
|
|
73
|
+
# 0.2.0 (2023-06-28)
|
|
74
|
+
|
|
75
|
+
### Bug Fixes
|
|
76
|
+
|
|
77
|
+
- **measure:** ensure we have only one socket connection between web and cli ([#130](https://github.com/bamlab/android-performance-profiler/issues/130)) ([4b59cd1](https://github.com/bamlab/android-performance-profiler/commit/4b59cd151bac7e04f050bb9410938bcfb233c088))
|
|
78
|
+
|
|
79
|
+
### Features
|
|
80
|
+
|
|
81
|
+
- **measure:** measure in webapp without need for flipper ([#121](https://github.com/bamlab/android-performance-profiler/issues/121)) ([6f68b55](https://github.com/bamlab/android-performance-profiler/commit/6f68b55cfaccfd18273bec96a06e9fd38d9edc5d))
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 BAM
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@clary-so/e2e/src/utils/test/mockChildProcess";
|
|
@@ -0,0 +1,152 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
require("@clary-so/e2e/src/utils/test/mockChildProcess");
|
|
49
|
+
const mockEmitMeasures_1 = require("@clary-so/e2e/src/utils/test/mockEmitMeasures");
|
|
50
|
+
const react_1 = require("@testing-library/react");
|
|
51
|
+
const ink_testing_library_1 = require("ink-testing-library");
|
|
52
|
+
const react_2 = __importDefault(require("react"));
|
|
53
|
+
const ServerApp_1 = require("../server/ServerApp");
|
|
54
|
+
const shell_1 = require("@clary-so/shell");
|
|
55
|
+
const testUtils_1 = require("@clary-so/web-reporter-ui/utils/testUtils");
|
|
56
|
+
const removeCLIColors_1 = require("./utils/removeCLIColors");
|
|
57
|
+
const logger_1 = require("@clary-so/logger");
|
|
58
|
+
const constants_1 = require("../server/constants");
|
|
59
|
+
jest.mock("@clary-so/shell", () => ({
|
|
60
|
+
open: jest.fn(),
|
|
61
|
+
}));
|
|
62
|
+
Math.random = () => 0.5;
|
|
63
|
+
// Set me to LogLevel.DEBUG to see the debug logs
|
|
64
|
+
logger_1.Logger.setLogLevel(logger_1.LogLevel.SILENT);
|
|
65
|
+
let originalWindow;
|
|
66
|
+
let MeasureWebApp;
|
|
67
|
+
describe("flashlight measure interactive", () => {
|
|
68
|
+
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
69
|
+
originalWindow = global.window;
|
|
70
|
+
global.window = Object.create(window);
|
|
71
|
+
Object.defineProperty(window, "__FLASHLIGHT_DATA__", {
|
|
72
|
+
value: { socketServerUrl: `http://localhost:${constants_1.DEFAULT_PORT}` },
|
|
73
|
+
writable: true,
|
|
74
|
+
});
|
|
75
|
+
MeasureWebApp = (yield Promise.resolve().then(() => __importStar(require("../webapp/MeasureWebApp")))).MeasureWebApp;
|
|
76
|
+
}));
|
|
77
|
+
afterAll(() => {
|
|
78
|
+
global.window = originalWindow;
|
|
79
|
+
});
|
|
80
|
+
const expectWebAppToBeOpened = () => (0, react_1.waitFor)(() => expect(shell_1.open).toHaveBeenCalledWith(`http://localhost:${constants_1.DEFAULT_PORT}`));
|
|
81
|
+
const setupCli = (customPort = constants_1.DEFAULT_PORT) => {
|
|
82
|
+
const { lastFrame, unmount } = (0, ink_testing_library_1.render)(react_2.default.createElement(ServerApp_1.ServerApp, { port: customPort }));
|
|
83
|
+
const closeCli = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
84
|
+
unmount();
|
|
85
|
+
// Seems like we need to wait for the useEffect cleanup to happen
|
|
86
|
+
yield new Promise((resolve) => setTimeout(resolve, 0));
|
|
87
|
+
});
|
|
88
|
+
return {
|
|
89
|
+
closeCli,
|
|
90
|
+
expectCliOutput: () => expect((0, removeCLIColors_1.removeCLIColors)(lastFrame())),
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
const setupWebApp = () => {
|
|
94
|
+
const view = (0, react_1.render)(react_2.default.createElement(MeasureWebApp, null));
|
|
95
|
+
return {
|
|
96
|
+
closeWebApp: view.unmount,
|
|
97
|
+
expectWebAppToMatchSnapshot: (snapshotName) => (0, testUtils_1.matchSnapshot)(view, snapshotName),
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
test("it displays measures", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
101
|
+
const { closeCli, expectCliOutput } = setupCli();
|
|
102
|
+
const { closeWebApp, expectWebAppToMatchSnapshot } = setupWebApp();
|
|
103
|
+
yield expectWebAppToBeOpened();
|
|
104
|
+
expectCliOutput().toMatchInlineSnapshot(`
|
|
105
|
+
"
|
|
106
|
+
Flashlight web app running on: http://localhost:${constants_1.DEFAULT_PORT}
|
|
107
|
+
"
|
|
108
|
+
`);
|
|
109
|
+
// Autodetect app id com.example
|
|
110
|
+
yield react_1.screen.findByText("Auto-Detect");
|
|
111
|
+
react_1.fireEvent.click(react_1.screen.getByText("Auto-Detect"));
|
|
112
|
+
yield react_1.screen.findByDisplayValue("com.example");
|
|
113
|
+
// Start measuring
|
|
114
|
+
react_1.fireEvent.click(react_1.screen.getByText("Start Measuring"));
|
|
115
|
+
// Initial report screen with no measures
|
|
116
|
+
yield react_1.screen.findByText("Average Test Runtime");
|
|
117
|
+
expectWebAppToMatchSnapshot("Web app with no measures yet");
|
|
118
|
+
// Simulate measures being emitted on the device
|
|
119
|
+
(0, react_1.act)(() => (0, mockEmitMeasures_1.emitMeasures)());
|
|
120
|
+
// We should now see 1000ms of measures: 3 measures at 0/500/1000ms
|
|
121
|
+
yield react_1.screen.findByText("1000 ms");
|
|
122
|
+
// Find the score!
|
|
123
|
+
react_1.screen.getByText("47");
|
|
124
|
+
// expand threads
|
|
125
|
+
yield react_1.screen.findByText("Other threads");
|
|
126
|
+
react_1.fireEvent.click(react_1.screen.getByText("Other threads"));
|
|
127
|
+
expectWebAppToMatchSnapshot("Web app with measures and threads opened");
|
|
128
|
+
// Stop measuring
|
|
129
|
+
react_1.fireEvent.click(react_1.screen.getByText("Stop Measuring"));
|
|
130
|
+
yield (0, react_1.waitFor)(() => expect(mockEmitMeasures_1.aTraceMock.kill).toHaveBeenCalled());
|
|
131
|
+
yield (0, react_1.waitFor)(() => expect(mockEmitMeasures_1.perfProfilerMock.kill).toHaveBeenCalled());
|
|
132
|
+
// Close apps
|
|
133
|
+
yield closeCli();
|
|
134
|
+
closeWebApp();
|
|
135
|
+
}));
|
|
136
|
+
test("it handles the --port flag correctly", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
137
|
+
const customPort = 1001;
|
|
138
|
+
const { closeCli, expectCliOutput } = setupCli(customPort);
|
|
139
|
+
const { closeWebApp } = setupWebApp();
|
|
140
|
+
const expectWebAppToBeOpenedOnCustomPort = () => (0, react_1.waitFor)(() => expect(shell_1.open).toHaveBeenCalledWith(`http://localhost:${customPort}`));
|
|
141
|
+
yield expectWebAppToBeOpenedOnCustomPort();
|
|
142
|
+
expectCliOutput().toMatchInlineSnapshot(`
|
|
143
|
+
"
|
|
144
|
+
Flashlight web app running on: http://localhost:${customPort}
|
|
145
|
+
"
|
|
146
|
+
`);
|
|
147
|
+
// Close apps
|
|
148
|
+
yield closeCli();
|
|
149
|
+
closeWebApp();
|
|
150
|
+
}));
|
|
151
|
+
});
|
|
152
|
+
//# sourceMappingURL=measure.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measure.test.js","sourceRoot":"","sources":["../../src/__tests__/measure.test.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const supertest_1 = __importDefault(require("supertest"));
|
|
16
|
+
const express_1 = __importDefault(require("express"));
|
|
17
|
+
const fs_1 = __importDefault(require("fs"));
|
|
18
|
+
const ServerApp_1 = require("../../server/ServerApp");
|
|
19
|
+
jest.mock("fs", () => ({
|
|
20
|
+
promises: {
|
|
21
|
+
readFile: jest.fn(),
|
|
22
|
+
},
|
|
23
|
+
}));
|
|
24
|
+
describe("ServerApp", () => {
|
|
25
|
+
let app;
|
|
26
|
+
beforeAll(() => {
|
|
27
|
+
jest.spyOn(express_1.default, "static").mockImplementation(() => (req, res, next) => next());
|
|
28
|
+
});
|
|
29
|
+
const FLASHLIGHT_DATA_PLACEHOLDER = 'window.__FLASHLIGHT_DATA__ = { socketServerUrl: "http://localhost:4000" };';
|
|
30
|
+
beforeEach(() => {
|
|
31
|
+
fs_1.default.promises.readFile.mockResolvedValue(`<html><script>${FLASHLIGHT_DATA_PLACEHOLDER}</script></html>`);
|
|
32
|
+
app = (0, ServerApp_1.createExpressApp)({
|
|
33
|
+
port: 9999,
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
describe("GET /", () => {
|
|
37
|
+
it("injects FlashlightData into index.html", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
+
const response = yield (0, supertest_1.default)(app).get("/");
|
|
39
|
+
expect(response.statusCode).toBe(200);
|
|
40
|
+
expect(response.text).toContain(`window.__FLASHLIGHT_DATA__ = { socketServerUrl: "http://localhost:9999" };`);
|
|
41
|
+
}));
|
|
42
|
+
});
|
|
43
|
+
test("index.html contains the FlashlightData placeholder", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
44
|
+
const fsPromises = jest.requireActual("fs").promises;
|
|
45
|
+
const fileContent = yield fsPromises.readFile(`${__dirname}/../../webapp/index.html`, "utf8");
|
|
46
|
+
expect(fileContent).toContain(FLASHLIGHT_DATA_PLACEHOLDER);
|
|
47
|
+
}));
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=ServerApp.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServerApp.test.js","sourceRoot":"","sources":["../../../src/__tests__/server/ServerApp.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,0DAAkC;AAClC,sDAA8B;AAC9B,4CAAoB;AAEpB,sDAA0D;AAE1D,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;IACrB,QAAQ,EAAE;QACR,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE;KACpB;CACF,CAAC,CAAC,CAAC;AAEJ,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,IAAI,GAAoB,CAAC;IAEzB,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,KAAK,CAAC,iBAAO,EAAE,QAAQ,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;IACrF,CAAC,CAAC,CAAC;IAEH,MAAM,2BAA2B,GAC/B,4EAA4E,CAAC;IAE/E,UAAU,CAAC,GAAG,EAAE;QACb,YAAE,CAAC,QAAQ,CAAC,QAAsB,CAAC,iBAAiB,CACnD,iBAAiB,2BAA2B,kBAAkB,CAC/D,CAAC;QAEF,GAAG,GAAG,IAAA,4BAAgB,EAAC;YACrB,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;QACrB,EAAE,CAAC,wCAAwC,EAAE,GAAS,EAAE;YACtD,MAAM,QAAQ,GAAG,MAAM,IAAA,mBAAS,EAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAE/C,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACtC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,SAAS,CAC7B,4EAA4E,CAC7E,CAAC;QACJ,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,oDAAoD,EAAE,GAAS,EAAE;QACpE,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;QACrD,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC,GAAG,SAAS,0BAA0B,EAAE,MAAM,CAAC,CAAC;QAC9F,MAAM,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;IAC7D,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const removeCLIColors: (str?: string) => string | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeCLIColors = void 0;
|
|
4
|
+
// from https://stackoverflow.com/questions/17998978/removing-colors-from-output
|
|
5
|
+
// Remove colors so that snapshots are not polluted
|
|
6
|
+
const removeCLIColors = (str) =>
|
|
7
|
+
// eslint-disable-next-line no-control-regex
|
|
8
|
+
str === null || str === void 0 ? void 0 : str.replace(/\x1B\[([0-9]{1,3}(;[0-9]{1,2};?)?)?[mGK]/g, "");
|
|
9
|
+
exports.removeCLIColors = removeCLIColors;
|
|
10
|
+
//# sourceMappingURL=removeCLIColors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeCLIColors.js","sourceRoot":"","sources":["../../../src/__tests__/utils/removeCLIColors.ts"],"names":[],"mappings":";;;AAAA,gFAAgF;AAChF,mDAAmD;AAC5C,MAAM,eAAe,GAAG,CAAC,GAAY,EAAE,EAAE;AAC9C,4CAA4C;AAC5C,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,CAAC,2CAA2C,EAAE,EAAE,CAAC,CAAC;AAFnD,QAAA,eAAe,mBAEoC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
const socket_io_client_1 = require("socket.io-client");
|
|
46
|
+
jest.mock("socket.io-client", () => {
|
|
47
|
+
return Object.assign(Object.assign({}, jest.requireActual("socket.io-client")), { io: jest.fn().mockImplementation(() => {
|
|
48
|
+
return {
|
|
49
|
+
on: jest.fn(),
|
|
50
|
+
close: jest.fn(),
|
|
51
|
+
};
|
|
52
|
+
}) });
|
|
53
|
+
});
|
|
54
|
+
let originalWindow;
|
|
55
|
+
describe("socket", () => {
|
|
56
|
+
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
|
+
originalWindow = global.window;
|
|
58
|
+
global.window = Object.create(window);
|
|
59
|
+
Object.defineProperty(window, "__FLASHLIGHT_DATA__", {
|
|
60
|
+
value: { socketServerUrl: "http://localhost:9999" },
|
|
61
|
+
writable: true,
|
|
62
|
+
});
|
|
63
|
+
}));
|
|
64
|
+
afterAll(() => {
|
|
65
|
+
// Restore the original window object
|
|
66
|
+
global.window = originalWindow;
|
|
67
|
+
});
|
|
68
|
+
it("sets the expected socket server URL", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
69
|
+
yield Promise.resolve().then(() => __importStar(require("../../webapp/socket")));
|
|
70
|
+
expect(socket_io_client_1.io).toHaveBeenCalledWith("http://localhost:9999");
|
|
71
|
+
}));
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=socket.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socket.test.js","sourceRoot":"","sources":["../../../src/__tests__/webapp/socket.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAsC;AAEtC,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,GAAG,EAAE;IACjC,uCACK,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,KACzC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE;YACpC,OAAO;gBACL,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE;gBACb,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE;aACjB,CAAC;QACJ,CAAC,CAAC,IACF;AACJ,CAAC,CAAC,CAAC;AAEH,IAAI,cAA0C,CAAC;AAE/C,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,SAAS,CAAC,GAAS,EAAE;QACnB,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;QAE/B,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACtC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,qBAAqB,EAAE;YACnD,KAAK,EAAE,EAAE,eAAe,EAAE,uBAAuB,EAAE;YACnD,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;IACL,CAAC,CAAA,CAAC,CAAC;IAEH,QAAQ,CAAC,GAAG,EAAE;QACZ,qCAAqC;QACrC,MAAM,CAAC,MAAM,GAAG,cAAc,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE,GAAS,EAAE;QACnD,wDAAa,qBAAqB,GAAC,CAAC;QACpC,MAAM,CAAC,qBAAE,CAAC,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,CAAC;IAC3D,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLogSocketEvents = void 0;
|
|
4
|
+
const logger_1 = require("@clary-so/logger");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const useLogSocketEvents = (socket) => {
|
|
7
|
+
(0, react_1.useEffect)(() => {
|
|
8
|
+
function onSocketEvent(event, ...args) {
|
|
9
|
+
logger_1.Logger.debug(`Received socket event: ${event} with ${JSON.stringify(args)}`);
|
|
10
|
+
}
|
|
11
|
+
socket.onAny(onSocketEvent);
|
|
12
|
+
return () => {
|
|
13
|
+
socket.offAny(onSocketEvent);
|
|
14
|
+
};
|
|
15
|
+
}, [socket]);
|
|
16
|
+
};
|
|
17
|
+
exports.useLogSocketEvents = useLogSocketEvents;
|
|
18
|
+
//# sourceMappingURL=useLogSocketEvents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLogSocketEvents.js","sourceRoot":"","sources":["../../src/common/useLogSocketEvents.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAC1C,iCAAkC;AAI3B,MAAM,kBAAkB,GAAG,CAAC,MAA6B,EAAE,EAAE;IAClE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,SAAS,aAAa,CAAC,KAAa,EAAE,GAAG,IAAe;YACtD,eAAM,CAAC,KAAK,CAAC,0BAA0B,KAAK,SAAS,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/E,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAE5B,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAC/B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AACf,CAAC,CAAC;AAXW,QAAA,kBAAkB,sBAW7B"}
|