Skip to content

Commit

Permalink
Node 16 (#92)
Browse files Browse the repository at this point in the history
* bump versions to 14 + 16
* run tests on node 14 + 16
  • Loading branch information
purplecabbage authored Jan 13, 2022
1 parent 26cc085 commit becabb3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [12.x, 14.x]
node-version: [14.x, 16.x]
os: [ubuntu-latest, windows-latest]

steps:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules
package-lock.json
coverage
junit.xml
.env
.env
.DS_Store
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
"globby": "^11.0.1",
"js-yaml": "^3.14.0",
"lodash.clonedeep": "^4.5.0",
"openwhisk": "^3.21.5",
"openwhisk": "^3.21.6",
"openwhisk-fqn": "0.0.2",
"proxy-from-env": "^1.1.0",
"semver": "^7.3.2",
"sha1": "^1.1.1",
"webpack": "^5.26.3"
},
Expand Down Expand Up @@ -56,7 +55,7 @@
"typescript": "^4.5.2"
},
"engines": {
"node": "^10 || ^12 || ^14"
"node": "^14 || ^16"
},
"scripts": {
"e2e": "jest --config e2e/jest.config.js --runInBand",
Expand Down
12 changes: 7 additions & 5 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const fetch = createFetch()
const globby = require('globby')
const path = require('path')
const archiver = require('archiver')
const semver = require('semver')
const supportedEngines = require('../package.json').engines
// this is a static list that comes from here: https://developer.adobe.com/runtime/docs/guides/reference/runtimes/
const SupportedRuntimes = ['nodejs:10', 'nodejs:12', 'nodejs:14']

/**
*
Expand Down Expand Up @@ -1984,10 +1984,12 @@ function replacePackagePlaceHolder (config) {
* @param {object} action action object
*/
function validateActionRuntime (action) {
// I suspect we have an issue here with 2 kinds of kinds ...
// sometimes this method is called with 'sequence' which is a different kind of kind than exec.kind which
// comes from action: runtime: in manifest -jm
if (action.exec && action.exec.kind && action.exec.kind.toLowerCase().startsWith('nodejs:')) {
const nodeVer = semver.coerce(action.exec.kind.split(':')[1])
if (!semver.satisfies(nodeVer, supportedEngines.node)) {
throw new Error(`Unsupported node version in action ${action.name}. Supported versions are ${supportedEngines.node}`)
if (!SupportedRuntimes.includes(action.exec.kind)) {
throw new Error(`Unsupported node version in action ${action.name}. Supported versions are ${SupportedRuntimes}`)
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions test/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2062,10 +2062,8 @@ describe('validateActionRuntime', () => {
})

test('invalid nodejs version', async () => {
const supportedEngines = require('../package.json').engines

const func = () => utils.validateActionRuntime({ exec: { kind: 'nodejs:16' } })
expect(func).toThrowError(`Unsupported node version in action undefined. Supported versions are ${supportedEngines.node}`)
const func = () => utils.validateActionRuntime({ exec: { kind: 'nodejs:17' } })
expect(func).toThrowError('Unsupported node version')
})

test('dumpActionsBuiltInfo might catch some errors under unlikely conditions', async () => {
Expand Down

0 comments on commit becabb3

Please sign in to comment.