We’ve been working on a couple of apps and have had unit tests covering most of our components. Everythign was good on firstname.lastname@example.org, but after upgrading (4, or 6) we get errors running our unit tests on anything that imports either of the items below in their import chain:
Platform from ionic-angular
IONIC_DIRECTIVES from ionic-angular
The error looks like a polyfill issue, but we have had a working spec-bundle that provides all the required polyfills for PhantomJS, and calls the angular2 setBaseTestProviders.
The error we see:
TypeError: 'undefined' is not an object (near '...stAnimationFrame')])['bind'](window);...')
/* * When testing with webpack and ES6, we have to do some extra * things get testing to work right. Because we are gonna write test * in ES6 to, we have to compile those as well. That's handled in * wallaby.js with the karma-webpack plugin. This is the entry * file for webpack test. Just like webpack will create a bundle.js * file for our client, when we run test, it well compile and bundle them * all here. */ Error.stackTraceLimit = Infinity; require('core-js'); // Typescript emit helpers polyfill require('ts-helpers'); require("es6-shim"); require('zone.js/dist/zone'); require('zone.js/dist/long-stack-trace-zone'); require('zone.js/dist/jasmine-patch'); require('rxjs/Rx'); var testing = require('angular2/testing'); var browser = require('angular2/platform/testing/browser'); testing.setBaseTestProviders( browser.TEST_BROWSER_PLATFORM_PROVIDERS, browser.TEST_BROWSER_APPLICATION_PROVIDERS );