Comments (11)
Not sure I understand the question.
from njstrace.
hi,
could you please help me? It seems async is not supported.
If I change the example file to this, exception happens when I try to run.
// *** mymod.js ***
exports.run = async function(number) {
number = await first(number);
printResult(number);
}
:
:
from njstrace.
@drv1234 async/await is part of ES8, need to check if it supported by the javascript parser being used
from njstrace.
I use the latest node js. Without njstrace instrment the code runs fine.
from njstrace.
here is the printout:
njsTrace: New instance of NJSTrace created with config: { enabled: true,
files: [ '/*.js', '!/node_modules/**' ],
wrapFunctions: false,
logger: true,
inspectArgs: true }
njsTrace: Creating new Injector and hijacking Module.prototype._compile
njsTrace: Setting global.njsTraceEntry function
njsTrace: Setting global.njsTraceExit function
njsTrace: Setting global.njsOnCatchClause function
njsTrace: njsTrace done loading...
njsTrace: Instrumenting: c:\temp\mymod.js
njsTrace: ERROR: Error instrumenting file: c:\temp\mymod.js , Exception: { Error: Line 3: Unexpected token function
at throwError (c:\temp\node_modules\falafel\node_modules\esprima\esprima.js:1467:21)
at throwUnexpected (c:\temp\node_modules\falafel\node_modules\esprima\esprima.js:1521:13)
at consumeSemicolon (c:\temp\node_modules\falafel\node_modules\esprima\esprima.js:1605:13)
at parseStatement (c:\temp\node_modules\falafel\node_modules\esprima\esprima.js:2853:9)
at c:\temp\node_modules\falafel\node_modules\esprima\esprima.js:3588:38
at parseSourceElement (c:\temp\node_modules\falafel\node_modules\esprima\esprima.js:3073:20)
at parseFunctionSourceElements (c:\temp\node_modules\falafel\node_modules\esprima\esprima.js:2905:29)
at c:\temp\node_modules\falafel\node_modules\esprima\esprima.js:3588:38
at parseFunctionExpression (c:\temp\node_modules\falafel\node_modules\esprima\esprima.js:3045:16)
at c:\temp\node_modules\falafel\node_modules\esprima\esprima.js:3588:38
index: 104,
lineNumber: 3,
column: 21,
description: 'Unexpected token function' }
c:\temp\main.js:10
mymod.run(parseFloat(Math.random().toFixed(4)));
^
TypeError: mymod.run is not a function
at Object. (c:\temp\main.js:10:7)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
from njstrace.
I know async await is suppurted in Nodejs, it is not supported by the library I am using to parse the javascript files (at lease in the way I'm currently doing it)
from njstrace.
Thanks.
Are you planning to support it in the near future?
Or shall I find other ways?
from njstrace.
It is really up to whether this library supports it, if it does it should be relatively easy to support it. I'll try to find some time to check it on the weekend
from njstrace.
Thank you in advance!
Please let me know.
from njstrace.
@drv1234 Please see if the latest version (1.0.1) works for you. Did some very basic async/await and it seems ok, not sure how it will work on a large scale project...
from njstrace.
hi,
thanks, I tried on my project and it works like a charm.
But...
The named (optional) parameters are not printed even if they are in the caller line.
I don't know is it up to you or it comes from external lib.
(unfortunately there are a lot of this kind of function in my project, because it is a test framework and it is continuously developed but older test are not modified)
To see, modify the example:
// *** main.js
:
mymod.run(parseFloat(Math.random().toFixed(4)), xx=11);
// *** mymod.js ***
exports.run = async function (number, xx=22) {
from njstrace.
Related Issues (20)
- Print function arguments and return value
- Don't leak the "arguments" object
- Check why retLine is off by 1 line HOT 1
- this.config.files throws an error HOT 1
- Doesn't work when running from a different working directory HOT 1
- Not working with generators HOT 6
- Won't parse spread operator HOT 2
- arrow functions without { } HOT 10
- Error instrumenting bluebird HOT 5
- How to trace ES6 Code call stack HOT 3
- Support try/catch without error HOT 2
- Error instrumenting OWASP's juice-shop HOT 7
- Tracing Node's core modules? HOT 4
- babel-node: this.log is not a function HOT 3
- Problem with tracing node_modules HOT 2
- trace js code on each step of code execution along with storing the variables value change. HOT 2
- Tracing vm Script HOT 1
- Tracing code execution of an Angular 2+/TypeScript/JavaScript application HOT 1
- [Question]: Running njsTrace in the context of tests HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from njstrace.