MCPcopy Create free account
hub / github.com/exceljs/exceljs / execute

Function execute

test/testPerformance.js:89–137  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

87}
88
89function execute(options) {
90 console.log(
91 `Test Run ${options.workbook}, ${options.style}, ${options.str}, ${options.count}`
92 );
93
94 const wbOptions = {
95 filename: testFilename,
96 useStyles: options.style === 'styled',
97 useSharedStrings: options.str === 'shared',
98 };
99 const wb =
100 options.workbook === 'doc'
101 ? new Workbook(wbOptions)
102 : new WorkbookWriter(wbOptions);
103 const ws = wb.addWorksheet('data');
104 ws.columns = [
105 {header: 'Col 1', key: 'key', width: 25},
106 {header: 'Col 2', key: 'name', width: 32},
107 {header: 'Col 3', key: 'age', width: 21},
108 {header: 'Col 4', key: 'addr1', width: 18},
109 {header: 'Col 5', key: 'addr2', width: 8},
110 {header: 'Col 6', key: 'num1', width: 8},
111 {header: 'Col 7', key: 'num2', width: 8},
112 {
113 header: 'Col 8',
114 key: 'num3',
115 width: 32,
116 style: {font: fonts.comicSansUdB16},
117 },
118 ];
119 for (let i = 0; i < options.count; i++) {
120 ws.addRow({
121 key: i,
122 name: randomName(5),
123 age: randomNum(100),
124 addr1: randomName(16),
125 addr2: randomName(10),
126 num1: randomNum(10000),
127 num2: randomNum(100000),
128 num3: randomNum(1000000),
129 }).commit();
130 }
131 if (options.workbook === 'doc') {
132 console.log('Writing doc');
133 return wb.xlsx.writeFile(testFilename, wbOptions);
134 }
135 console.log('Committing Writer');
136 return wb.commit();
137}
138
139function runTest(options) {
140 const stopwatch = new HrStopwatch();

Callers

nothing calls this directly

Calls 6

randomNameFunction · 0.70
randomNumFunction · 0.70
commitMethod · 0.65
addRowMethod · 0.65
writeFileMethod · 0.65
addWorksheetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…