From 8a74d66b52d64d4786a155d03bc112fd687d3497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=93=E8=B6=85?= <2325690622@qq.com> Date: Mon, 22 Jun 2020 11:05:28 +0800 Subject: [PATCH] [Fix bug] nodejs12 runtime support (#931) * Add nodejs12 to templates * Amend nodejs12 to error message * Amend nodejs12 to docker runtime image map * Amend nodejs12 to specification * Amend nodejs12 to debug runtime case * Amend nodejs12 to debug runtime test case * Amend nodejs12 to sbox tips runtime case * Amend nodejs12 to supported runtime * Amend nodejs12 to ros runtime enum * Amend nodejs12 to runtime ignore dependencies case * Amend nodejs12 to validate runtime schemas --- docs/specs/2018-04-03-zh-cn.md | 4 +- docs/specs/2018-04-03.md | 4 +- src/lib/commands/install.js | 4 +- src/lib/debug.js | 8 ++-- src/lib/docker-opts.js | 15 +++--- src/lib/docker.js | 5 +- src/lib/fc.js | 10 ++-- src/lib/init/templates.json | 4 +- src/lib/language-service/schema/rosSchema.ts | 2 +- src/lib/package/ignore.js | 3 +- src/lib/validate/schema/function.js | 2 +- templates/event-nodejs12/metadata.json | 7 +++ .../{{ projectName }}/.funignore | 4 ++ .../event-nodejs12/{{ projectName }}/index.js | 12 +++++ .../{{ projectName }}/template.yml | 13 +++++ templates/http-trigger-nodejs12/metadata.json | 7 +++ .../{{ projectName }}/.funignore | 4 ++ .../{{ projectName }}/index.js | 48 +++++++++++++++++++ .../{{ projectName }}/template.yml | 19 ++++++++ test/debug.test.js | 31 +++++++++++- test/docker-opts.test.js | 4 +- 21 files changed, 180 insertions(+), 30 deletions(-) create mode 100644 templates/event-nodejs12/metadata.json create mode 100644 templates/event-nodejs12/{{ projectName }}/.funignore create mode 100644 templates/event-nodejs12/{{ projectName }}/index.js create mode 100644 templates/event-nodejs12/{{ projectName }}/template.yml create mode 100644 templates/http-trigger-nodejs12/metadata.json create mode 100644 templates/http-trigger-nodejs12/{{ projectName }}/.funignore create mode 100644 templates/http-trigger-nodejs12/{{ projectName }}/index.js create mode 100644 templates/http-trigger-nodejs12/{{ projectName }}/template.yml diff --git a/docs/specs/2018-04-03-zh-cn.md b/docs/specs/2018-04-03-zh-cn.md index 87a322186..16e2d1b6c 100644 --- a/docs/specs/2018-04-03-zh-cn.md +++ b/docs/specs/2018-04-03-zh-cn.md @@ -95,7 +95,7 @@ Description | `string` | 服务的描述。 属性名称 | 类型 | 描述 ---|:---:|--- Handler | `string` | **必填。** 处理函数的调用入口。 -Runtime | `string` | **必填。** 运行时环境。可选值为:nodejs6、nodejs8、nodejs10、python2.7、python3、java8、php7.2、dotnetcore2.1。 +Runtime | `string` | **必填。** 运行时环境。可选值为:nodejs6、nodejs8、nodejs10、nodejs12、python2.7、python3、java8、php7.2、dotnetcore2.1。 CodeUri | `string` | **必填。** 代码位置。支持 file、dir、zip、oss-bucket 等形式,更多信息[参考](#codeuri)。 Initializer | `string` | 初始化函数的调用入口。 Description | `string` | 函数的描述。 @@ -798,4 +798,4 @@ Filter: 1. 因为生成 role 用户需要为子用户分配一个很大的权限,非必要场景下,我们尽可能不去生成这个默认 role,尽可能避免用户的子用户权限不够情况。 2. 一般这个 role 的使用场景是用来调用其他云服务的,即使生成了默认的 role,但是没有指定 policies 也是没有意义的,因为不会有相应的权限。 -3. ram 有角色数量的限制。 \ No newline at end of file +3. ram 有角色数量的限制。 diff --git a/docs/specs/2018-04-03.md b/docs/specs/2018-04-03.md index 59b3e57d9..866fb2586 100644 --- a/docs/specs/2018-04-03.md +++ b/docs/specs/2018-04-03.md @@ -94,7 +94,7 @@ Creates a FC function and event source mappings which trigger the function. Func Property Name | Type | Description ---|:---:|--- Handler | `string` | **Required.** Function within your code that is called to begin execution. -Runtime | `string` | **Required.** The runtime environment. The optional values ​​are: nodejs6, nodejs8, nodejs10, python2.7, python3, java8, php7.2, dotnetcore2.1 . +Runtime | `string` | **Required.** The runtime environment. The optional values ​​are: nodejs6, nodejs8, nodejs10, nodejs12, python2.7, python3, java8, php7.2, dotnetcore2.1 . CodeUri | `string` | **Required.** Code location. Supports file, dir, zip, oss-bucket, etc. More information [Reference] (#codeuri). Description | `string` | Description of the function. MemorySize | `integer` | Size of the memory allocated per invocation of the function in MB. Defaults to 128. @@ -802,4 +802,4 @@ Reasons for this design: 1. Because the generation of role needs a large permission. In unnecessary scenarios, we try not to generate the default role as much as possible to avoid the user's sub-user privilege is insufficient. 2. Generally, function use this role to invoke other cloud services. Even if default role is generated, it is meaningless not to specify policies, because there will be no corresponding permissions. -3. Ram Service has a limitation on the number of roles. \ No newline at end of file +3. Ram Service has a limitation on the number of roles. diff --git a/src/lib/commands/install.js b/src/lib/commands/install.js index 1421f841f..0c44b1d0a 100644 --- a/src/lib/commands/install.js +++ b/src/lib/commands/install.js @@ -151,7 +151,7 @@ function validateRegistry(runtime, options) { } if (options.registry && !(runtime.indexOf('node') > -1)) { - throw new Error(`'--registry' needs to be used with '--runtime' nodejs6/nodejs8/nodejs10, and you are currently using ${runtime}`); + throw new Error(`'--registry' needs to be used with '--runtime' nodejs6/nodejs8/nodejs10/nodejs12, and you are currently using ${runtime}`); } } @@ -229,4 +229,4 @@ module.exports = { init, env, sbox -}; \ No newline at end of file +}; diff --git a/src/lib/debug.js b/src/lib/debug.js index 69a6725c9..77043b912 100644 --- a/src/lib/debug.js +++ b/src/lib/debug.js @@ -75,6 +75,7 @@ async function generateVscodeDebugConfig(serviceName, functionName, runtime, cod } ] }; + case 'nodejs12': case 'nodejs10': case 'nodejs8': return { @@ -192,6 +193,7 @@ function generateDebugEnv(runtime, debugPort, debugIde) { const remoteIp = ip.address(); switch (runtime) { + case 'nodejs12': case 'nodejs10': case 'nodejs8': return { 'DEBUG_OPTIONS': `--inspect-brk=0.0.0.0:${debugPort}` }; @@ -201,9 +203,9 @@ function generateDebugEnv(runtime, debugPort, debugIde) { case 'python3': if (debugIde === IDE_PYCHARM) { return {}; - } + } return { 'DEBUG_OPTIONS': `-m ptvsd --host 0.0.0.0 --port ${debugPort} --wait` }; - + case 'java8': return { 'DEBUG_OPTIONS': `-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,quiet=y,address=${debugPort}` }; case 'php7.2': @@ -249,4 +251,4 @@ function generateDockerDebugOpts(runtime, debugPort, debugIde) { module.exports = { generateVscodeDebugConfig, generateDebugEnv, generateDockerDebugOpts, getDebugIde, getDebugPort -}; \ No newline at end of file +}; diff --git a/src/lib/docker-opts.js b/src/lib/docker-opts.js index 9842462a3..a8f4caa10 100644 --- a/src/lib/docker-opts.js +++ b/src/lib/docker-opts.js @@ -27,11 +27,12 @@ let DOCKER_REGISTRY_CACHE; const runtimeImageMap = { 'nodejs6': 'nodejs6', 'nodejs8': 'nodejs8', + 'nodejs10': 'nodejs10', + 'nodejs12': 'nodejs12', 'python2.7': 'python2.7', 'python3': 'python3.6', 'java8': 'java8', 'php7.2': 'php7.2', - 'nodejs10': 'nodejs10', 'dotnetcore2.1': 'dotnetcore2.1', 'custom': 'custom' }; @@ -45,7 +46,7 @@ async function doImageRegisterEventTag(el) { visitor.event({ ec: 'imageRegistry', ea: 'resolve', - el + el }).send(); } @@ -153,7 +154,7 @@ function transformMountsForToolbox(mounts) { return transformSourcePathOfMount(m); }); - } + } return transformSourcePathOfMount(mounts); } @@ -214,7 +215,7 @@ async function generateLocalInvokeOpts(runtime, containerName, mounts, cmd, debu }; let debugOpts = {}; - + if (debugPort) { debugOpts = generateDockerDebugOpts(runtime, debugPort, debugIde); } @@ -301,7 +302,7 @@ async function generateLocalStartOpts(runtime, name, mounts, cmd, debugPort, env return opts; } -// Not Run stage: +// Not Run stage: // for linux platform, it will always use process.uid and process.gid // for mac and windows platform, it will always use 0 // Run stage: @@ -332,7 +333,7 @@ function resolveDockerUser({nasConfig, stage = 'run'}) { } module.exports = { - generateLocalInvokeOpts, resolveRuntimeToDockerImage, + generateLocalInvokeOpts, resolveRuntimeToDockerImage, generateInstallOpts, generateSboxOpts, generateLocalStartOpts, resolveMockScript, resolveDockerEnv, transformPathForVirtualBox, @@ -340,4 +341,4 @@ module.exports = { DOCKER_REGISTRIES, generateContainerBuildOpts, IMAGE_VERSION, resolveImageNameForPull, generateContainerName, generateContainerNameFilter, resolveDockerUser -}; \ No newline at end of file +}; diff --git a/src/lib/docker.js b/src/lib/docker.js index 8efbfac47..340538ab4 100644 --- a/src/lib/docker.js +++ b/src/lib/docker.js @@ -567,7 +567,7 @@ async function run(opts, event, outputStream, errorStream, context = {}) { await container.start(); - // dockerode bugs on windows. attach could not receive output and error + // dockerode bugs on windows. attach could not receive output and error if (isWin) { const logStream = await container.logs({ stdout: true, @@ -801,6 +801,7 @@ function displaySboxTips(runtime) { case 'nodejs6': case 'nodejs8': case 'nodejs10': + case 'nodejs12': console.log(yellow(`You can install node modules like this:`)); console.log(yellow(`fun-install npm install puppeteer\n`)); break; @@ -1032,4 +1033,4 @@ module.exports = { resolveTmpDirToMount, showDebugIdeTipsForPycharm, resolveDebuggerPathToMount, listContainers, getContainer, createAndRunContainer, execContainer, renameContainer, detectDockerVersion, resolveNasYmlToMount, resolvePasswdMount -}; \ No newline at end of file +}; diff --git a/src/lib/fc.js b/src/lib/fc.js index dead2ecc3..1a8ab705f 100644 --- a/src/lib/fc.js +++ b/src/lib/fc.js @@ -49,7 +49,7 @@ const FUN_GENERATED_SERVICE = 'fun-generated-default-service'; const SYSTEM_DEPENDENCY_PATH = path.join('.fun', 'root'); -const SUPPORT_RUNTIMES = ['nodejs6', 'nodejs8', 'nodejs10', 'python2.7', 'python3', 'java8', 'custom']; +const SUPPORT_RUNTIMES = ['nodejs6', 'nodejs8', 'nodejs10', 'nodejs12', 'python2.7', 'python3', 'java8', 'custom']; const defaultVpcConfig = { securityGroupId: '', @@ -85,6 +85,7 @@ const runtimeTypeMapping = { 'nodejs6': ['node_modules', '.fun/root'], 'nodejs8': ['node_modules', '.fun/root'], 'nodejs10': ['node_modules', '.fun/root'], + 'nodejs12': ['node_modules', '.fun/root'], 'python2.7': ['.fun/python', '.fun/root'], 'python3': ['.fun/python', '.fun/root'], 'php7.2': ['extension', 'vendor', '.fun/root'] @@ -184,6 +185,7 @@ const runtimeDependencyMappings = { 'nodejs6': [NODE_RUNTIME_MAPPING, FONTS_MAPPING], 'nodejs8': [NODE_RUNTIME_MAPPING, FONTS_MAPPING], 'nodejs10': [NODE_RUNTIME_MAPPING, FONTS_MAPPING], + 'nodejs12': [NODE_RUNTIME_MAPPING, FONTS_MAPPING], 'python2.7': [PYTHON_RUNTIME_MAPPING, FONTS_MAPPING], 'python3': [PYTHON_RUNTIME_MAPPING, FONTS_MAPPING], 'java8': [JAVA_RUNTIME_MAPPING, FONTS_MAPPING], @@ -707,7 +709,7 @@ async function processWar(absCodeUri, warfilePath) { if (await fs.pathExists(targetAbsPath)) { console.log('repackage war file ', absWarfilePath); - await repackPackage(tmpCodeDir, + await repackPackage(tmpCodeDir, path.join('WEB-INF', 'lib'), absWarfilePath, targetAbsPath); } else { @@ -938,7 +940,7 @@ async function checkAlreadyConfirmedForCustomSpringBoot(runtime, codeUri) { if (stat.size < 102400) { // 10 KB const content = await fs.readFile(bootstrapPath, 'utf8'); // 对于 custom runtime 的 spring boot,如果检测到超过 50M,会提示使用 NAS 向导 - // 如果用户输入了 yes 确认,则会将 spring boot 打包的 jar 进行 repackage + // 如果用户输入了 yes 确认,则会将 spring boot 打包的 jar 进行 repackage // 以及修改 bootstrap 的内容,即将 java -jar -Dserver.port=$PORT target/java-getting-started-1.0.jar 修改为 java org.springframework.boot.loader.PropertiesLauncher // 这里通过检测 java org.springframework.boot.loader.PropertiesLauncher 判断用户是否输入 yes 确认过,避免多次确认 return _.includes(content, 'org.springframework.boot.loader.PropertiesLauncher'); @@ -1751,4 +1753,4 @@ module.exports = { FUN_GENERATED_SERVICE, invokeFcUtilsFunction, getFcUtilsFunctionCode, deleteFunction, processNasMappingsAndEnvs, processNasAutoConfiguration, nasAutoConfigurationIfNecessary, makeFcUtilsFunctionNasDirChecker, makeFcUtilsFunctionTmpDomainToken -}; \ No newline at end of file +}; diff --git a/src/lib/init/templates.json b/src/lib/init/templates.json index ba46f30d6..7f1de48e9 100644 --- a/src/lib/init/templates.json +++ b/src/lib/init/templates.json @@ -1,4 +1,5 @@ { + "event-nodejs12": "{{ templatePath }}/event-nodejs12", "event-nodejs10": "{{ templatePath }}/event-nodejs10", "event-nodejs8": "{{ templatePath }}/event-nodejs8", "event-nodejs6": "{{ templatePath }}/event-nodejs6", @@ -7,6 +8,7 @@ "event-java8": "{{ templatePath }}/event-java8", "event-php7.2": "{{ templatePath }}/event-php7.2", "event-dotnetcore2.1": "{{ templatePath }}/event-dotnetcore2.1", + "http-trigger-nodejs12": "{{ templatePath }}/http-trigger-nodejs12", "http-trigger-nodejs10": "{{ templatePath }}/http-trigger-nodejs10", "http-trigger-nodejs8": "{{ templatePath }}/http-trigger-nodejs8", "http-trigger-nodejs6": "{{ templatePath }}/http-trigger-nodejs6", @@ -18,4 +20,4 @@ "http-trigger-spring-boot": "{{ templatePath }}/http-trigger-spring-boot", "custom-springboot": "{{ templatePath }}/custom-springboot", "http-trigger-node-puppeteer": "{{ templatePath }}/http-trigger-node-puppeteer" -} \ No newline at end of file +} diff --git a/src/lib/language-service/schema/rosSchema.ts b/src/lib/language-service/schema/rosSchema.ts index 96ab73f68..58ccf4203 100644 --- a/src/lib/language-service/schema/rosSchema.ts +++ b/src/lib/language-service/schema/rosSchema.ts @@ -154,7 +154,7 @@ export const rosSchema = { }, "Runtime": { "type": "string", - "enum": ["nodejs6", "nodejs8", "nodejs10", "python2.7", "python3", "java8", "php7.2", "dotnetcore2.1", "custom"] + "enum": ["nodejs6", "nodejs8", "nodejs10", "nodejs12", "python2.7", "python3", "java8", "php7.2", "dotnetcore2.1", "custom"] }, "CodeUri": { "type": "string" diff --git a/src/lib/package/ignore.js b/src/lib/package/ignore.js index 49f784f12..9abc09c97 100644 --- a/src/lib/package/ignore.js +++ b/src/lib/package/ignore.js @@ -15,6 +15,7 @@ function selectIgnored(runtime) { case 'nodejs6': case 'nodejs8': case 'nodejs10': + case 'nodejs12': return ['.fun/python']; case 'python2.7': @@ -79,4 +80,4 @@ async function updateIgnore(baseDir, patterns) { module.exports = { isIgnored, updateIgnore -}; \ No newline at end of file +}; diff --git a/src/lib/validate/schema/function.js b/src/lib/validate/schema/function.js index 4b8ab9c2d..26bad7a6d 100644 --- a/src/lib/validate/schema/function.js +++ b/src/lib/validate/schema/function.js @@ -20,7 +20,7 @@ const functionSchema = { }, 'Runtime': { 'type': 'string', - 'enum': ['nodejs6', 'nodejs8', 'nodejs10', 'python2.7', 'python3', 'java8', 'php7.2', 'dotnetcore2.1', 'custom'] + 'enum': ['nodejs6', 'nodejs8', 'nodejs10', 'nodejs12', 'python2.7', 'python3', 'java8', 'php7.2', 'dotnetcore2.1', 'custom'] }, 'CodeUri': { 'type': 'string' diff --git a/templates/event-nodejs12/metadata.json b/templates/event-nodejs12/metadata.json new file mode 100644 index 000000000..84d1fb26f --- /dev/null +++ b/templates/event-nodejs12/metadata.json @@ -0,0 +1,7 @@ +{ + "name": "event-nodejs12", + "description": "Print hello world", + "vars": { + "service": "{{ projectName }}" + } +} diff --git a/templates/event-nodejs12/{{ projectName }}/.funignore b/templates/event-nodejs12/{{ projectName }}/.funignore new file mode 100644 index 000000000..de370e0f2 --- /dev/null +++ b/templates/event-nodejs12/{{ projectName }}/.funignore @@ -0,0 +1,4 @@ +.env +package-lock.json +template.yml +.funignore diff --git a/templates/event-nodejs12/{{ projectName }}/index.js b/templates/event-nodejs12/{{ projectName }}/index.js new file mode 100644 index 000000000..2cc27ede2 --- /dev/null +++ b/templates/event-nodejs12/{{ projectName }}/index.js @@ -0,0 +1,12 @@ +/* +if you open the initializer feature, please implement the initializer function, as below: +module.exports.initializer = function(context, callback) { + console.log('initializing'); + callback(null, ''); +}; +*/ + +module.exports.handler = function(event, context, callback) { + console.log('hello world'); + callback(null, 'hello world'); +}; \ No newline at end of file diff --git a/templates/event-nodejs12/{{ projectName }}/template.yml b/templates/event-nodejs12/{{ projectName }}/template.yml new file mode 100644 index 000000000..b4b929b40 --- /dev/null +++ b/templates/event-nodejs12/{{ projectName }}/template.yml @@ -0,0 +1,13 @@ +ROSTemplateFormatVersion: '2015-09-01' +Transform: 'Aliyun::Serverless-2018-04-03' +Resources: + {{ service }}: + Type: 'Aliyun::Serverless::Service' + Properties: + Description: 'helloworld' + {{ projectName }}: + Type: 'Aliyun::Serverless::Function' + Properties: + Handler: index.handler + Runtime: nodejs12 + CodeUri: './' diff --git a/templates/http-trigger-nodejs12/metadata.json b/templates/http-trigger-nodejs12/metadata.json new file mode 100644 index 000000000..e978a2720 --- /dev/null +++ b/templates/http-trigger-nodejs12/metadata.json @@ -0,0 +1,7 @@ +{ + "name": "http-trigger-nodejs12", + "description": "Print hello world", + "vars": { + "service": "{{ projectName }}" + } +} diff --git a/templates/http-trigger-nodejs12/{{ projectName }}/.funignore b/templates/http-trigger-nodejs12/{{ projectName }}/.funignore new file mode 100644 index 000000000..de370e0f2 --- /dev/null +++ b/templates/http-trigger-nodejs12/{{ projectName }}/.funignore @@ -0,0 +1,4 @@ +.env +package-lock.json +template.yml +.funignore diff --git a/templates/http-trigger-nodejs12/{{ projectName }}/index.js b/templates/http-trigger-nodejs12/{{ projectName }}/index.js new file mode 100644 index 000000000..ed02f88f5 --- /dev/null +++ b/templates/http-trigger-nodejs12/{{ projectName }}/index.js @@ -0,0 +1,48 @@ +var getRawBody = require('raw-body'); +var getFormBody = require('body/form'); +var body = require('body'); + + +/* +if you open the initializer feature, please implement the initializer function, as below: +module.exports.initializer = function(context, callback) { + console.log('initializing'); + callback(null, ''); +}; +*/ + +module.exports.handler = function(req, resp, context) { + console.log('hello world'); + + var params = { + path: req.path, + queries: req.queries, + headers: req.headers, + method : req.method, + requestURI : req.url, + clientIP : req.clientIP, + } + + getRawBody(req, function(err, body) { + resp.setHeader('content-type', 'text/plain'); + + for (var key in req.queries) { + var value = req.queries[key]; + resp.setHeader(key, value); + } + params.body = body.toString(); + resp.send(JSON.stringify(params, null, ' ')); + }); + + /* + getFormBody(req, function(err, formBody) { + for (var key in req.queries) { + var value = req.queries[key]; + resp.setHeader(key, value); + } + params.body = formBody; + console.log(formBody); + resp.send(JSON.stringify(params)); + }); + */ +} \ No newline at end of file diff --git a/templates/http-trigger-nodejs12/{{ projectName }}/template.yml b/templates/http-trigger-nodejs12/{{ projectName }}/template.yml new file mode 100644 index 000000000..6700cc221 --- /dev/null +++ b/templates/http-trigger-nodejs12/{{ projectName }}/template.yml @@ -0,0 +1,19 @@ +ROSTemplateFormatVersion: '2015-09-01' +Transform: 'Aliyun::Serverless-2018-04-03' +Resources: + {{ service }}: + Type: 'Aliyun::Serverless::Service' + Properties: + Description: 'helloworld' + {{ projectName }}: + Type: 'Aliyun::Serverless::Function' + Properties: + Handler: index.handler + Runtime: nodejs12 + CodeUri: './' + Events: + httpTrigger: + Type: HTTP + Properties: + AuthType: ANONYMOUS + Methods: ['POST', 'GET'] diff --git a/test/debug.test.js b/test/debug.test.js index ecf67ce5e..4dddb87b9 100644 --- a/test/debug.test.js +++ b/test/debug.test.js @@ -125,6 +125,28 @@ describe('test generateVscodeDebugConfig', () => { }); }); + it('test nodejs12', async function () { + + const debugConfig = await generateVscodeDebugConfig(serviceName, functionName, 'nodejs12', '.', 9000); + + expect(debugConfig).to.eql({ + 'version': '0.2.0', + 'configurations': [ + { + 'name': 'fc/testService/testFunction', + 'type': 'node', + 'request': 'attach', + 'address': 'localhost', + 'port': 9000, + 'localRoot': '.', + 'remoteRoot': '/code', + 'protocol': 'inspector', + 'stopOnEntry': false + } + ] + }); + }); + it('test java8', async function () { @@ -195,6 +217,11 @@ describe('test generateDebugEnv', () => { expect(env).to.eql({ 'DEBUG_OPTIONS': '--inspect-brk=0.0.0.0:9000' }); }); + it('test nodejs12', async function () { + const env = await generateDebugEnv('nodejs12', 9000); + expect(env).to.eql({ 'DEBUG_OPTIONS': '--inspect-brk=0.0.0.0:9000' }); + }); + it('test php7.2', async function () { const env = await generateDebugEnv('php7.2', 9000); expect(env.XDEBUG_CONFIG).to.contain('remote_enable=1 remote_autostart=1 remote_port=9000 remote_host='); @@ -219,7 +246,7 @@ describe('test generateDebugEnv', () => { describe('test generateDockerDebugOpts', () => { it('test not php7.2', async function () { for (let runtime of ['python2.7', 'python3', 'java8', 'nodejs6', 'nodejs8']) { - const debugOpts = await generateDockerDebugOpts(runtime, 9000); + const debugOpts = await generateDockerDebugOpts(runtime, 9000); expect(debugOpts).to.eql({ 'ExposedPorts': { @@ -270,4 +297,4 @@ describe('test getDebugIde', () => { const ide = getDebugIde(); expect(ide).to.be(null); }); -}); \ No newline at end of file +}); diff --git a/test/docker-opts.test.js b/test/docker-opts.test.js index 0a4e61e4d..fde9494d4 100644 --- a/test/docker-opts.test.js +++ b/test/docker-opts.test.js @@ -27,7 +27,7 @@ describe('test resolveRuntimeToDockerImage', () => { }); it('test find not python image', async () => { - for (let runtime of ['nodejs6', 'nodejs8', 'python2.7', 'java8', 'php7.2', 'nodejs10']) { + for (let runtime of ['nodejs6', 'nodejs8', 'python2.7', 'java8', 'php7.2', 'nodejs10', 'nodejs12']) { const imageName = await dockerOpts.resolveRuntimeToDockerImage(runtime); expect(imageName).to.contain(`aliyunfc/runtime-${runtime}:`); } @@ -276,4 +276,4 @@ describe('test transformPathForVirtualBox', () => { 'ReadOnly': true }); }); -}); \ No newline at end of file +});