Closed rwaldron closed 8 years ago
Originally discovered here https://github.com/brianarn/t2-rgb-led-rainbow
I took a couple of stabs at this, and am at an interesting spot:
First, I was looking at process.cwd()
but it turns out, that doesn't return what I'd expect.
t2 run index.js
: /root
t2 push index.js
: /
Then, I switched to __dirname
instead, which generally provides what I'd expect:
t2 run index.js
: /tmp/remote-script
t2 push index.js
: /app/remote-script
Under my current detection, under run
the REPL will still be available (though in practice, I'm finding that it's not really usable), but under push
it turns off, and I've verified this via my t2-rgb-led-rainbow repo as linked above.
However, I'm finding that authoring tests in this environment is difficult, as __dirname
is per-module, so I can't easily mock it in any reasonable fashion.
__dirname
since it's local to the test moduleglobal.__dirname
it still doesn't work, since __dirname
appears to be a local variableStill trying other things, but wanted to document steps thus far.
Make a function that returns __dirname and expose that function in the test environment, the you can stub that instead
Released in v0.5.2
By setting:
In the
Tessel
constructor (before emitting "ready"), we can inform Johnny-Five that it must not create a repl instance.The criteria is:
/app/remote-script/
Assigning to @brianarn