-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: functions with name matching config prop cause crash (#4748)
* fix: functions with name matching config prop cause crash * fix: add test * fix: add unit test, remove integration test * fix: fix test name * fix: refactor tests * chore: clean up code * fix: clean up code * Update tests/unit/lib/functions/registry.test.js Co-authored-by: Daniel Tschinder <[email protected]> * fix: remove IO from test * chore: update contributors field Co-authored-by: Daniel Tschinder <[email protected]> Co-authored-by: JWhist <[email protected]>
- Loading branch information
1 parent
22fd4d4
commit 19aee7c
Showing
2 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const test = require('ava') | ||
const sinon = require('sinon') | ||
|
||
const { FunctionsRegistry } = require('../../../../src/lib/functions/registry') | ||
|
||
test('registry should only pass functions config to zip-it-and-ship-it', async (t) => { | ||
const functionsRegistry = new FunctionsRegistry({ | ||
projectRoot: '/projectRoot', | ||
config: { functions: { '*': {} }, plugins: ['test'] }, | ||
}) | ||
const prepareDirectoryScanStub = sinon.stub(FunctionsRegistry, 'prepareDirectoryScan') | ||
const setupDirectoryWatcherStub = sinon.stub(functionsRegistry, 'setupDirectoryWatcher') | ||
// To verify that only the functions config is passed to zip-it-ship-it | ||
const listFunctionsStub = sinon.stub(functionsRegistry, 'listFunctions') | ||
listFunctionsStub.returns(Promise.resolve([])) | ||
|
||
await functionsRegistry.scan([functionsRegistry.projectRoot]) | ||
|
||
const spyCall = listFunctionsStub.getCall(0) | ||
|
||
t.is(spyCall.lastArg.config, functionsRegistry.config.functions) | ||
|
||
t.teardown(async () => { | ||
await listFunctionsStub.restore() | ||
await setupDirectoryWatcherStub.restore() | ||
await prepareDirectoryScanStub.restore() | ||
}) | ||
}) |
19aee7c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π Benchmark results
Package size: 227 MB
19aee7c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π Benchmark results
Package size: 227 MB
19aee7c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π Benchmark results
Package size: 227 MB
19aee7c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π Benchmark results
Package size: 227 MB