mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-20 15:59:51 +02:00
fix: Clean up console statements in flow-huge.spec.js for linting compliance
- Remove debug console statements from performance tests - Clean up unused variables for linting compliance - Maintain test functionality while meeting code quality standards
This commit is contained in:
@@ -16,21 +16,10 @@ describe('[Text] when parsing', () => {
|
|||||||
describe('it should handle huge files', function () {
|
describe('it should handle huge files', function () {
|
||||||
// Start with a smaller test to identify bottlenecks
|
// Start with a smaller test to identify bottlenecks
|
||||||
it('it should handle medium diagrams (performance test)', function () {
|
it('it should handle medium diagrams (performance test)', function () {
|
||||||
console.log('🚀 Starting medium diagram test - generating string...');
|
|
||||||
const startStringGen = performance.now();
|
|
||||||
|
|
||||||
// Much smaller test: ~1000 edges instead of 47,917
|
// Much smaller test: ~1000 edges instead of 47,917
|
||||||
const nodes = 'A-->B;B-->A;'.repeat(500);
|
const nodes = 'A-->B;B-->A;'.repeat(500);
|
||||||
|
|
||||||
const stringGenTime = performance.now() - startStringGen;
|
|
||||||
console.log(`⏱️ String generation took: ${stringGenTime.toFixed(2)}ms`);
|
|
||||||
console.log(`📏 Generated string length: ${nodes.length} characters`);
|
|
||||||
|
|
||||||
console.log('🎯 Starting ANTLR parsing...');
|
|
||||||
const startParse = performance.now();
|
|
||||||
flow.parser.parse(`graph LR;${nodes}`);
|
flow.parser.parse(`graph LR;${nodes}`);
|
||||||
const parseTime = performance.now() - startParse;
|
|
||||||
console.log(`⏱️ ANTLR parsing took: ${parseTime.toFixed(2)}ms`);
|
|
||||||
|
|
||||||
const vert = flow.parser.yy.getVertices();
|
const vert = flow.parser.yy.getVertices();
|
||||||
const edges = flow.parser.yy.getEdges();
|
const edges = flow.parser.yy.getEdges();
|
||||||
@@ -38,15 +27,10 @@ describe('[Text] when parsing', () => {
|
|||||||
expect(edges[0].type).toBe('arrow_point');
|
expect(edges[0].type).toBe('arrow_point');
|
||||||
expect(edges.length).toBe(1000);
|
expect(edges.length).toBe(1000);
|
||||||
expect(vert.size).toBe(2);
|
expect(vert.size).toBe(2);
|
||||||
|
|
||||||
console.log(`✅ Test completed - Total time: ${(stringGenTime + parseTime).toFixed(2)}ms`);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Keep the original huge test but skip it for now
|
// Keep the original huge test but skip it for now
|
||||||
it.skip('it should handle huge diagrams (47,917 edges)', function () {
|
it.skip('it should handle huge diagrams (47,917 edges)', function () {
|
||||||
console.log('🚀 Starting huge diagram test - generating string...');
|
|
||||||
const startStringGen = performance.now();
|
|
||||||
|
|
||||||
// More efficient string generation using array join
|
// More efficient string generation using array join
|
||||||
const parts = [];
|
const parts = [];
|
||||||
|
|
||||||
@@ -60,15 +44,8 @@ describe('[Text] when parsing', () => {
|
|||||||
parts.push('A-->B;B-->A;'.repeat(275));
|
parts.push('A-->B;B-->A;'.repeat(275));
|
||||||
|
|
||||||
const nodes = parts.join('');
|
const nodes = parts.join('');
|
||||||
const stringGenTime = performance.now() - startStringGen;
|
|
||||||
console.log(`⏱️ String generation took: ${stringGenTime.toFixed(2)}ms`);
|
|
||||||
console.log(`📏 Generated string length: ${nodes.length} characters`);
|
|
||||||
|
|
||||||
console.log('🎯 Starting ANTLR parsing...');
|
|
||||||
const startParse = performance.now();
|
|
||||||
flow.parser.parse(`graph LR;${nodes}`);
|
flow.parser.parse(`graph LR;${nodes}`);
|
||||||
const parseTime = performance.now() - startParse;
|
|
||||||
console.log(`⏱️ ANTLR parsing took: ${parseTime.toFixed(2)}ms`);
|
|
||||||
|
|
||||||
const vert = flow.parser.yy.getVertices();
|
const vert = flow.parser.yy.getVertices();
|
||||||
const edges = flow.parser.yy.getEdges();
|
const edges = flow.parser.yy.getEdges();
|
||||||
@@ -76,8 +53,6 @@ describe('[Text] when parsing', () => {
|
|||||||
expect(edges[0].type).toBe('arrow_point');
|
expect(edges[0].type).toBe('arrow_point');
|
||||||
expect(edges.length).toBe(47917);
|
expect(edges.length).toBe(47917);
|
||||||
expect(vert.size).toBe(2);
|
expect(vert.size).toBe(2);
|
||||||
|
|
||||||
console.log(`✅ Test completed - Total time: ${(stringGenTime + parseTime).toFixed(2)}ms`);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user