Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is ready for v4? #29

Open
pablogravielseo opened this issue Mar 8, 2019 · 10 comments
Open

Is ready for v4? #29

pablogravielseo opened this issue Mar 8, 2019 · 10 comments

Comments

@pablogravielseo
Copy link

Hi everyone is "ionic-native-mocks" ready for v4??

@chrisgriffith
Copy link
Owner

I am working on updating them to work with Ionic 4. So far, no issues, just there are a lot to migrate

@LiamKarlMitchell
Copy link

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 :)

@chrisgriffith
Copy link
Owner

Working on the update...

@Ritzlgrmft
Copy link

@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.

@AndreasGassmann
Copy link

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.

@chrisgriffith
Copy link
Owner

chrisgriffith commented May 6, 2019 via email

@JetUni
Copy link

JetUni commented Aug 7, 2019

How would one go about building and testing on that branch? I can't get it to build, or test, or anything.

@JetUni
Copy link

JetUni commented Aug 8, 2019

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

@JetUni JetUni mentioned this issue Aug 8, 2019
@kashban
Copy link

kashban commented Mar 31, 2020

Any news on this?

@chrisgriffith
Copy link
Owner

I have not spent any time on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants