Comparing version 14.2.0 to 14.2.1
@@ -89,3 +89,3 @@ import fs from 'node:fs'; | ||
function setProcessTitle(title) { | ||
log('Setting process title to "%s"', process.title); | ||
log('Setting process title to "%s"', title); | ||
process.title = title; | ||
@@ -92,0 +92,0 @@ } |
@@ -135,2 +135,3 @@ import fs from 'node:fs'; | ||
return new Promise((resolve, reject) => { | ||
let timeout = null; | ||
const watcher = fs | ||
@@ -140,2 +141,3 @@ .watch(base) | ||
if (type === 'rename' && filename === '.eslint_d') { | ||
clearTimeout(timeout); | ||
watcher.close(); | ||
@@ -145,4 +147,12 @@ resolve(); | ||
}) | ||
.on('error', reject); | ||
.on('error', (err) => { | ||
clearTimeout(timeout); | ||
reject(err); | ||
}); | ||
timeout = setTimeout(() => { | ||
watcher.close(); | ||
timeout = null; | ||
reject(new Error('Timed out waiting for config')); | ||
}, 2000); | ||
}); | ||
} |
@@ -19,2 +19,3 @@ import fs from 'node:fs'; | ||
let watcher; | ||
let clock; | ||
@@ -26,2 +27,3 @@ beforeEach(() => { | ||
sinon.replace(console, 'error', sinon.fake()); | ||
clock = sinon.useFakeTimers({ toFake: ['setTimeout'] }); | ||
}); | ||
@@ -236,2 +238,15 @@ | ||
}); | ||
it('resolves with null and logs timeout error', async () => { | ||
const promise = launchDaemon(resolver, 'hash', false); | ||
clock.tick(2000); | ||
await assert.resolves(promise, null); | ||
assert.calledOnceWith( | ||
console.error, | ||
'eslint_d: Failed to start daemon – Error: Timed out waiting for config' | ||
); | ||
assert.equals(process.exitCode, 1); | ||
}); | ||
}); | ||
@@ -267,3 +282,3 @@ | ||
await new Promise((resolve) => setTimeout(resolve)); | ||
await new Promise(setImmediate); | ||
@@ -270,0 +285,0 @@ assert.calledOnceWith(fs.watch, resolver.base); |
@@ -20,3 +20,3 @@ import { createRequire } from 'node:module'; | ||
const eslint = resolver.require(`${resolver.base}/lib/cli.js`); | ||
const require = createRequire(resolver.base); | ||
const require = createRequire(`${resolver.base}/`); | ||
const chalk = require('chalk'); | ||
@@ -23,0 +23,0 @@ const debug = require('debug'); |
{ | ||
"name": "eslint_d", | ||
"version": "14.2.0", | ||
"version": "14.2.1", | ||
"description": "Speed up eslint to accelerate your development workflow", | ||
@@ -5,0 +5,0 @@ "type": "module", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
93660
2445