2016-04-20 3 views
4

Я пытаюсь создать угловой 2 проект с Gulp и жасмином (after seeing this example), но почему-то я все время получаю эти смысловые ошибки при компиляции моих машинописный:семантических ошибок машинописи NgMatchers для угловых 2

matchers.d.ts(4,37): error TS2503: Cannot find namespace 'jasmine'. 

process/typescript/app-component.spec.ts(8,22): error TS2339: Property 'toEqual' does not exist on type 'NgMatchers'. 

Для следующий TestCase:

import {it, describe, expect, beforeEach, inject} from 'angular2/testing'; 
import {AppComponent} from "./app.component"; 

describe('App component test',() => { 
    let component: AppComponent; 

    it('Value of testvar should be test',() => { 
     expect(true).toEqual(true); 
    }); 
}); 

Я понятия не имею, где это происходит не так, тем более, что я загружая типизации жасмин ... typings.json

{ 
    "ambientDependencies": { 
     "es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd", 
     "jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#5c182b9af717f73146399c2485f70f1e2ac0ff2b" 
    } 
} 

gulpfile.js

var gulp = require('gulp'), 
    webserver = require('gulp-webserver'), 
    typescript = require('gulp-typescript'), 
    sourcemaps = require('gulp-sourcemaps'), 
    tscConfig = require('./tsconfig.json'); 

gulp.task('typescript', function() { 
    return gulp 
    .src(tsSrc + '**/*.ts') 
    .pipe(sourcemaps.init()) 
    .pipe(typescript(tscConfig.compilerOptions)) 
    .pipe(sourcemaps.write('.')) 
    .pipe(gulp.dest(appSrc + 'js/')); 
}); 

tsconfig.json

{ 
    "compilerOptions": { 
     "target": "es5", 
     "module": "system", 
     "moduleResolution": "node", 
     "sourceMap": true, 
     "emitDecoratorMetadata": true, 
     "experimentalDecorators": true, 
     "removeComments": false, 
     "noImplicitAny": true 
    }, 
    "exclude": [ 
     "node_modules" 
    ] 
} 

Кто-нибудь есть идея, что происходит не так? Насколько я знаю, я загружаю все необходимые пакеты.

package.json

"dependencies": { 
     "angular2": "2.0.0-beta.15", 
     "systemjs": "^0.19.24", 
     "es6-promise": "^3.0.2", 
     "es6-shim": "^0.35.0", 
     "reflect-metadata": "0.1.2", 
     "rxjs": "5.0.0-beta.2", 
     "zone.js": "0.6.11" 
    }, 
    "devDependencies": { 
    "gulp": "^3.9.0", 
    "gulp-sourcemaps": "^1.6.0", 
    "gulp-typescript": "^2.13.0", 
    "gulp-webserver": "^0.9.1", 
    "http-server": "", 
    "jasmine-core": "^2.4.1", 
    "karma": "^0.13.22", 
    "karma-chrome-launcher": "^0.2.3", 
    "karma-coverage": "^0.5.5", 
    "karma-jasmine": "^0.3.8", 
    "remap-istanbul": "^0.6.3", 
    "typescript": "^1.8.10", 
    "typings": "^0.6.8" 
    } 

ответ

3

Я Quess компилятор нуждается в файле декларации, как этот

/// <reference path="../node_modules/angular2/typings/browser.d.ts" /> 
/// <reference path="../typings/main/ambient/jasmine/index.d.ts" /> 
import {it, describe, expect, beforeEach, inject} from 'angular2/testing'; 
import {AppComponent} from "./app.component"; 

describe('App component test',() => { 
    let component: AppComponent; 

    it('Value of testvar should be test',() => { 
     expect(true).toEqual(true); 
    }); 
}); 
Смежные вопросы