binary-size.ts 542 B

12345678910111213141516171819
  1. import * as fs from "fs/promises";
  2. import path from "path";
  3. import { IDL } from "../target/types/bench";
  4. import { BenchData, BinarySize } from "../scripts/utils";
  5. describe("Binary size", () => {
  6. const binarySize: BinarySize = {};
  7. it(`Measure binary size of program '${IDL.name}'`, async () => {
  8. const stat = await fs.stat(path.join("target", "deploy", `${IDL.name}.so`));
  9. binarySize[IDL.name] = stat.size;
  10. });
  11. after(async () => {
  12. const bench = await BenchData.open();
  13. await bench.update({ binarySize });
  14. });
  15. });