Skip to content

Commit

Permalink
fix: fixed tests and handling of optional argument analysisContext
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvi3d committed Mar 11, 2022
1 parent 714c7fe commit 98b10c6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/analysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export async function analyzeFolders(options: FileAnalysisOptions): Promise<File
...options.connection,
...options.analysisOptions,
shard: calcHash(fileBundle.baseDir),
analysisContext: options.analysisContext,
...(options.analysisContext ? { analysisContext: options.analysisContext } : {}),
});

if (analysisResults.type === 'legacy') {
Expand Down
1 change: 0 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { CustomDCIgnore, DefaultDCIgnore } from '@deepcode/dcignore';

export const MAX_PAYLOAD = 4 * 1024 * 1024;
export const MAX_FILE_SIZE = 128 * 1024;
export const defaultBaseURL = 'https://api.snyk.deepcode.ai';
export const HASH_ALGORITHM = 'sha256';
export const ENCODE_TYPE = 'hex';
export const GIT_FILENAME = '.git';
Expand Down
10 changes: 4 additions & 6 deletions tests/analysis.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@ describe('Functional test of analysis', () => {
bundle.analysisResults.sarif.runs[0].tool.driver.rules![sampleRes.ruleIndex].id,
);

expect(bundle.analysisResults.timing.analysis).toBeGreaterThanOrEqual(
bundle.analysisResults.timing.fetchingCode,
);
expect(bundle.analysisResults.timing.analysis).toBeGreaterThanOrEqual(0);
expect(bundle.analysisResults.timing.fetchingCode).toBeGreaterThanOrEqual(0);
expect(bundle.analysisResults.timing.queue).toBeGreaterThanOrEqual(0);
expect(new Set(bundle.analysisResults.coverage)).toEqual(
new Set([
Expand Down Expand Up @@ -265,9 +264,8 @@ describe('Functional test of analysis', () => {
if (!sampleRes.ruleIndex) return; // TS trick
expect(sampleRes.ruleId).toEqual(sarifResults.runs[0].tool.driver.rules![sampleRes.ruleIndex].id);

expect(extendedBundle.analysisResults.timing.analysis).toBeGreaterThanOrEqual(
extendedBundle.analysisResults.timing.fetchingCode,
);
expect(extendedBundle.analysisResults.timing.analysis).toBeGreaterThanOrEqual(0);
expect(extendedBundle.analysisResults.timing.fetchingCode).toBeGreaterThanOrEqual(0);
expect(extendedBundle.analysisResults.timing.queue).toBeGreaterThanOrEqual(0);
expect(new Set(extendedBundle.analysisResults.coverage)).toEqual(
new Set([
Expand Down

0 comments on commit 98b10c6

Please sign in to comment.