Skip to content

Commit

Permalink
chore: fixes after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillzyusko committed Jun 24, 2024
1 parent eda73ca commit f178843
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions tests/e2e/testRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import installApp from './utils/installApp';
import killApp from './utils/killApp';
import launchApp from './utils/launchApp';
import * as Logger from './utils/logger';
import {start, stop} from './utils/measure';
import * as MeasureUtils from './utils/measure';
import sleep from './utils/sleep';
import withFailTimeout from './utils/withFailTimeout';

Expand Down Expand Up @@ -144,13 +144,13 @@ const runTests = async (): Promise<void> => {
Logger.log('Launching', appPackage);
await launchApp('android', appPackage, config.ACTIVITY_PATH, launchArgs);

start(appPackage);
MeasureUtils.start(appPackage);
await withFailTimeout(
new Promise<void>((resolve) => {
const subscription = server.addTestDoneListener(() => {
const removeListener = server.addTestDoneListener(() => {
Logger.success(iterationText);

const metrics = stop();
const metrics = MeasureUtils.stop();
const test = server.getTestConfig();

if (server.isReadyToAcceptTestResults) {
Expand All @@ -170,7 +170,7 @@ const runTests = async (): Promise<void> => {
duration: metrics.ram,
});
}
subscription();
removeListener();
resolve();
});
}),
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/utils/measure.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import {profiler} from '@perf-profiler/profiler';
import {getAverageCpuUsage, getAverageFPSUsage, getAverageRAMUsage} from '@perf-profiler/reporter';
import type {Measure} from '@perf-profiler/types';
import noop from 'lodash/noop';

let measures: Measure[] = [];
let polling = {
stop: noop,
stop: (): void => {
throw new Error('Cannot stop polling on a stopped profiler');
},
};

const start = (bundleId: string) => {
Expand Down

0 comments on commit f178843

Please sign in to comment.