mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-10 04:22:12 +00:00
[build-utils] Add NodejsLambda class (#7423)
When an instance of this class is returned in a Builder's `output`, it is a signal to the build system that it needs to add additional files to the final Lambda before creating the zip file.
This commit is contained in:
21
packages/build-utils/test/unit.nodejs-lambda.test.ts
vendored
Normal file
21
packages/build-utils/test/unit.nodejs-lambda.test.ts
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import { NodejsLambda, FileBlob } from '../src';
|
||||
|
||||
describe('Test `NodejsLambda`', () => {
|
||||
it('should create an instance', () => {
|
||||
const helloSrc = 'module.exports = (req, res) => res.end("hi");';
|
||||
const lambda = new NodejsLambda({
|
||||
files: {
|
||||
'api/hello.js': new FileBlob({ data: helloSrc }),
|
||||
},
|
||||
handler: 'api/hello.js',
|
||||
runtime: 'node14.x',
|
||||
shouldAddHelpers: true,
|
||||
shouldAddSourcemapSupport: false,
|
||||
});
|
||||
expect(lambda.handler).toEqual('api/hello.js');
|
||||
expect(lambda.runtime).toEqual('node14.x');
|
||||
expect(lambda.shouldAddHelpers).toEqual(true);
|
||||
expect(lambda.shouldAddSourcemapSupport).toEqual(false);
|
||||
expect(lambda.awsLambdaHandler).toBeUndefined();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user