ionic-native-mocks
ionic-native-mocks copied to clipboard
Is ready for v4?
Hi everyone is "ionic-native-mocks" ready for v4??
I am working on updating them to work with Ionic 4. So far, no issues, just there are a lot to migrate
Trying to use app-version mock.
Do you have an example of updating one to work with Ionic 4 as I may have to use some other mocks during development soon.
ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[SettingsPage -> AppVersionMock]:
StaticInjectorError(Platform: core)[SettingsPage -> AppVersionMock]:
NullInjectorError: No provider for AppVersionMock!
Error: StaticInjectorError(AppModule)[SettingsPage -> AppVersionMock]:
StaticInjectorError(Platform: core)[SettingsPage -> AppVersionMock]:
NullInjectorError: No provider for AppVersionMock!
at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:8896)
at resolveToken (core.js:9141)
at tryResolveToken (core.js:9085)
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:8982)
at resolveToken (core.js:9141)
at tryResolveToken (core.js:9085)
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:8982)
at resolveNgModuleDep (core.js:21218)
at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:21907)
at resolveNgModuleDep (core.js:21218)
at resolvePromise (zone.js:831)
at resolvePromise (zone.js:788)
at zone.js:892
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
at Object.onInvokeTask (core.js:17290)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
at drainMicroTaskQueue (zone.js:601)
at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:502)
at invokeTask (zone.js:1744)
Thanks :)
Working on the update...
@LiamKarlMitchell: I copied the index.ts
for AppVersion into my project and made some minor changes. Finally I ended up with this coding, which works like a charm:
import { AppVersion } from "@ionic-native/app-version/ngx";
import { environment } from "src/environments/environment";
export class AppVersionMock extends AppVersion {
getAppName(): Promise<string> {
return Promise.resolve(environment.mocks.appVersion.appName);
}
getPackageName(): Promise<string> {
return Promise.resolve(environment.mocks.appVersion.packageName);
}
getVersionCode(): Promise<string | number> {
return Promise.resolve(environment.mocks.appVersion.versionCode);
}
getVersionNumber(): Promise<string> {
return Promise.resolve(environment.mocks.appVersion.versionNumber);
}
}
For sure, you could return here hardcoded values as well.
Does the basic setup already work? If yes, then could you maybe commit that in a branch? I might be able to help with some of the plugins that we use.
There is a branch that you can play with at: https://github.com/chrisgriffith/ionic-native-mocks/tree/v5
I haven't found the time to figure out the new build system yet.
Chris
On Sat, May 4, 2019 at 8:07 PM AndreasGassmann [email protected] wrote:
Does the basic setup already work? If yes, then could you maybe commit that in a branch? I might be able to help with some of the plugins that we use.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/chrisgriffith/ionic-native-mocks/issues/29#issuecomment-489384574, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEA4A23RMWHVSVQZ7NGJRDPTZFP3ANCNFSM4G4WVXKQ .
How would one go about building and testing on that branch? I can't get it to build, or test, or anything.
I did a bunch of work trying to port everything over for Ionic 4, but I'm still getting an error about imports. You can find my fork at [1] and the error I'm getting is this:
ngc -p /Users/jarrett/sites/ionic-native-mocks/.tmp/plugins/native-storage/tsconfig.json
: Error: Trying to import a source file from a node_modules package: import /Users/jarrett/sites/ionic-native-mocks/dist/@ionic-native-mocks/core/index.d.ts from /Users/jarrett/sites/ionic-native-mocks/node_modules/@ionic-native/native-storage/ngx/index.d.ts
at TsCompilerAotCompilerTypeCheckHostAdapter.fileNameToModuleName (/Users/jarrett/.nvm/versions/node/v10.16.0/lib/node_modules/@angular/compiler-cli/src/transformers/compiler_host.js:226:23)
at TsCompilerAotCompilerTypeCheckHostAdapter.toSummaryFileName (/Users/jarrett/.nvm/versions/node/v10.16.0/lib/node_modules/@angular/compiler-cli/src/transformers/compiler_host.js:257:25)
at AotSummaryResolver.toSummaryFileName (/Users/jarrett/.nvm/versions/node/v10.16.0/lib/node_modules/@angular/compiler/bundles/compiler.umd.js:26686:30)
at /Users/jarrett/.nvm/versions/node/v10.16.0/lib/node_modules/@angular/compiler/bundles/compiler.umd.js:24606:57
at Array.map (<anonymous>)
at ToJsonSerializer.serialize (/Users/jarrett/.nvm/versions/node/v10.16.0/lib/node_modules/@angular/compiler/bundles/compiler.umd.js:24577:39)
at serializeSummaries (/Users/jarrett/.nvm/versions/node/v10.16.0/lib/node_modules/@angular/compiler/bundles/compiler.umd.js:24437:35)
at AotCompiler._createSummary (/Users/jarrett/.nvm/versions/node/v10.16.0/lib/node_modules/@angular/compiler/bundles/compiler.umd.js:25291:22)
at AotCompiler._compileImplFile (/Users/jarrett/.nvm/versions/node/v10.16.0/lib/node_modules/@angular/compiler/bundles/compiler.umd.js:25236:69)
at /Users/jarrett/.nvm/versions/node/v10.16.0/lib/node_modules/@angular/compiler/bundles/compiler.umd.js:25228:74
[1] https://github.com/NextCenturyMeters/ionic-native-mocks/tree/v5
Any news on this?
I have not spent any time on this.