Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
5 changes: 3 additions & 2 deletions lib/ActionGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ Note: characters can only be split by '-'.
if (options.dependencies) {
utils.addDependencies(this, options.dependencies)
}
// make sure wskdebug is there
utils.addDependencies(this, { '@openwhisk/wskdebug': '^1.3.0', ...options.devDependencies }, true)
if (options.devDependencies) {
utils.addDependencies(this, options.devDependencies, true)
}
// make sure the node engines are added
this.addPackageJsonNodeEngines()
}
Expand Down
12 changes: 6 additions & 6 deletions test/lib/ActionGenerator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ Note: characters can only be split by '-'.
utils.readPackageJson.mockReturnValue({})
utils.readYAMLConfig.mockReturnValue({})

// third parameter options is {} by default here
actionGenerator.addAction('myAction', './templateFile.js')

// 1. test copy action template to right destination
Expand All @@ -192,9 +193,8 @@ Note: characters can only be split by '-'.
'runtimeManifest',
// function path should be checked to be relative to config file
{ packages: { 'dx-excshell-1': { actions: { myAction: { annotations: { 'require-adobe-auth': true }, function: expect.stringContaining('myAction/index.js'), runtime: constants.defaultRuntimeKind, web: 'yes' } }, license: 'Apache-2.0' } } })

// 3. make sure wskdebug dev dependency was added to package.json
expect(utils.addDependencies).toHaveBeenCalledWith(actionGenerator, { '@openwhisk/wskdebug': expect.any(String) }, true)
// dev or prod
expect(utils.addDependencies).not.toHaveBeenCalled()
})

test('with extra dependencies and manifest already exists', () => {
Expand Down Expand Up @@ -226,13 +226,13 @@ Note: characters can only be split by '-'.
// 3. make sure wskdebug dev dependency was added to package.json
// prod
expect(utils.addDependencies).toHaveBeenCalledWith(actionGenerator, {
abc: '1.2.3', def: '4.5.6'
abc: '1.2.3',
def: '4.5.6'
})
// dev
expect(utils.addDependencies).toHaveBeenCalledWith(actionGenerator, {
xyz: '3.2.1',
vuw: '6.5.4',
'@openwhisk/wskdebug': expect.any(String)
vuw: '6.5.4'
}, true)
})

Expand Down