我试图让项目运行时似乎有一个奇怪的错误,它似乎在mac中工作正常,但我无法在Windows/ubuntu中运行它
/home/nicholas/Desktop/Workspace/projectx/node_modules/gulp/node_modules/orchestrator/index.js:47
throw new Error('Task '+name+' can\'t support dependencies that is not an a
^
Error: Task connect can't support dependencies that is not an array of strings
at Gulp.Orchestrator.add (/home/nicholas/Desktop/Workspace/projectx/node_modules/gulp/node_modules/orchestrator/index.js:47:10)
at Object.<anonymous> (/home/nicholas/Desktop/Workspace/projectx/Gulpfile.js:66:6)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Liftoff.handleArguments (/usr/local/lib/node_modules/gulp/bin/gulp.js:62:18)
at Liftoff.launch (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:144:6)
Run Code Online (Sandbox Code Playgroud) 我是新的node.js堆栈之类npm,gulp等等.我之前编写了一些JavaScript单元测试用例,现在想Karma用作测试运行器.然而,经过几次尝试后,我现在完全迷失了.
首先,我有以下项目配置:
SystemJS 作为模块加载器.文件夹结构(为简洁起见,省略了一些):
project
|
|--build //contains all gulp tasks
|
|--dist //contains the output (*.html, *.js etc.)
|
|--jspm_packages
|
|--node_modules
|
|--src //contains the source .html, and *.ts
|
|--tests //contains unit tests in *.ts. I also have a gulp task to build tests/**/*.ts to *.js in the same folder.
|
|--typings //contains type definitions
|
|--config.js //contains SystemJS configuration
|
|--karma.conf.js
Run Code Online (Sandbox Code Playgroud)karma.conf.js
// Karma configuration
module.exports = …Run Code Online (Sandbox Code Playgroud)我们正在使用gulp-karma插件来吞噬我们的测试和PhantomJS.我们在Windows上运行,PhantomJS是一个.exe文件.我们的测试文件已经增长,现在我们收到错误"spawn ENAMETOOLONG".从我从这个答案收集到的:https://github.com/dbushell/grunt-svg2png/issues/17对于Grunt来说问题是发送到PhantomJS的参数太大了.有没有人有类似问题或知道任何解决方法(除了必须将测试文件合并到更少的文件)?
错误信息:
[14:20:19] Starting Karma server...
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENAMETOOLONG
at errnoException (child_process.js:1001:11)
at Process.ChildProcess._handle.onexit (child_process.js:792:34)
Run Code Online (Sandbox Code Playgroud) 我有问题通过gulp运行业力测试.
我正在使用phantomjs启动程序插件,当它尝试启动时,我看到以下内容:
[09:27:02] Starting 'karma-tests'...
DEPRECATED: use your own version of lodash, this will go away in karma@2.0
DEPRECATED: use your own version of lodash, this will go away in karma@2.0
28 01 2017 09:27:04.817:INFO [karma]: Karma v1.4.0 server started at http://0.0.0.0:9876/
28 01 2017 09:27:04.817:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
28 01 2017 09:27:04.817:INFO [launcher]: Starting browser PhantomJS
28 01 2017 09:27:07.882:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Connected on socket VwHY_WyYXMEj3RvZAAAA with id 284
68634
28 01 …Run Code Online (Sandbox Code Playgroud) 我的模板中有一个带有图像的组件
<div class="logo"><img src="../images/logo.png"/></div>
Run Code Online (Sandbox Code Playgroud)
运行业力任务时会引发此类错误
Uncaught Error: Cannot find module "../images/logo.png"
Run Code Online (Sandbox Code Playgroud)
提及该应用程序可以很好地渲染图像,只有业力在抱怨。
任何建议将被认真考虑。
我是angularjs的新手.我正在尝试写这个茉莉花测试的问题.我收到此错误 - "错误:[$ injector:unpr]未知提供程序:$ routeProvider".实际的应用程序工作正常,我只在测试中得到此错误.
[09:13:05] Starting 'test'...
[09:13:05] Starting 'test:unit'...
INFO [karma]: Karma v0.12.37 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.8 (Mac OS X 0.0.0)]: Connected on socket -W6J4Ey8gUxLNUpoIFy1 with id 43527657
PhantomJS 1.9.8 (Mac OS X 0.0.0) sourceControl should convert date FAILED
Error: [$injector:modulerr] Failed to instantiate module com.cmp.mod.features.sources due to:
Error: [$injector:unpr] Unknown provider: $routeProvider
http://errors.angularjs.org/1.4.7/$injector/unpr?p0=%24routeProvider
Run Code Online (Sandbox Code Playgroud)
这是我的控制器,
//controller
angular.module('com.cmp.mod.features.sources')
.controller('SourceControl', function ($modalInstance, $scope, source, sourceHelper) {
'use strict';
$scope.close = function() { …Run Code Online (Sandbox Code Playgroud) 我有一个业力骗局,我尝试用babel/browserify工作.它看起来像这样:
module.exports = function(config) {
config.set({
browsers: ['Chrome'],
frameworks: ['jasmine'],
plugins: [
'karma-jasmine',
'karma-chrome-launcher',
'karma-babel-preprocessor',
'karma-browserify'
],
preprocessors: {
'../src/**/*.js': ['babel', 'browserify'],
'unit/*.spec.js': ['babel', 'browserify']
},
files: [
'../src/**/*.js',
'unit/*.spec.js'
],
babelPreprocessor: {
options: {
presets: ['es2015'],
sourceMap: 'inline'
},
filename: function (file) {
return file.originalPath.replace(/\.js$/, '.es5.js');
},
sourceFileName: function (file) {
return file.originalPath;
}
}
});
Run Code Online (Sandbox Code Playgroud)
};
每次我通过gulp babel预处理器运行此配置时都会返回以下错误:ERROR [preprocessor.babel]:无法读取未定义的属性'bundleFile'
我为AngularJS应用程序的服务编写了以下非常简单的测试:
describe('Services', function () {
beforeEach(function(){
this.addMatchers({
toEqualData: function(expected) {
return angular.equals(this.actual, expected);
}
});
});
beforeEach(module('myapp.services'));
describe('Album service', function(){
var Album;
beforeEach(inject(function (_Album_) {
Album = _Album_;
}));
it('can get an instance of the Album factory', inject(function (Album) {
expect(Album).toBeDefined();
}));
});
});
Run Code Online (Sandbox Code Playgroud)
我刚刚在AngularJS文档中建议添加了自定义toEqualData匹配器.然而,这打破了测试.我正在使用Gulp来运行测试gulp-karma(虽然如果我直接使用Karma会出现同样的问题),并且我看到以下错误消息:
$ gulp test
[10:00:04] Using gulpfile ~/Projects/myapp/gulpfile.js
[10:00:04] Starting 'jshint'...
[10:00:04] Starting 'karma'...
WARN `start` method is deprecated since 0.13. It will be removed in 0.14. Please use
server = new …Run Code Online (Sandbox Code Playgroud) gulp-karma ×8
angularjs ×2
gulp ×2
karma-runner ×2
phantomjs ×2
angular ×1
jasmine ×1
karma-qunit ×1
systemjs ×1
typescript ×1
ubuntu ×1