javascript - Typescript + Angular2 test fails because of a JS library dependency -
i use jsfeat javascript library in angular2 project.
i put @ beginning of .ts , .spec.ts files:
declare var jsfeat: any; i included jsfeat.js in index.html.
now want run angular2 tests, get:
referenceerror: jsfeat not defined the test code is:
describe('myobj instance', function () {   it('should instantiate myobj', () => {     expect(new myobj()).tobedefined('whoopie!');   }); }); 
1) install jsfeat npm (optional):
npm install -g jsfeat 2) edit karma.conf.js:
  config.set({ [...]
files: [   // system.js module loading   'node_modules/systemjs/dist/system.src.js',    // polyfills   'node_modules/core-js/client/shim.js',    // reflect , zone.js   'node_modules/reflect-metadata/reflect.js',   'node_modules/zone.js/dist/zone.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', [...]
add jsfeat:
  'node_modules/jsfeat/build/jsfeat.js', 
Comments
Post a Comment