-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New: Configurable List Size For Per-Rule Performance Metrics (#13812)
- Loading branch information
Showing
3 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"use strict"; | ||
|
||
const { getListSize } = require("../../../lib/linter/timing"); | ||
const assert = require("chai").assert; | ||
|
||
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); | ||
}); | ||
}); | ||
}); |