intern icon indicating copy to clipboard operation
intern copied to clipboard

Benchmark reporter exception: no such file or directory

Open inad9300 opened this issue 7 years ago • 2 comments

I'm not sure what to expect from the benchmark reporter to start with, as it is poorly documented (hopefully something that will improve in the near future), but when running the reporter, this is what I get:

! ENOENT: no such file or directory, open ''
Error: ENOENT: no such file or directory, open ''
  at Object.fs.openSync  <fs.js:584:18>
  at Object.fs.writeFileSync  <fs.js:1316:33>
  at BenchmarkReporter.runEnd  <src/lib/reporters/Benchmark.ts:129:3>
  at <src/lib/reporters/Reporter.ts:94:31>
  at <src/lib/executors/Executor.ts:302:30>
  at <node_modules/@dojo/core/async/Task.ts:351:12>
  at handler  <node_modules/@dojo/core/async/ExtensiblePromise.ts:229:14>
  at process._tickCallback  <internal/process/next_tick.js:109:7>

One suggestion I can make is to avoid running this reporter if benchmark is false. But still, Intern shouldn't blow up in this uncontrolled way.

inad9300 avatar Mar 03 '18 20:03 inad9300

OK, by giving it a filename it seems to work, i.e.

{
    "name": "benchmark",
    "options": {
        "filename": "test.json"
    }
},
{
    "name": "jsoncoverage",
    "options": {
        "filename": "coverage.json"
    }
}

But the error message should be clearer. (And I still think the reporter should not run with benchmarking disabled.)

Notice also the big inconsistency in the output of the two reporters above: the first creates test.json while the second one creates coverage/coverage.json (and the directory cannot be configured for the second case as far as I can tell).

inad9300 avatar Mar 03 '18 21:03 inad9300

I found another exception...

! Cannot read property 'stats' of undefined
TypeError: Cannot read property 'stats' of undefined
  at checkTest  <src/lib/reporters/Benchmark.ts:240:34>
  at BenchmarkReporter.testEnd  <src/lib/reporters/Benchmark.ts:340:20>
  at <src/lib/reporters/Reporter.ts:94:31>
  at <src/lib/executors/Executor.ts:302:30>
  at <node_modules/@dojo/core/async/Task.ts:351:12>
  at handler  <node_modules/@dojo/core/async/ExtensiblePromise.ts:229:14>

Is there any real-world example of a benchmarking setup with Intern that I can have a look at? I'm trying to create a performance test for a function (such that I have the function in a file, unit tests in another file, and performance tests in a third file), but I have no clue how to properly configure Intern.

inad9300 avatar Mar 04 '18 11:03 inad9300