diff --git a/src/index.ts b/src/index.ts index a2f012d..d653141 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,9 +7,9 @@ import type { RootHookObject } from 'mocha' const session = new inspector.Session() const procname = process.argv0 -const pkgname = readpkg.sync()?.packageJson.name || null +const pkgname = readpkg.sync()?.packageJson.name const pid = process.pid -const filename = `${pkgname ?? procname}.${pid}.cpuprofile` +const filename = `${pkgname?.length ? pkgname : procname}.${pid}.cpuprofile` const destination = path.resolve(process.cwd(), filename) const mochaHooks: RootHookObject = {