-
Notifications
You must be signed in to change notification settings - Fork 107
TesBed - Error to run unit test #1
Comments
I'm giving a look into this. Thank you! |
@marcoturi @mfdeveloper files: [
'node_modules/core-js/client/shim.js',
'node_modules/reflect-metadata/Reflect.js',
'node_modules/zone.js/dist/zone.js',
'node_modules/zone.js/dist/long-stack-trace-zone.js',
'node_modules/zone.js/dist/proxy.js',
'node_modules/zone.js/dist/sync-test.js',
'node_modules/zone.js/dist/jasmine-patch.js',
'node_modules/zone.js/dist/async-test.js',
'node_modules/zone.js/dist/fake-async-test.js',
'src/**/*.spec.ts'
], I'm now getting |
This project as same good ideas https://github.com/jkuri/angular2-rollup-starter/blob/master/config/karma.conf.js |
ionic-team/ionic-app-scripts#51 |
Hello guys!! @marcoturi and @NelsonBrandao, I was did these changes on files: [
'node_modules/reflect-metadata/Reflect.js',
'node_modules/zone.js/dist/zone.js', // Zone.js dependencies (Zone undefined)
'node_modules/zone.js/dist/sync-test.js',
'node_modules/zone.js/dist/proxy.js',
'node_modules/zone.js/dist/jasmine-patch.js',
'node_modules/zone.js/dist/async-test.js',
'node_modules/zone.js/dist/fake-async-test.js',
'src/**/*.spec.ts',
{ pattern: 'node_modules/reflect-metadata/Reflect.js.map', included: false, served: true }, // 404 on the same
] So, I created this gist today: https://gist.github.com/mfdeveloper/d9349dea78ba34a36adc7ada56ffd0c0 There, you will find the implementations: 1 - Fix the //Initialize the test: prevent 'platform' undefined error
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
2 - Remove Now, I got the error: I think that this happens because Ionic2 has so many components/services dependencies on their flow. But, I don't know which the dependency OBS: I created this gist instead a pull request because this isn't working by now. |
Hey there, finally I did the test works on Ionic2 lol However, it works only on Anyway, I've created a class called See: https://gist.github.com/mfdeveloper/d9349dea78ba34a36adc7ada56ffd0c0 Usage: describe('Component: MyComponent', () => {
let helper = new ComponentTest<MyComponent>();
beforeEach(() => {
// TODO: pass custom providers and reuse "MyComponent" passed by generics
helper.init(MyComponent);
});
it('should initialize angular component', () => {
expect(helper.fixture).toBeDefined();
expect(helper.component).toBeDefined();
});
}); |
fixed with last commit, feel free to re-open if needed. |
Hello @marcoturi !! I tried use this repo structure. The jasmine Simple test works fine, but, if I create another spec that use the
TestBed
angular2 class to load a component, I got the error below:Do you know what does mean "symbol" error ? I think that needs include
zone.js
library onkarma.conf.js
. What dou think?See my snippet code, after change
home.spec.ts
fileOBS: Needs perform
npm install --save rxjs-es
to store inpackage.json
file. Yourkarma.conf.js
require this :)The text was updated successfully, but these errors were encountered: