20 lines
942 B
TypeScript
Executable file
20 lines
942 B
TypeScript
Executable file
|
|
import { Project, SyntaxKind } from 'ts-morph';
|
|
const project = new Project({ tsConfigFilePath: 'C:/ScriptoriumAI/scriptoriumai-ui/tsconfig.json' });
|
|
const sf = project.getSourceFileOrThrow('C:/ScriptoriumAI/scriptoriumai-ui/src/__tests__/Runboard.telemetry-lockstep-parity.test.tsx');
|
|
|
|
const tests = sf.getDescendantsOfKind(SyntaxKind.CallExpression).filter(c => c.getExpression().getText() === 'it');
|
|
tests.sort((a,b) => b.getWidth() - a.getWidth());
|
|
const biggestTest = tests[0];
|
|
|
|
const stmts = biggestTest.getArguments()[1].asKindOrThrow(SyntaxKind.ArrowFunction).getBody().asKindOrThrow(SyntaxKind.Block).getStatements();
|
|
|
|
let sorted = [...stmts].sort((a,b) => b.getWidth() - a.getWidth());
|
|
for(let i=0; i<10; i++) {
|
|
const s = sorted[i];
|
|
if(s) {
|
|
console.log('Stmt ' + i + ' size: ~' + Math.round(s.getWidth()/1024) + 'KB (' + s.getKindName() + ')');
|
|
console.log(s.getText().substring(0, 100) + '...');
|
|
}
|
|
}
|
|
|