Skip to content

Commit

Permalink
fix: lint warnings (#451)
Browse files Browse the repository at this point in the history
* fix: lint warnings

* fixup! fix: lint warnings
  • Loading branch information
fredrik committed Mar 21, 2023
1 parent 2a5c858 commit 9348a73
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/bundle.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'assert';
import { build, BuildResult } from 'esbuild';
import type { BuildOptions } from 'esbuild';
import { build } from 'esbuild';
import type { BuildOptions, BuildResult } from 'esbuild';
import fs from 'fs-extra';
import pMap from 'p-map';
import path from 'path';
Expand Down
6 changes: 1 addition & 5 deletions src/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ export function extractFunctionEntries(

// Check that the file indeed exists.
if (!fs.existsSync(path.join(cwd, entry))) {
console.log(`Cannot locate entrypoint, ${entry} not found`);

throw new Error('Compilation failed');
throw new Error(`Compilation failed. Cannot locate entrypoint, ${entry} not found`);
}

return [{ entry, func: null }];
Expand Down Expand Up @@ -92,8 +90,6 @@ export function extractFunctionEntries(
}

// Can't find the files. Watch will have an exception anyway. So throw one with error.
console.log(`Cannot locate handler - ${fileName} not found`);

throw new Error(
'Compilation failed. Please ensure you have an index file with ext .ts or .js, or have a path listed as main key in package.json'
);
Expand Down
4 changes: 0 additions & 4 deletions src/tests/helper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import type { Configuration, DependencyMap } from '../types';

jest.mock('fs-extra');

const consoleSpy = jest.spyOn(console, 'log').mockImplementation();

afterAll(() => {
jest.resetAllMocks();
});
Expand Down Expand Up @@ -173,7 +171,6 @@ describe('extractFunctionEntries', () => {
};

expect(() => extractFunctionEntries(cwd, 'aws', functionDefinitions)).toThrowError();
expect(consoleSpy).toBeCalled();
});
});

Expand Down Expand Up @@ -333,7 +330,6 @@ describe('extractFunctionEntries', () => {
};

expect(() => extractFunctionEntries(cwd, 'azure', functionDefinitions)).toThrowError();
expect(consoleSpy).toBeCalled();
});
});
});
Expand Down

0 comments on commit 9348a73

Please sign in to comment.