如何在不继续进行下一次测试的情况下强制完成Mochajs测试.如果环境被意外设置为生产并且我需要阻止测试继续,那么场景可能会阻止任何进一步的测试.
我试过抛出错误,但那些并没有停止整个测试,因为它是异步运行的.
我正在使用AngularJS制作Chrome Packaged应用程序,我只是尝试将我的后台脚本("runtime.js")中的消息发送到我项目中的另一个javascript文件.
的manifest.json
{
"name": "App Name",
"description": "Chrome Packaged",
"version": "0.0.9",
"manifest_version": 2,
"icons": {
"16": "img/icon16.png",
"48": "img/icon48.png",
"128":"img/icon128.png"
},
"app": {
"background": {
"scripts": ["runtime.js"]
}
},
"permissions": [
"alarms",
"storage",
"unlimitedStorage",
"notifications",
"app.runtime"
]
}
Run Code Online (Sandbox Code Playgroud)
runtime.js
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('index.html', {
minWidth: 400,
minHeight: 700,
bounds: {
width: 1000,
height: 700
}
});
});
chrome.runtime.sendMessage({message: "hello"}, function() {
console.log('sent')
});
Run Code Online (Sandbox Code Playgroud)
main.js
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
console.log('message received!');
});
Run Code Online (Sandbox Code Playgroud)
我检查后台页面时遇到的错误是"端口:无法建立连接.接收端不存在".
可能是什么问题的任何想法?谢谢!
我创建api代理并选中"为您的API启用直接浏览器访问 - 允许通过CORS从浏览器直接请求"的复选框.但我的OPTIONS请求仍然失败:
{
"fault": {
"faultstring": "Received 405 Response without Allow Header",
"detail": {
"errorcode": "protocol.http.Response405WithoutAllowHeader"
}
}
}
Run Code Online (Sandbox Code Playgroud)
根据我对CORS飞行前选项请求的理解,客户端首先将OPTIONS请求发送到服务器,作为"安全"CORS的安全措施.此请求应返回一个响应,其中包含可用的请求类型列表.
我的问题:如何使Apigee正确响应OPTIONS请求并且不将OPTIONS请求传递给代理后面的api?.如果有帮助我让AngularJS javascript应用程序尝试与我的Apigee端点进行通信.
Javascript错误:
OPTIONS http://api.example.com No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://client.example.com' is therefore not allowed access.
XMLHttpRequest cannot load http://api.example.com. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://client.example.com' is therefore not allowed access.
Run Code Online (Sandbox Code Playgroud)
默认"添加CORS"xml
<AssignMessage async="false" continueOnError="false" enabled="true" name="Add-CORS">
<DisplayName>Add CORS</DisplayName>
<FaultRules/>
<Properties/>
<Add>
<Headers>
<Header …Run Code Online (Sandbox Code Playgroud) 如何指定用于bower组件的默认文件,以便通过grunt-bower-install正确注入?
我正在使用datejs,根据您的本地化,他们有不同的文件.我想要包含的文件不在bower_components/datejs目录的根目录中,所以我得到错误:
datejs未在您的文件中注入.
请查看"app/bower_components/datejs"获取所需文件,然后手动将其包含在您的文件中.
我正努力避免将datejs硬编码到我的索引文件中,并且不想将"date-en-US.js"文件移动到datejs目录的根目录中.
这是datejs凉亭组件的结构.
bower_components
??? datejs
??? build
??? ...
??? date-en-US.js
??? ...
??? src
??? test
Run Code Online (Sandbox Code Playgroud)
如果这有帮助,这是位于datejs bower组件路径中的.bower.json文件:
{
"name": "datejs",
"homepage": "https://github.com/datejs/Datejs",
"_release": "7bdddb55d6",
"_resolution": {
"type": "branch",
"branch": "master",
"commit": "7bdddb55d69719e42c358c3a2b7df706ff3090f8"
},
"_source": "git://github.com/datejs/Datejs.git",
"_target": "*",
"_originalSource": "datejs",
"_direct": true
}
Run Code Online (Sandbox Code Playgroud) 建议使用什么方式来处理redux-form/CHANGE由redux-form调度的操作?我有自己的reducer管理此表单的状态,但是我不确定是否最好执行以下操作:
export default reducer (state = initialState, action) {
case 'redux-form/CHANGE':
// return modified state
}
Run Code Online (Sandbox Code Playgroud)
我看到的一个问题是该减速器将执行所有 redux-form/CHANGE操作。另外,据我所知,ActionTypes.js并未以我导入的方式导出,因此我觉得这可能不是最佳实践。
我有一个要设置的弹性beantalk节点应用程序。我正在尝试从S3加载环境文件,/var/app/ondeck/src/以便在启动Node应用程序时可以使用该文件。我已经尝试了很多事情,但是production.env文件从不显示。如果我将位置更改为类似/home/ec2-user文件出现的位置,那么我知道文件部分正确。我想念什么?
files:
"/var/app/ondeck/src/production.env":
mode: "000777"
user: nodejs
group: nodejs
source: https://s3.amazonaws.com/bucket-name/file.env
Resources:
AWSEBAutoScalingGroup:
Metadata:
AWS::CloudFormation::Authentication:
S3Access:
type: S3
roleName: aws-elasticbeanstalk-ec2-role
buckets: bucket-name
Run Code Online (Sandbox Code Playgroud)
========
不得已的想法是运行container_command,该命令只会将文件从中复制/home/ec2-user到中/var/app/current/src/,/var/app/ondeck/src/但似乎也不起作用。如果可能的话,我更喜欢让最优秀的例子工作。
container_commands:
command: "/bin/cp /home/ec2-user/production.env /var/app/ondeck/production.env"
Run Code Online (Sandbox Code Playgroud) amazon-ec2 ×1
angularjs ×1
api ×1
apigee ×1
bower ×1
cors ×1
gruntjs ×1
javascript ×1
mocha.js ×1
node.js ×1
preflight ×1
redux-form ×1