Skip to content

Commit 7a383bf

Browse files
committed
Bump nodent to fix #12
1 parent 7fd15e5 commit 7a383bf

File tree

2 files changed

+42
-29
lines changed

2 files changed

+42
-29
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "fast-async",
3-
"version": "6.0.32",
3+
"version": "6.0.34",
44
"dependencies": {
5-
"nodent": "^2.6.3"
5+
"nodent": "^2.6.7"
66
},
77
"description": "fast-async/await transformer Babel plugin",
88
"main": "plugin.js",
99
"scripts": {
10-
"test": "cd tests && npm i && node ."
10+
"test": "cd tests && npm i && node --expose-gc ."
1111
},
1212
"repository": {
1313
"type": "git",

tests/test.js

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ try {
1515
process.exit(-1) ;
1616
}
1717

18-
console.log("\nStarting tests...");
18+
try {
19+
global.gc() ;
20+
} catch (ex) {
21+
console.log("You get more accurate timings by running with the node option --expose-gc") ;
22+
global.gc = function(){} ;
23+
}
24+
25+
console.log("\nNB:The timings here are only indicative. GC and poor sampling generate variable results. More detailed performance tests can be found in "+"nodent".cyan+"\nStarting tests...");
1926

2027
try {
2128
global.Promise = global.Promise || require('bluebird') ;
@@ -25,7 +32,8 @@ try {
2532
var testCode = require('fs').readFileSync(__dirname+'/test-input.js').toString() ;
2633

2734
var transformers = {
28-
'fast-async':{plugins:[[require('../plugin.js'),{runtimePatten:'directive',env:{dontMapStackTraces:true},compiler:{promises:true}}]]},
35+
'fast-async (es7-lazy)':{plugins:[[require('../plugin.js'),{runtimePatten:'directive',env:{dontMapStackTraces:true},compiler:{promises:false,es7:true,lazyThenables:true}}]]},
36+
'fast-async (promises)':{plugins:[[require('../plugin.js'),{runtimePatten:'directive',env:{dontMapStackTraces:true},compiler:{promises:true}}]]}
2937
};
3038

3139
var requires ;
@@ -47,36 +55,41 @@ try {
4755
console.log("'"+("npm install "+requires.join(' ')).yellow+"' to compare against babel plugin 'transform-async-to-module-method'") ;
4856
}
4957

58+
function loadRegenerator(){
59+
try {
60+
function walkSync(dir,match) {
61+
if( dir[dir.length-1] != '/') dir=dir.concat('/')
62+
var fs = fs || require('fs'),
63+
files = fs.readdirSync(dir);
64+
files.forEach(function(file) {
65+
var stat = fs.lstatSync(dir + file) ;
66+
if (!stat.isSymbolicLink()) {
67+
if (file==match)
68+
throw dir + file ;
69+
if (stat.isDirectory())
70+
walkSync(dir + file + '/',match);
71+
}
72+
});
73+
};
74+
walkSync('node_modules','regenerator') ;
75+
console.log("Couldn't locate regenerator runtime") ;
76+
} catch (path) {
77+
global.regeneratorRuntime = require("./"+path);
78+
console.log("Loaded regenerator runtime from "+path+" ",regeneratorRuntime.toString().yellow) ;
79+
}
80+
}
81+
5082
var keys = Object.keys(transformers) ;
5183
(function nextTest(i){
5284
try {
53-
if (i===1) {
54-
try {
55-
function walkSync(dir,match) {
56-
if( dir[dir.length-1] != '/') dir=dir.concat('/')
57-
var fs = fs || require('fs'),
58-
files = fs.readdirSync(dir);
59-
files.forEach(function(file) {
60-
var stat = fs.lstatSync(dir + file) ;
61-
if (!stat.isSymbolicLink()) {
62-
if (file==match)
63-
throw dir + file ;
64-
if (stat.isDirectory())
65-
walkSync(dir + file + '/',match);
66-
}
67-
});
68-
};
69-
walkSync('node_modules','regenerator') ;
70-
console.log("Couldn't locate regenerator runtime") ;
71-
} catch (path) {
72-
console.log("Loading regenerator runtime from "+path) ;
73-
global.regeneratorRuntime = require("./"+path);
74-
}
75-
}
85+
if (i===2)
86+
loadRegenerator() ;
87+
7688
console.log("Transforming with "+keys[i]);
7789
var t = babel.transform(testCode, transformers[keys[i]]);
7890
var f = new Function("require,resolve,reject",t.code) ;
79-
91+
92+
global.gc() ;
8093
f(require,
8194
function(result){
8295
console.log(keys[i],result.green) ;

0 commit comments

Comments
 (0)