Category: Nodejs

0

Debug mocha using visual studio code

Add the following configuration in your launch.json { “name”: “Run mocha”, “type”: “node”, “request”: “launch”, “program”: “${workspaceRoot}/node_modules/mocha/bin/mocha”, “stopOnEntry”: false, “args”: [ “test/**/*.js”, “–inspect”, “–debug-brk”, “–no-timeouts” ], “cwd”: “${workspaceRoot}”, “runtimeExecutable”: null, “env”: { “NODE_ENV”: “testing”...

0

Call and retry last Allocation failed

Solution: node –max–old-space-size=4096 <filename> You need to tell node to overwrite default heap size in v8. To see all the available v8 flags run the following command: node –v8-options —Further details on chromium bug

0

path.join vs path.resolve in node.js

path.join([…paths]) joins all the path segments using platform specific delimiter. path.join(‘/foo’, ‘bar’, ‘baz/zxcv’, ‘abcd’, ‘..’) // ‘/foo/bar/baz/zxcv/abcd/…’ path.resolve([…paths]) Resolves all the path segments into an absolute path. It processes from right to left, until...

0

path.join in nodejs

path.join() does two things : Joins all given path segments together using the platform specific separator as a delimiter Normalizes the resulting path path.join(‘src/’, ‘js/Router.jsx’); ‘src/js/Router.jsx’ on OSX and Linux ‘srcjsRouter.jsx’ on Windows Here,...