[testing] Make tests runable in node.
[core] Add __filename, __dirname on top level.
[core] Update task scheduling.