This error caused my scripts to always exit even before the tests could start being checked.
This was the stack trace:
[11:29:44] Starting 'tests'...
[11:29:44] Running Jasmine with PhantomJS
[11:29:46] 'tests' errored after 2.42 s
[11:29:46] TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
at makeCallback (fs.js:141:11)
at Object.unlink (fs.js:912:14)
at cleanup (C:\Users\ucheo\Projects\NDBuildTools\Lesson 3\node_modules\gulp-jasmine-phantom\index.js:45:6)
at C:\Users\ucheo\Projects\NDBuildTools\Lesson 3\node_modules\gulp-jasmine-phantom\index.js:87:7
at ChildProcess.exithandler (child_process.js:298:5)
at ChildProcess.emit (events.js:182:13)
at ChildProcess.EventEmitter.emit (domain.js:460:23)
at maybeClose (internal/child_process.js:961:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
My Current (and Proposed) Solution
I found a similar issue in the Grunt version of this plugin and implemented the solution given there. In other words, I used the stack trace to locate the erroneous call to the unlink method in the cleanup function's definition and replaced fs.unlink(path) with fs.unlinkSync(path). I did not test this fix in other versions of node because the OP said he performed those tests and they worked; he also noted that the
unlinkSync method has been around since v0.1.21 so I expect that this will not be a breaking change.
node version: 10.6.0
This error caused my scripts to always exit even before the tests could start being checked. This was the stack trace:
My Current (and Proposed) Solution I found a similar issue in the Grunt version of this plugin and implemented the solution given there. In other words, I used the stack trace to locate the erroneous call to the
unlink
method in thecleanup
function's definition and replacedfs.unlink(path)
withfs.unlinkSync(path)
. I did not test this fix in other versions of node because the OP said he performed those tests and they worked; he also noted that theunlinkSync
method has been around since v0.1.21 so I expect that this will not be a breaking change.