From c64b1aef07dd1f036f1e940a2b104db63406cafc Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sun, 27 Jan 2019 20:09:09 -0500 Subject: [PATCH] test: refactor test/common/report.js - Don't unnecessarily require('../common'). - Eliminate state maintained in tmppath. - validate() was being used synchronously, but was actually asynchronous. Make it synchronous. - Other misc. drive by cleanup. PR-URL: https://github.com/nodejs/node/pull/25754 Reviewed-By: Richard Lau Reviewed-By: Anto Aravinth Reviewed-By: Gireesh Punathil --- test/common/report.js | 52 ++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/test/common/report.js b/test/common/report.js index 646660da4961f7..1a6d9598d35ca4 100644 --- a/test/common/report.js +++ b/test/common/report.js @@ -1,43 +1,39 @@ +/* eslint-disable node-core/required-modules */ 'use strict'; -require('../common'); const assert = require('assert'); const fs = require('fs'); const path = require('path'); -const REPORT_SECTIONS = [ 'header', - 'javascriptStack', - 'nativeStack', - 'javascriptHeap', - 'libuv', - 'environmentVariables', - 'sharedObjects' ]; - -let tmppath = ''; - -exports.findReports = (pid, path) => { +function findReports(pid, dir) { // Default filenames are of the form // report..