Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: analysis support for builtin modules #8

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
feat: mock _http_*
  • Loading branch information
werifu committed Mar 28, 2023
commit 6bb3902246972693b1a9a78f2aeb190926fd2d8d
35 changes: 35 additions & 0 deletions src/mockbuiltin/_http_agent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
class Agent {
constructor(...args) {
for (const arg of args) arg();
}
createConnection(...args) {
for (const arg of args) arg();
}
getName(...args) {
for (const arg of args) arg();
}
addRequest(...args) {
for (const arg of args) arg();
}
createSocket(...args) {
for (const arg of args) arg();
}
removeSocket(...args) {
for (const arg of args) arg();
}
keepSocketAlive(...args) {
for (const arg of args) arg();
}
reuseSocket(...args) {
for (const arg of args) arg();
}
destroy(...args) {
for (const arg of args) arg();
return this;
}
}

module.exports = {
Agent,
globalAgent: new Agent(),
}
191 changes: 191 additions & 0 deletions src/mockbuiltin/_http_client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
class ClientRequest {
_onPendingData(...args) {
for (const arg of args) arg();
}
constructor(...args) {
for (const arg of args) arg();
}
_finish(...args) {
for (const arg of args) arg();
}
_implicitHeader(...args) {
for (const arg of args) arg();
}
abort(...args) {
for (const arg of args) arg();
}
destroy(...args) {
for (const arg of args) arg();
}
onSocket(...args) {
for (const arg of args) arg();
}
_deferToConnect(...args) {
for (const arg of args) arg();
}
setTimeout(...args) {
for (const arg of args) arg();
return this;
}
setNoDelay(...args) {
for (const arg of args) arg();
}
setSocketKeepAlive(...args) {
for (const arg of args) arg();
}
clearTimeout(...args) {
for (const arg of args) arg();
}
_renderHeaders(...args) {
for (const arg of args) arg();
}
cork(...args) {
for (const arg of args) arg();
}
uncork(...args) {
for (const arg of args) arg();
}
_send(...args) {
for (const arg of args) arg();
}
_writeRaw(...args) {
for (const arg of args) arg();
}
_storeHeader(...args) {
for (const arg of args) arg();
}
setHeader(...args) {
for (const arg of args) arg();
return this;
}
appendHeader(...args) {
for (const arg of args) arg();
return this;
}
getHeader(...args) {
for (const arg of args) arg();
}
getHeaderNames(...args) {
for (const arg of args) arg();
}
getRawHeaderNames(...args) {
for (const arg of args) arg();
}
getHeaders(...args) {
for (const arg of args) arg();
}
hasHeader(...args) {
for (const arg of args) arg();
}
removeHeader(...args) {
for (const arg of args) arg();
}
write(...args) {
for (const arg of args) arg();
}
addTrailers(...args) {
for (const arg of args) arg();
}
end(...args) {
for (const arg of args) arg();
return this;
}
_flush(...args) {
for (const arg of args) arg();
}
_flushOutput(...args) {
for (const arg of args) arg();
}
flushHeaders(...args) {
for (const arg of args) arg();
}
pipe(...args) {
for (const arg of args) arg();
}
setMaxListeners(...args) {
for (const arg of args) arg();
}
getMaxListeners(...args) {
for (const arg of args) arg();
}
emit(...args) {
for (const arg of args) arg();
}
addListener(...args) {
for (const arg of args) arg();
return this;
}
on(...args) {
for (const arg of args) arg();
return this;
}
prependListener(...args) {
for (const arg of args) arg();
return this;
}
once(...args) {
for (const arg of args) arg();
return this;
}
prependOnceListener(...args) {
for (const arg of args) arg();
return this;
}
removeListener(...args) {
for (const arg of args) arg();
return this;
}
off(...args) {
for (const arg of args) arg();
return this;
}
removeAllListeners(...args) {
for (const arg of args) arg();
}
listeners(...args) {
for (const arg of args) arg();
}
rawListeners(...args) {
for (const arg of args) arg();
}
listenerCount(...args) {
for (const arg of args) arg();
}
eventNames(...args) {
for (const arg of args) arg();
}
__defineGetter__(...args) {
for (const arg of args) arg();
}
__defineSetter__(...args) {
for (const arg of args) arg();
}
hasOwnProperty(...args) {
for (const arg of args) arg();
}
__lookupGetter__(...args) {
for (const arg of args) arg();
}
__lookupSetter__(...args) {
for (const arg of args) arg();
}
isPrototypeOf(...args) {
for (const arg of args) arg();
}
propertyIsEnumerable(...args) {
for (const arg of args) arg();
}
toString(...args) {
for (const arg of args) arg();
}
valueOf(...args) {
for (const arg of args) arg();
}
toLocaleString(...args) {
for (const arg of args) arg();
}
}

module.exports = {
ClientRequest
};
23 changes: 23 additions & 0 deletions src/mockbuiltin/_http_common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
function checkInvalidHeaderChar(...args) {
for (const arg of args) arg();
}
function checkIsHttpToken(...args) {
for (const arg of args) arg();
}
function freeParser(...args) {
for (const arg of args) arg();
}
function isLenient(...args) {
for (const arg of args) arg();
}
function prepareError(...args) {
for (const arg of args) arg();
}

module.exports = {
_checkInvalidHeaderChar: checkInvalidHeaderChar,
_checkIsHttpToken: checkIsHttpToken,
freeParser,
isLenient,
prepareError,
};
41 changes: 41 additions & 0 deletions src/mockbuiltin/_http_incoming.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
class IncomingMessage {
constructor(...args) {
for (const arg of args) arg();
}
setTimeout(...args) {
for (const arg of args) arg();
return this;
}
_read(...args) {
for (const arg of args) arg();
}
_destroy(...args) {
for (const arg of args) arg();
}
_addHeaderLines(...args) {
for (const arg of args) arg();
}
_addHeaderLine(...args) {
for (const arg of args) arg();
}
_addHeaderLineDistinct(...args) {
for (const arg of args) arg();
}
_dump(...args) {
for (const arg of args) arg();
}
}

function readStart(...args) {
for (const arg of args) arg();
}

function readStop(...args) {
for (const arg of args) arg();
}

module.exports = {
IncomingMessage,
readStart,
readStop
};
Loading