Skip to content

Commit

Permalink
fix: remove archiver from test
Browse files Browse the repository at this point in the history
  • Loading branch information
shetzel committed May 23, 2023
1 parent b6705c9 commit e904367
Showing 1 changed file with 15 additions and 22 deletions.
37 changes: 15 additions & 22 deletions test/resolve/treeContainers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
/* eslint-disable class-methods-use-this */

import { join, normalize } from 'path';
import { pipeline as cbPipeline, Readable, Writable } from 'stream';
import { promisify } from 'util';
import { Readable } from 'stream';
import { Messages, SfError } from '@salesforce/core';
import { assert, expect } from 'chai';
import { createSandbox } from 'sinon';
import * as fs from 'graceful-fs';
import * as unzipper from 'unzipper';
import { create as createArchive } from 'archiver';
import * as JSZip from 'jszip';
import {
MetadataResolver,
NodeFSTreeContainer,
Expand Down Expand Up @@ -130,27 +129,21 @@ describe('Tree Containers', () => {
let zipBuffer: Buffer;

const filesRoot = join('.', 'main', 'default');
const moreFiles = join(filesRoot, 'morefiles');

before(async () => {
const pipeline = promisify(cbPipeline);
const archive = createArchive('zip', { zlib: { level: 3 } });
const bufferWritable = new Writable();
const buffers: Buffer[] = [];
bufferWritable._write = (chunk: Buffer, encoding: string, cb: () => void): void => {
buffers.push(chunk);
cb();
};
pipeline(archive, bufferWritable);

archive.append('', { name: 'main/' });
archive.append('', { name: 'main/default/' });
archive.append('test text', { name: 'main/default/test.txt' });
archive.append('test text 2', { name: 'main/default/test2.txt' });
archive.append('test text 3', { name: 'main/default/morefiles/test3.txt' });

await archive.finalize();

zipBuffer = Buffer.concat(buffers);
const zip = new JSZip();
zip
?.file(join(filesRoot, 'test.txt'), 'test text')
?.file(join(filesRoot, 'test2.txt'), 'test text 2')
?.file(join(moreFiles, 'test3.txt'), 'test text 3');

zipBuffer = await zip.generateAsync({
type: 'nodebuffer',
compression: 'DEFLATE',
compressionOptions: { level: 3 },
});

tree = await ZipTreeContainer.create(zipBuffer);
});

Expand Down

2 comments on commit e904367

@svc-cli-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: e904367 Previous: 4824e4f Ratio
eda-componentSetCreate-linux 252 ms 209 ms 1.21
eda-sourceToMdapi-linux 6144 ms 6142 ms 1.00
eda-sourceToZip-linux 5384 ms 4898 ms 1.10
eda-mdapiToSource-linux 4569 ms 3795 ms 1.20
lotsOfClasses-componentSetCreate-linux 500 ms 448 ms 1.12
lotsOfClasses-sourceToMdapi-linux 9671 ms 8766 ms 1.10
lotsOfClasses-sourceToZip-linux 7997 ms 6893 ms 1.16
lotsOfClasses-mdapiToSource-linux 5233 ms 4061 ms 1.29
lotsOfClassesOneDir-componentSetCreate-linux 845 ms 706 ms 1.20
lotsOfClassesOneDir-sourceToMdapi-linux 14120 ms 11296 ms 1.25
lotsOfClassesOneDir-sourceToZip-linux 12665 ms 10844 ms 1.17
lotsOfClassesOneDir-mdapiToSource-linux 9317 ms 6978 ms 1.34

This comment was automatically generated by workflow using github-action-benchmark.

@svc-cli-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: e904367 Previous: 4824e4f Ratio
eda-componentSetCreate-win32 386 ms 625 ms 0.62
eda-sourceToMdapi-win32 7871 ms 11388 ms 0.69
eda-sourceToZip-win32 6921 ms 7294 ms 0.95
eda-mdapiToSource-win32 7510 ms 11101 ms 0.68
lotsOfClasses-componentSetCreate-win32 877 ms 1501 ms 0.58
lotsOfClasses-sourceToMdapi-win32 11418 ms 16602 ms 0.69
lotsOfClasses-sourceToZip-win32 8549 ms 11108 ms 0.77
lotsOfClasses-mdapiToSource-win32 8864 ms 13070 ms 0.68
lotsOfClassesOneDir-componentSetCreate-win32 1515 ms 2583 ms 0.59
lotsOfClassesOneDir-sourceToMdapi-win32 18503 ms 26116 ms 0.71
lotsOfClassesOneDir-sourceToZip-win32 15066 ms 18128 ms 0.83
lotsOfClassesOneDir-mdapiToSource-win32 16001 ms 23427 ms 0.68

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.