- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我目前正在使用 Jenkins 进行 CI 流程,该流程会针对 Nodejs 服务器后端触发 Mocha 测试。
出于某种原因,xunit 测试记者没有与 Jenkins 合作。 test-resul.xml 为空,作业一直失败。我们可以通过运行让它工作:
npm install mocha-jenkins-reporter
就在测试触发之前,如下所示:
JUNIT_REPORT_PATH=test_report.xml JUNIT_REPORT_STACK=1 NODE_ENV=test node ./node_modules/.bin/mocha --globals * --reporter mocha-jenkins-reporter --no-colors
现在我得到了部分结果,因为某些原因并非所有测试都在运行。他们在测试套件中间停止,没有任何通知或错误消息。我还注意到生成的 xml 缺少结束 标记 的根元素。我通过运行解决了这个问题:
echo '</testsuites>' >> test-result.xml
除此之外,我还注意到测试执行期间内存消耗激增。这是 npm install 的输出,这一步是这项工作的第一步:
+ npm -v
3.8.6
+ npm install
npm WARN deprecated sequelize@3.14.2: security/injection issue with limit/offset fixed in 3.17.0
npm WARN deprecated lodash@0.9.2: Grunt needs your help! See https://github.com/gruntjs/grunt/issues/1403.
npm WARN deprecated graceful-fs@1.2.3: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated graceful-fs@2.0.3: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
> ws@0.6.5 install /home/jenkins/workspace/Rufus_Test_DEV/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
> actionhero@10.0.3 postinstall /home/jenkins/workspace/Rufus_Test_DEV
> echo 'To generate a new actionhero project, run "node ./node_modules/.bin/actionhero generate"'
To generate a new actionhero project, run "node ./node_modules/.bin/actionhero generate"
actionhero@10.0.3 /home/jenkins/workspace/Rufus_Test_DEV
+-- async@0.9.2
+-- aws-sdk@2.3.3
| +-- jmespath@0.15.0
| +-- sax@1.1.5
| +-- xml2js@0.4.15
| `-- xmlbuilder@2.6.2
| `-- lodash@3.5.0
+-- bcrypt-nodejs@0.0.3
+-- blanket@1.2.3
| +-- acorn@1.2.2
| +-- falafel@1.2.0
| +-- foreach@2.0.5
| +-- isarray@0.0.1
| +-- object-keys@1.0.9
| `-- xtend@4.0.1
+-- braintree@1.37.1
| +-- dateformat@1.0.1-1.2.3
| +-- depd@1.1.0
| +-- readable-stream@1.1.10
| | +-- core-util-is@1.0.2
| | +-- debuglog@0.0.2
| | `-- string_decoder@0.10.31
| +-- semver@5.1.0
| +-- source-map-support@0.2.9
| | `-- source-map@0.1.32
| +-- underscore@1.3.1
| `-- xml2js@0.1.13
+-- browser_fingerprint@0.0.6
+-- circular-json@0.1.6
| `-- wru@0.2.7
+-- coveralls@2.11.9
| +-- js-yaml@3.0.1
| | +-- argparse@0.1.16
| | | +-- underscore@1.7.0
| | | `-- underscore.string@2.4.0
| | `-- esprima@1.0.4
| +-- lcov-parse@0.0.6
| +-- log-driver@1.2.4
| +-- minimist@1.2.0
| `-- request@2.67.0
| +-- bl@1.0.3
| | `-- readable-stream@2.0.6
| | `-- isarray@1.0.0
| `-- qs@5.2.0
+-- easy-table@0.3.0
+-- emailjs@1.0.4
| +-- addressparser@0.3.2
| +-- bufferjs@1.1.0
| +-- mimelib@0.2.14
| | +-- addressparser@0.2.1
| | `-- encoding@0.1.12
| | `-- iconv-lite@0.4.13
| +-- moment@2.11.2
| `-- starttls@1.0.1
+-- fakeredis@0.3.4
| `-- redis@2.1.0
+-- formidable@1.0.17
+-- geolib@2.0.20
+-- grunt@0.4.5
| +-- async@0.1.22
| +-- coffee-script@1.3.3
| +-- colors@0.6.2
| +-- dateformat@1.0.2-1.2.3
| +-- eventemitter2@0.4.14
| +-- exit@0.1.2
| +-- findup-sync@0.1.3
| | +-- glob@3.2.11
| | | `-- minimatch@0.3.0
| | `-- lodash@2.4.2
| +-- getobject@0.1.0
| +-- glob@3.1.21
| | +-- graceful-fs@1.2.3
| | `-- inherits@1.0.2
| +-- grunt-legacy-log@0.1.3
| | +-- grunt-legacy-log-utils@0.1.1
| | | +-- lodash@2.4.2
| | | `-- underscore.string@2.3.3
| | +-- lodash@2.4.2
| | `-- underscore.string@2.3.3
| +-- grunt-legacy-util@0.2.0
| | +-- async@0.1.22
| | `-- lodash@0.9.2
| +-- hooker@0.2.3
| +-- iconv-lite@0.2.11
| +-- js-yaml@2.0.5
| +-- lodash@0.9.2
| +-- minimatch@0.2.14
| | +-- lru-cache@2.7.3
| | `-- sigmund@1.0.1
| +-- nopt@1.0.10
| | `-- abbrev@1.0.7
| +-- rimraf@2.2.8
| +-- underscore.string@2.2.1
| `-- which@1.0.9
+-- jsonwebtoken@5.4.1
| +-- jws@3.1.3
| | +-- base64url@1.0.6
| | | +-- concat-stream@1.4.10
| | | `-- meow@2.0.0
| | | +-- camelcase-keys@1.0.0
| | | | `-- map-obj@1.0.1
| | | +-- indent-string@1.2.2
| | | | +-- get-stdin@4.0.1
| | | | `-- repeating@1.1.3
| | | | `-- is-finite@1.0.1
| | | | `-- number-is-nan@1.0.0
| | | `-- object-assign@1.0.0
| | `-- jwa@1.1.3
| | +-- buffer-equal-constant-time@1.0.1
| | `-- ecdsa-sig-formatter@1.0.5
| | `-- base64-url@1.2.2
| `-- ms@0.7.1
+-- le_node@1.2.0
| +-- babel-runtime@5.4.7
| | `-- core-js@0.9.16
| +-- codependency@0.1.3
| | `-- semver@2.2.1
| +-- json-stringify-safe@5.0.1
| +-- lodash@3.9.3
| `-- semver@5.1.0
+-- lodash@4.11.1
+-- machina@1.1.2
| `-- lodash@3.10.1
+-- mime@1.2.11
+-- mocha@2.4.5
| +-- commander@2.3.0
| +-- debug@2.2.0
| +-- diff@1.4.0
| +-- escape-string-regexp@1.0.2
| +-- glob@3.2.3
| | +-- graceful-fs@2.0.3
| | `-- inherits@2.0.1
| +-- growl@1.8.1
| +-- jade@0.26.3
| | +-- commander@0.6.1
| | `-- mkdirp@0.3.0
| +-- mkdirp@0.5.1
| | `-- minimist@0.0.8
| `-- supports-color@1.2.0
+-- mocha-lcov-reporter@0.0.1
+-- moment@2.10.6
+-- moment-timezone@0.4.1
+-- mysql@2.10.2
| +-- bignumber.js@2.1.4
| `-- readable-stream@1.1.14
+-- node-gcm@0.12.1
| `-- debug@0.8.1
+-- node-resque@0.11.6
+-- node-schedule@0.2.9
| +-- cron-parser@0.6.2
| `-- long-timeout@0.0.2
+-- node-uuid@1.4.7
+-- optimist@0.6.1
| +-- minimist@0.0.10
| `-- wordwrap@0.0.3
+-- paypal-ipn@3.0.0
+-- primus@2.4.12
| +-- access-control@0.0.8
| | +-- millisecond@0.1.2
| | `-- vary@1.0.1
| +-- create-server@0.0.7
| | `-- connected@0.0.2
| +-- diagnostics@0.0.4
| | +-- color@0.7.3
| | | +-- color-convert@0.5.3
| | | `-- color-string@0.2.4
| | | `-- color-name@1.0.1
| | +-- colornames@0.0.2
| | +-- env-variable@0.0.3
| | +-- kuler@0.0.0
| | `-- text-hex@0.0.0
| +-- eventemitter3@0.1.6
| +-- forwarded-for@0.1.1
| +-- fusing@0.4.0
| | +-- emits@1.0.2
| | `-- predefine@0.1.2
| | `-- extendible@0.1.1
| +-- load@1.0.2
| +-- setheader@0.0.4
| | `-- debug@0.7.4
| `-- ultron@1.0.2
+-- qrcode-js@0.0.2
+-- querystring@0.2.0
+-- redis@0.12.1
+-- redis-sentinel-client@0.2.5
| `-- redis@0.10.3
+-- request@2.71.0 invalid
| +-- aws-sign2@0.6.0
| +-- aws4@1.3.2
| | `-- lru-cache@4.0.1
| | +-- pseudomap@1.0.2
| | `-- yallist@2.0.0
| +-- bl@1.1.2
| | `-- readable-stream@2.0.6
| | +-- isarray@1.0.0
| | +-- process-nextick-args@1.0.6
| | `-- util-deprecate@1.0.2
| +-- caseless@0.11.0
| +-- combined-stream@1.0.5
| | `-- delayed-stream@1.0.0
| +-- extend@3.0.0
| +-- forever-agent@0.6.1
| +-- form-data@1.0.0-rc4
| | `-- async@1.5.2
| +-- har-validator@2.0.6
| | +-- chalk@1.1.3
| | | +-- ansi-styles@2.2.1
| | | +-- escape-string-regexp@1.0.5
| | | +-- has-ansi@2.0.0
| | | | `-- ansi-regex@2.0.0
| | | +-- strip-ansi@3.0.1
| | | `-- supports-color@2.0.0
| | +-- commander@2.9.0
| | | `-- graceful-readlink@1.0.1
| | +-- is-my-json-valid@2.13.1
| | | +-- generate-function@2.0.0
| | | +-- generate-object-property@1.2.0
| | | | `-- is-property@1.0.2
| | | `-- jsonpointer@2.0.0
| | `-- pinkie-promise@2.0.1
| | `-- pinkie@2.0.4
| +-- hawk@3.1.3
| | +-- boom@2.10.1
| | +-- cryptiles@2.0.5
| | +-- hoek@2.16.3
| | `-- sntp@1.0.9
| +-- http-signature@1.1.1
| | +-- assert-plus@0.2.0
| | +-- jsprim@1.2.2
| | | +-- extsprintf@1.0.2
| | | +-- json-schema@0.2.2
| | | `-- verror@1.3.6
| | `-- sshpk@1.7.4
| | +-- asn1@0.2.3
| | +-- dashdash@1.13.0
| | | `-- assert-plus@1.0.0
| | +-- ecc-jsbn@0.1.1
| | +-- jodid25519@1.0.2
| | +-- jsbn@0.1.0
| | `-- tweetnacl@0.14.3
| +-- is-typedarray@1.0.0
| +-- isstream@0.1.2
| +-- json-stringify-safe@5.0.1
| +-- mime-types@2.1.10
| | `-- mime-db@1.22.0
| +-- oauth-sign@0.8.1
| +-- qs@6.1.0
| +-- stringstream@0.0.5
| +-- tough-cookie@2.2.2
| `-- tunnel-agent@0.4.2
+-- sequelize@3.14.2
| +-- bluebird@3.3.5
| +-- dottie@1.1.1
| +-- generic-pool@2.2.1
| +-- inflection@1.9.0
| +-- lodash@3.10.1
| +-- shimmer@1.1.0
| +-- toposort-class@1.0.1
| +-- validator@4.9.0
| +-- wellknown@0.4.1
| | +-- concat-stream@1.5.1
| | | +-- readable-stream@2.0.6
| | | | `-- isarray@1.0.0
| | | `-- typedarray@0.0.6
| | `-- minimist@1.1.3
| `-- wkx@0.1.0
+-- should@4.6.5
| +-- should-equal@0.3.1
| +-- should-format@0.0.7
| `-- should-type@0.0.4
+-- uglify-js@2.4.24
| +-- async@0.2.10
| +-- source-map@0.1.34
| | `-- amdefine@1.0.0
| +-- uglify-to-browserify@1.0.2
| `-- yargs@3.5.4
| +-- camelcase@1.2.1
| +-- decamelize@1.2.0
| +-- window-size@0.1.0
| `-- wordwrap@0.0.2
+-- winston@0.8.3
| +-- async@0.2.10
| +-- cycle@1.0.3
| +-- eyes@0.1.8
| +-- pkginfo@0.3.1
| `-- stack-trace@0.0.9
+-- winston-loggly@1.3.1
| `-- loggly@1.1.0
| +-- request@2.67.0
| | +-- bl@1.0.3
| | | `-- readable-stream@2.0.6
| | | `-- isarray@1.0.0
| | `-- qs@5.2.0
| `-- timespan@2.3.0
`-- ws@0.6.5
+-- nan@1.4.3
`-- options@0.0.6
npm WARN actionhero@10.0.3 No license field.
最佳答案
内存峰值似乎是确凿无疑的证据 - 您要么超出了资源配额并被杀死,要么只是崩溃了。这似乎通过创建的部分文件得到了证实 - 从字面上结束于类似片段中间的文件是崩溃或强制终止的强烈指示。
我自己使用ActionHero,它占用的内存很少。 Sequelize 是其使用的主要部分,即便如此,我也很少在生产 API Node 上使用超过 180MB 的 RAM。您没有具体说明您的“内存峰值”有多大,但我会首先调查您的进程到底使用了多少内存以及如何分配它。有很多工具可用于此目的,但我建议使用 StrongLoop、PM2、NewRelic 或 Ruxit 等工具,因为它可以帮助您快速找到它。所有这些工具都提供免费或试用选项。
除此之外,您还可以通过单独运行测试来进行一些调查。当您调用 mocha
时,您可以传入一个测试套件来执行
最后,如果您使用 Bash 作为 shell,请尝试删除 --globals *
作为测试。 Bash 可能会在执行 Mocha 之前对其进行扩展,将其替换为当前工作目录中的文件列表。如果结果出现任何问题,您可以将其放在引号中或创建一个 mocha.opts
文件。这是我的,仅作为示例:
--recursive
--reporter spec
--timeout 15000
--ignore-leaks
--slow 3000
--globals api,assert
--require test/bootstrap
test
请注意,命令行参数可以覆盖 opts 文件设置。这就是为什么我在这里有 --reporter spec
- 这减少了我在本地开发环境中手动运行 mocha
的输入(我可以只运行 mocha
根本没有参数)。您仍然可以将报告器设置为 CI 堆栈中您想要的报告器。
关于javascript - Mocha 在完成所有测试之前结束测试运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36653634/
我有一个 html 格式的表单: 我需要得到 JavaScript在value input 字段执行,但只能通过表单的 submit .原因是页面是一个模板所以我不控制它(不能有
我管理的论坛是托管软件,因此我无法访问源代码,我只能向页面添加 JavaScript 来实现我需要完成的任务。 我正在尝试用超链接替换所有页面上某些文本关键字的第一个实例。我还根据国家/地区代码对这些
我正在使用 JS 打开新页面并将 HTML 代码写入其中,但是当我尝试使用 document.write() 在新页面中编写 JS 时功能不起作用。显然,一旦看到 ,主 JS 就会关闭。用于即将打开的
提问不是为了解决问题,提问是为了更好地理解系统 专家!我知道每当你将 javascript 代码输入 javascript 引擎时,它会立即由 javascript 引擎执行。由于没有看过Engi
我在一个文件夹中有两个 javascript 文件。我想将一个变量的 javascript 文件传递到另一个。我应该使用什么程序? 最佳答案 window.postMessage用于跨文档消息。使
我有一个练习,我需要输入两个输入并检查它们是否都等于一个。 如果是 console.log 正则 console.log false 我试过这样的事情: function isPositive(fir
我正在做一个Web应用程序,计划允许其他网站(客户端)在其页面上嵌入以下javascript: 我的网络应用程序位于 http://example.org 。 我不能假设客户端网站的页面有 JQue
目前我正在使用三个外部 JS 文件。 我喜欢将所有三个 JS 文件合而为一。 尽一切可能。我创建 aio.js 并在 aio.js 中 src="https://code.jquery.com/
我有例如像这样的数组: var myArray = []; var item1 = { start: '08:00', end: '09:30' } var item2 = {
所以我正在制作一个 Chrome 扩展,它使用我制作的一些 TamperMonkey 脚本。我想要一个“主”javascript 文件,您可以在其中包含并执行其他脚本。我很擅长使用以下行将其他 jav
我有 A、B html 和 A、B javascript 文件。 并且,如何将 A JavaScript 中使用的全局变量直接移动到 B JavaScript 中? 示例 JavaScript) va
我需要将以下整个代码放入名为 activate.js 的 JavaScript 中。你能告诉我怎么做吗? var int = new int({ seconds: 30, mark
我已经为我的 .net Web 应用程序创建了母版页 EXAMPLE1.Master。他们的 I 将值存储在 JavaScript 变量中。我想在另一个 JS 文件中检索该变量。 示例1.大师:-
是否有任何库可以用来转换这样的代码: function () { var a = 1; } 像这样的代码: function () { var a = 1; } 在我的浏览器中。因为我在 Gi
我收到语法缺失 ) 错误 $(document).ready(function changeText() { var p = document.getElementById('bidp
我正在制作进度条。它有一个标签。我想调整某个脚本完成的标签。在找到可能的解决方案的一些答案后,我想出了以下脚本。第一个启动并按预期工作。然而,第二个却没有。它出什么问题了?代码如下: HTML:
这里有一个很简单的问题,我简单的头脑无法回答:为什么我在外部库中加载时,下面的匿名和onload函数没有运行?我错过了一些非常非常基本的东西。 Library.js 只有一行:console.log(
我知道 javascript 是一种客户端语言,但如果实际代码中嵌入的 javascript 代码以某种方式与在控制台上运行的代码不同,我会尝试找到答案。让我用一个例子来解释它: 我想创建一个像 Mi
我如何将这个内联 javascript 更改为 Unobtrusive JavaScript? 谢谢! 感谢您的回答,但它不起作用。我的代码是: PHP js文件 document.getElem
我正在寻找将简单的 JavaScript 对象“转储”到动态生成的 JavaScript 源代码中的最优雅的方法。 目的:假设我们有 node.js 服务器生成 HTML。我们在服务器端有一个对象x。
我是一名优秀的程序员,十分优秀!