
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
#at-test(基于注释的JS单元测试框架)
Base on at-js
##使用方法 ###安装
npm install at-test --save-dev
###示例一
-myModule
|-node_modules
|-test1.js
|-main.js
|-package.json
var assert = require('assert');
'@test.step';
var t0 = function () {
var ts = 'aaaaa';
for (var i = 0; i < 10000; i++) {
ts += 'aa';
}
return ts;
}
'@test.step';
var t1 = function () {
var t = 900;
t = 900/9;
assert.equal(t,100);
}
require('at-test')(['./test1.js']).then(function(report){
console.log(report);
});
node main.js
###示例二:复杂测试 module中的test.js中,代码修改成:
var assert = require('assert');
var ds = null;
'@test.start';
var start = function () {
ds = {};
}
'@test.step(timeout=2000)';
var test0 = function* () {
ds.test0 = 'finish';
var rtn = yield (function(){
return function(_next){
setTimeout(function(){
_next(null,3);
},2000)
}
})();
assert.equal(rtn,3);
}
'@test.step';
var test1 = function () {
ds.test1 = 'finish';
return ds;
}
'@test.finish';
var fh = function () {
ds = null;
}
module.exports = {
deleteItem:function*(_itemObj){
yield dao.del(_itemObj);
return {suc:true};
}
}
/**
* Annotation for dao
*/
'@dao'
var dao = function(){
throw new Error('No one implement me?oh my God....');
}
###示例三:测试文件自动扫描
-myModule
|-node_modules
|-folder0
|-a.test.js
|-folder1
|-b.test.js
|-main.js
|-package.json
在module的除node_modules外的任意位置, 创建任意名称后缀为.test.js的单元测试文件
require('at-test')().then(function(report){
console.log(report);
});
node main.js
欢迎提issue,或者直接联系作者即时交流(微信号:ALJZJZ)
FAQs
基于@Annotation的单元测试框架
We found that at-test demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.