Commit 62c42ed3 authored by Paul Lewis's avatar Paul Lewis Committed by Commit Bot

[DevTools] Fixes local run of Karma

Updates paths and exclusions so we only test the right things, and Karma
TypeScript knows where to look for types.

Change-Id: I8f984839b3907b119a2edc3f4b452e5465d1c82a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1824895
Commit-Queue: Yang Guo <yangguo@chromium.org>
Reviewed-by: default avatarYang Guo <yangguo@chromium.org>
Auto-Submit: Paul Lewis <aerotwist@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699767}
parent 0b068f91
......@@ -32,16 +32,19 @@ module.exports = function(config) {
compilerOptions: {
target: "esnext",
module: "esnext",
typeRoots: ["./third_party/devtools-node-modules/third_party/node_modules/@types"]
typeRoots: ["../../../../third_party/devtools-node-modules/third_party/node_modules/@types"]
},
coverageOptions: {
instrumentation: false
},
bundlerOptions: {
resolve: {
directories: ["./third_party/devtools-node-modules/third_party/node_modules"]
directories: ["../../../../third_party/devtools-node-modules/third_party/node_modules"]
}
}
},
exclude: [
"scripts"
]
},
proxies: {
......
......@@ -15,7 +15,6 @@ declare global {
upperBound(value: T, comparator?: (a: T, b: T) => number): number;
lowerBound(value: T, comparator?: (a: T, b: T) => number): number;
binaryIndexOf(value: T, comparator: (a: T, b: T) => number): number;
qselect(idx: number): number;
sortRange(comparator: (a: T, b: T) => number, leftBound: number, rightBound: number, sortWindowLeft: number, sortWindowRight: number): T[];
}
......@@ -162,28 +161,6 @@ describe('Utilities', () => {
}
});
it('q selects', () => {
let testArrays =
[[], [0], [0, 0, 0, 0, 0, 0, 0, 0], [4, 3, 2, 1], [1, 2, 3, 4, 5], [-1, 3, 2, 7, 7, 7, 10, 12, 3, 4, -1, 2]];
function testArray(array: number[]) {
function compare(a: number, b: number) {
return a - b;
}
const sorted = array.slice(0).sort(compare);
const reference = {min: sorted[0], median: sorted[Math.floor(sorted.length / 2)], max: sorted[sorted.length - 1]};
const actual = {
min: array.slice(0).qselect(0),
median: array.slice(0).qselect(Math.floor(array.length / 2)),
max: array.slice(0).qselect(array.length - 1)
};
assert.deepStrictEqual(reference, actual);
}
for (let i = 0, l = testArrays.length; i < l; ++i)
testArray(testArrays[i]);
});
it('sorts ranges', () => {
const testArrays = [[], [1], [2, 1], [6, 4, 2, 7, 10, 15, 1], [10, 44, 3, 6, 56, 66, 10, 55, 32, 56, 2, 5]];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment