Update test framework: fix run_tests.py to support all test files, add auto-import-check for test files

This commit is contained in:
qiaoxinjiu
2026-05-09 15:11:30 +08:00
parent eb053a347f
commit eaba8328da
21739 changed files with 2236758 additions and 719 deletions

30
node_modules/throttleit/index.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
function throttle(function_, wait) {
if (typeof function_ !== 'function') {
throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof function_}\`.`);
}
// TODO: Add `wait` validation too in the next major version.
let timeoutId;
let lastCallTime = 0;
return function throttled(...arguments_) { // eslint-disable-line func-names
clearTimeout(timeoutId);
const now = Date.now();
const timeSinceLastCall = now - lastCallTime;
const delayForNextCall = wait - timeSinceLastCall;
if (delayForNextCall <= 0) {
lastCallTime = now;
function_.apply(this, arguments_);
} else {
timeoutId = setTimeout(() => {
lastCallTime = Date.now();
function_.apply(this, arguments_);
}, delayForNextCall);
}
};
}
module.exports = throttle;