mirror of
https://github.com/hanzoai/eslint.git
synced 2026-10-30 19:38:10 +00:00
* chore: remove formatting-related lint rules internally * chore: formatted files with Prettier via trunk fmt * rm .prettierrc.json * chore: correct comment directives and formatting * Apply introduced fmt changes post-merge * Also disable MD010 and MD030 in preparation for 19355 * Also disable MD013 in preparation for 19355 * Updated tools/update-rule-type-headers.js to print tabs * Fix introduced issues from the main merge * Manually format conf/*.json * Switch conf/*.json files back to two spaces, per prettier config * chore: empty commit to hopefully unblock GitHub
60 lines
1.7 KiB
JavaScript
60 lines
1.7 KiB
JavaScript
"use strict";
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Requirements
|
|
//------------------------------------------------------------------------------
|
|
|
|
const { getListSize } = require("../../../lib/linter/timing");
|
|
const assert = require("chai").assert;
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Tests
|
|
//------------------------------------------------------------------------------
|
|
|
|
describe("timing", () => {
|
|
describe("getListSize()", () => {
|
|
after(() => {
|
|
delete process.env.TIMING;
|
|
});
|
|
|
|
it("returns minimum list size with small environment variable value", () => {
|
|
delete process.env.TIMING; // With no value.
|
|
assert.strictEqual(getListSize(), 10);
|
|
|
|
process.env.TIMING = "true";
|
|
assert.strictEqual(getListSize(), 10);
|
|
|
|
process.env.TIMING = "foo";
|
|
assert.strictEqual(getListSize(), 10);
|
|
|
|
process.env.TIMING = "0";
|
|
assert.strictEqual(getListSize(), 10);
|
|
|
|
process.env.TIMING = "1";
|
|
assert.strictEqual(getListSize(), 10);
|
|
|
|
process.env.TIMING = "5";
|
|
assert.strictEqual(getListSize(), 10);
|
|
|
|
process.env.TIMING = "10";
|
|
assert.strictEqual(getListSize(), 10);
|
|
});
|
|
|
|
it("returns longer list size with larger environment variable value", () => {
|
|
process.env.TIMING = "11";
|
|
assert.strictEqual(getListSize(), 11);
|
|
|
|
process.env.TIMING = "100";
|
|
assert.strictEqual(getListSize(), 100);
|
|
});
|
|
|
|
it("returns maximum list size with environment variable value of 'all'", () => {
|
|
process.env.TIMING = "all";
|
|
assert.strictEqual(getListSize(), Number.POSITIVE_INFINITY);
|
|
|
|
process.env.TIMING = "ALL";
|
|
assert.strictEqual(getListSize(), Number.POSITIVE_INFINITY);
|
|
});
|
|
});
|
|
});
|