Skip to content

Commit

Permalink
add delays
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjermanovic committed Dec 13, 2022
1 parent b3d70e4 commit b82bd56
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/lib/eslint/flat-eslint.js
Expand Up @@ -11,6 +11,7 @@
//------------------------------------------------------------------------------

const assert = require("assert");
const util = require("util");
const fs = require("fs");
const fsp = fs.promises;
const os = require("os");
Expand Down Expand Up @@ -41,6 +42,15 @@ function ensureDirectoryExists(dirPath) {
}
}

/**
* Does nothing for a given time.
* @param {number} time Time in ms.
* @returns {void}
*/
async function sleep(time) {
await util.promisify(setTimeout)(time);
}

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------
Expand Down Expand Up @@ -5280,6 +5290,7 @@ describe("FlatESLint", () => {
assert.strictEqual(messages[0].messageId, "missingSemi");
assert.strictEqual(messages[0].line, 1);

await sleep(100);
await fsp.writeFile(path.join(cwd, "eslint.config.js"), configFileContent.replace("always", "never"));

eslint = new FlatESLint({ cwd });
Expand Down Expand Up @@ -5312,6 +5323,7 @@ describe("FlatESLint", () => {
assert.strictEqual(messages[0].messageId, "missingSemi");
assert.strictEqual(messages[0].line, 1);

await sleep(100);
await fsp.writeFile(path.join(cwd, "eslint.config.js"), configFileContent.replace("always", "never"));

eslint = new FlatESLint({ cwd });
Expand Down

0 comments on commit b82bd56

Please sign in to comment.