我使用tsify,一个用于browserify的插件,在业力单元测试期间传译我的代码。在业余中使用“tsify”启用“装饰者的实验性支持”
我得到这种埃罗当我跑我的测试:
TypeScript error: src/app/emailLogin/emailLogin.component.ts(14,14): Error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.
在browserify/tsify如何使experimentalDecorators,这是在我的karma.config.js指定
这里是我的人缘.config.js:
module.exports = function(config) {
config.set({
browsers: ['Chrome'],
frameworks: ['jasmine', 'browserify', 'es6-shim'],
files: [
'src/**/*.spec.ts'
],
preprocessors: {
'**/*.ts': ['browserify']
},
browserify: {
debug: true,
plugin: ['tsify'],
transform: ['browserify-shim']
}
});
};
这是我一饮而尽文件(我认为这并不重要)
var gulp = require('gulp');
var Server = require('karma').Server;
/**
* Run test once and exit
*/
gulp.task('test', function (done) {
new Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done).start();
});
/**
* Watch for file changes and re-run tests on each change
*/
gulp.task('tdd', function (done) {
new Server({
configFile: __dirname + '/karma.conf.js'
}, done).start();
});
gulp.task('default', ['tdd']);
什么是您的tsconfig样子?我一直在使用'tsify',它不会为我抛出这个错误 –