Skip to content

Commit aea3714

Browse files
committed
fix: failing tests + config service stub
1 parent 011b02b commit aea3714

File tree

7 files changed

+186
-85
lines changed

7 files changed

+186
-85
lines changed

lib/controllers/prepare-controller.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class PrepareController extends EventEmitter {
5858
const platformLowerCase = platform.toLowerCase();
5959

6060
if (this.watchersData && this.watchersData[projectDir] && this.watchersData[projectDir][platformLowerCase] && this.watchersData[projectDir][platformLowerCase].nativeFilesWatcher) {
61-
this.watchersData[projectDir][platformLowerCase].nativeFilesWatcher.close();
61+
await this.watchersData[projectDir][platformLowerCase].nativeFilesWatcher.close();
6262
this.watchersData[projectDir][platformLowerCase].nativeFilesWatcher = null;
6363
}
6464

@@ -73,7 +73,7 @@ export class PrepareController extends EventEmitter {
7373
@hook("prepare")
7474
private async prepareCore(prepareData: IPrepareData, projectData: IProjectData): Promise<IPrepareResultData> {
7575
await this.$platformController.addPlatformIfNeeded(prepareData);
76-
76+
7777
this.$logger.info("Preparing project...");
7878
let result = null;
7979

lib/definitions/project.d.ts

+25-25
Original file line numberDiff line numberDiff line change
@@ -77,58 +77,58 @@ interface IProjectService {
7777
}
7878

7979
interface INsConfigPlaform {
80-
id?: string;
80+
id?: string;
8181
}
8282

8383
interface INsConfigIOS extends INsConfigPlaform {
84-
discardUncaughtJsExceptions?: boolean;
84+
discardUncaughtJsExceptions?: boolean;
8585
}
8686

8787
interface INsConfigAndroid extends INsConfigPlaform {
88-
v8Flags?: string;
88+
v8Flags?: string;
8989

90-
codeCache?: boolean;
90+
codeCache?: boolean;
9191

92-
heapSnapshotScript?: string;
92+
heapSnapshotScript?: string;
9393

94-
"snapshot.blob"?: string;
94+
"snapshot.blob"?: string;
9595

96-
profilerOutputDir?: string;
96+
profilerOutputDir?: string;
9797

98-
gcThrottleTime?: number;
98+
gcThrottleTime?: number;
9999

100-
profiling?: string;
100+
profiling?: string;
101101

102-
markingMode?: string;
102+
markingMode?: string;
103103

104-
handleTimeZoneChanges?: boolean;
104+
handleTimeZoneChanges?: boolean;
105105

106-
maxLogcatObjectSize?: number;
106+
maxLogcatObjectSize?: number;
107107

108-
forceLog?: boolean;
108+
forceLog?: boolean;
109109

110-
memoryCheckInterval?: number;
110+
memoryCheckInterval?: number;
111111

112-
freeMemoryRatio?: number;
112+
freeMemoryRatio?: number;
113113

114-
suppressCallJSMethodExceptions?: boolean;
114+
suppressCallJSMethodExceptions?: boolean;
115115

116-
discardUncaughtJsExceptions?: boolean;
116+
discardUncaughtJsExceptions?: boolean;
117117

118-
enableLineBreakpoints?: boolean;
118+
enableLineBreakpoints?: boolean;
119119
}
120120

121121
interface INsConfig {
122-
id?: string;
123-
main?: string;
122+
id?: string;
123+
main?: string;
124124
appPath?: string;
125125
appResourcesPath?: string;
126126
shared?: boolean;
127127
previewAppSchema?: string;
128128
overridePods?: string;
129-
webpackConfigPath?: string;
130-
ios?: INsConfigIOS;
131-
android?: INsConfigAndroid;
129+
webpackConfigPath?: string;
130+
ios?: INsConfigIOS;
131+
android?: INsConfigAndroid;
132132
}
133133

134134
interface IProjectData extends ICreateProjectData {
@@ -140,8 +140,8 @@ interface IProjectData extends ICreateProjectData {
140140
devDependencies: IStringDictionary;
141141
appDirectoryPath: string;
142142
appResourcesDirectoryPath: string;
143-
projectType: string;
144-
packageJsonData: any;
143+
projectType: string;
144+
packageJsonData: any;
145145
nsConfig: INsConfig;
146146
androidManifestPath: string;
147147
appGradlePath: string;

lib/services/log-source-map-service.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,19 @@ export class LogSourceMapService implements Mobile.ILogSourceMapService {
5353
if (!this.$fs.getFsStats(filePath).isDirectory()) {
5454
const source = this.$fs.readText(filePath);
5555
const sourceMapRaw = sourceMapConverter.fromSource(source);
56-
let smc: any = null;
56+
let smc: any = null;
5757
if (sourceMapRaw && sourceMapRaw.sourcemap) {
5858
const sourceMap = sourceMapRaw.sourcemap;
5959
smc = await sourcemap.SourceMapConsumer.with(sourceMap, null, (c) => {
60-
return c;
61-
});
62-
}
60+
return c;
61+
});
62+
}
6363

6464
this.cache[filePath] = smc;
6565
}
6666
} catch (err) {
6767
this.$logger.trace(`Unable to set sourceMapConsumer for file ${filePath}. Error is: ${err}`);
6868
}
69-
7069
}
7170

7271
public replaceWithOriginalFileLocations(platform: string, messageData: string, loggingOptions: Mobile.IDeviceLogOptions): string {

npm-shrinkwrap.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/controllers/prepare-controller.ts

+4-11
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ import { assert } from "chai";
22
import * as _ from 'lodash';
33
import { PrepareController } from "../../lib/controllers/prepare-controller";
44
import { MobileHelper } from "../../lib/common/mobile/mobile-helper";
5-
import { InjectorStub, TempServiceStub, FileSystemStub, ProjectDataStub } from "../stubs";
5+
import { InjectorStub, TempServiceStub } from "../stubs";
66
import { PREPARE_READY_EVENT_NAME } from "../../lib/constants";
77
import { IInjector } from "../../lib/common/definitions/yok";
8-
import { ProjectConfigService } from "../../lib/services/project-config-service";
98

10-
const projectDir = "/path/to/my/projecDir";
9+
const projectDir = "/path/to/my/projectDir";
1110
const prepareData = {
1211
projectDir,
1312
release: false,
@@ -48,14 +47,8 @@ function createTestInjector(data: { hasNativeChanges: boolean }): IInjector {
4847
}
4948
}));
5049

51-
injector.register("mobileHelper", MobileHelper);
52-
injector.register("fs", FileSystemStub);
53-
const projectData = new ProjectDataStub();
54-
projectData.projectName = 'test'
55-
injector.register("projectData", projectData);
56-
57-
injector.register("prepareController", PrepareController);
58-
injector.register("projectConfigService", ProjectConfigService)
50+
injector.register("mobileHelper", MobileHelper);
51+
injector.register("prepareController", PrepareController);
5952

6053
injector.register("nodeModulesDependenciesBuilder", {
6154
getProductionDependencies: () => (<any>[])

test/services/log-source-map-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function createTestInjector(): IInjector {
2626
projectDir: "projectDir"
2727
};
2828
},
29-
getNSValue: (projectDir: string, propertyName: string): any => {
29+
getRuntimePackage: (projectDir: string, platform: any): any => {
3030
return {
3131
version: runtimeVersion
3232
};

0 commit comments

Comments
 (0)