From ec49ca3c91c22522a95826aee3a99a213d3381a9 Mon Sep 17 00:00:00 2001 From: Arto Liukkonen Date: Sat, 28 Aug 2021 12:45:03 +0300 Subject: [PATCH] =?UTF-8?q?Depracate=20node=208.10.=20Add=20support=20for?= =?UTF-8?q?=20node=2014.x=C2=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 +- __tests__/config.test.js | 4 ++-- __tests__/integration10.x.test.js | 6 ++++-- __tests__/integration12.x.test.js | 6 ++++-- .../{integration8.10.test.js => integration14.x.test.js} | 2 +- __tests__/test-service-options/serverless.yml | 2 +- __tests__/{test-service8.10 => test-service14.x}/.npmignore | 0 .../.serverless_plugins/serverless-jest-plugin/index.js | 0 __tests__/{test-service8.10 => test-service14.x}/handler.js | 0 .../{test-service8.10 => test-service14.x}/package.json | 2 +- .../{test-service8.10 => test-service14.x}/serverless.yml | 2 +- __tests__/utils.test.js | 2 +- lib/create-function.js | 2 +- 13 files changed, 17 insertions(+), 13 deletions(-) rename __tests__/{integration8.10.test.js => integration14.x.test.js} (99%) rename __tests__/{test-service8.10 => test-service14.x}/.npmignore (100%) rename __tests__/{test-service8.10 => test-service14.x}/.serverless_plugins/serverless-jest-plugin/index.js (100%) rename __tests__/{test-service8.10 => test-service14.x}/handler.js (100%) rename __tests__/{test-service8.10 => test-service14.x}/package.json (80%) rename __tests__/{test-service8.10 => test-service14.x}/serverless.yml (99%) diff --git a/.travis.yml b/.travis.yml index c6a2e36..cde779f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: node_js node_js: -- '8.10.0' - '10' - '12' +- '14' script: - npm run lint - npm test diff --git a/__tests__/config.test.js b/__tests__/config.test.js index 1891308..a2c3ef1 100644 --- a/__tests__/config.test.js +++ b/__tests__/config.test.js @@ -94,7 +94,7 @@ xdescribe('jest configuration', () => { service: my-service provider: name: aws - runtime: nodejs8.10 + runtime: nodejs14.x stage: dev region: us-west-1 plugins: @@ -147,7 +147,7 @@ xdescribe('jest configuration', () => { service: my-service provider: name: aws - runtime: nodejs8.10 + runtime: nodejs14.x stage: dev region: us-west-1 plugins: diff --git a/__tests__/integration10.x.test.js b/__tests__/integration10.x.test.js index 2ccff03..30342ef 100644 --- a/__tests__/integration10.x.test.js +++ b/__tests__/integration10.x.test.js @@ -4,6 +4,7 @@ const Serverless = require('serverless'); const execSync = require('child_process').execSync; const path = require('path'); const fs = require('fs-extra'); +const stripAnsi = require('strip-ansi'); const { getTmpDirPath, replaceTextInFile, spawnPromise } = require('./test-utils'); const serverless = new Serverless(); @@ -71,8 +72,9 @@ describe('integration', () => { "require('../.serverless_plugins/serverless-jest-plugin/index.js')", ); return spawnPromise(serverlessExec, 'invoke test --stage prod').then(({ stderr }) => { - expect(stderr).toContain('PASS'); - return expect(stderr).toContain('Test Suites: 2 passed, 2 total'); + const rawStderr = stripAnsi(stderr); + expect(rawStderr).toContain('PASS'); + return expect(rawStderr).toContain('Test Suites: 2 passed, 2 total'); }); }, 35000, diff --git a/__tests__/integration12.x.test.js b/__tests__/integration12.x.test.js index 703e9c1..c6f5143 100644 --- a/__tests__/integration12.x.test.js +++ b/__tests__/integration12.x.test.js @@ -4,6 +4,7 @@ const Serverless = require('serverless'); const execSync = require('child_process').execSync; const path = require('path'); const fs = require('fs-extra'); +const stripAnsi = require('strip-ansi'); const { getTmpDirPath, replaceTextInFile, spawnPromise } = require('./test-utils'); const serverless = new Serverless(); @@ -71,8 +72,9 @@ describe('integration', () => { "require('../.serverless_plugins/serverless-jest-plugin/index.js')", ); return spawnPromise(serverlessExec, 'invoke test --stage prod').then(({ stderr }) => { - expect(stderr).toContain('PASS'); - return expect(stderr).toContain('Test Suites: 2 passed, 2 total'); + const rawStderr = stripAnsi(stderr); + expect(rawStderr).toContain('PASS'); + return expect(rawStderr).toContain('Test Suites: 2 passed, 2 total'); }); }, 35000, diff --git a/__tests__/integration8.10.test.js b/__tests__/integration14.x.test.js similarity index 99% rename from __tests__/integration8.10.test.js rename to __tests__/integration14.x.test.js index 8284cf1..098e2b2 100644 --- a/__tests__/integration8.10.test.js +++ b/__tests__/integration14.x.test.js @@ -16,7 +16,7 @@ describe('integration', () => { process.env.PLUGIN_TEST_DIR = path.join(__dirname); const tmpDir = getTmpDirPath(); fs.mkdirsSync(tmpDir); - fs.copySync(path.join(process.env.PLUGIN_TEST_DIR, 'test-service8.10'), tmpDir); + fs.copySync(path.join(process.env.PLUGIN_TEST_DIR, 'test-service14.x'), tmpDir); const packageJsonPath = path.join(tmpDir, 'package.json'); const packageJson = fs.readJsonSync(packageJsonPath); packageJson.name = `application-${Date.now()}`; diff --git a/__tests__/test-service-options/serverless.yml b/__tests__/test-service-options/serverless.yml index 8df98da..b41d2e4 100644 --- a/__tests__/test-service-options/serverless.yml +++ b/__tests__/test-service-options/serverless.yml @@ -19,7 +19,7 @@ service: jest-test-suite provider: name: aws - runtime: nodejs8.10 + runtime: nodejs14.x environment: STAGE: ${opt:stage}-stage-test stage: dev diff --git a/__tests__/test-service8.10/.npmignore b/__tests__/test-service14.x/.npmignore similarity index 100% rename from __tests__/test-service8.10/.npmignore rename to __tests__/test-service14.x/.npmignore diff --git a/__tests__/test-service8.10/.serverless_plugins/serverless-jest-plugin/index.js b/__tests__/test-service14.x/.serverless_plugins/serverless-jest-plugin/index.js similarity index 100% rename from __tests__/test-service8.10/.serverless_plugins/serverless-jest-plugin/index.js rename to __tests__/test-service14.x/.serverless_plugins/serverless-jest-plugin/index.js diff --git a/__tests__/test-service8.10/handler.js b/__tests__/test-service14.x/handler.js similarity index 100% rename from __tests__/test-service8.10/handler.js rename to __tests__/test-service14.x/handler.js diff --git a/__tests__/test-service8.10/package.json b/__tests__/test-service14.x/package.json similarity index 80% rename from __tests__/test-service8.10/package.json rename to __tests__/test-service14.x/package.json index d79e117..292b781 100644 --- a/__tests__/test-service8.10/package.json +++ b/__tests__/test-service14.x/package.json @@ -1,5 +1,5 @@ { - "name": "application-name-8", + "name": "application-name-12", "version": "0.0.1", "dependencies": { "serverless-jest-plugin": "" diff --git a/__tests__/test-service8.10/serverless.yml b/__tests__/test-service14.x/serverless.yml similarity index 99% rename from __tests__/test-service8.10/serverless.yml rename to __tests__/test-service14.x/serverless.yml index edeee4e..9ad2897 100644 --- a/__tests__/test-service8.10/serverless.yml +++ b/__tests__/test-service14.x/serverless.yml @@ -19,7 +19,7 @@ service: jest-test-suite provider: name: aws - runtime: nodejs8.10 + runtime: nodejs14.x stage: dev region: us-east-1 diff --git a/__tests__/utils.test.js b/__tests__/utils.test.js index 640629f..04025f3 100644 --- a/__tests__/utils.test.js +++ b/__tests__/utils.test.js @@ -2,7 +2,7 @@ const path = require('path'); const fs = require('fs-extra'); -const utils = require('../lib/utils.js'); +const utils = require('../lib/utils'); const testUtils = require('../__tests__/test-utils'); describe('utils', () => { diff --git a/lib/create-function.js b/lib/create-function.js index 53e1131..95842f9 100644 --- a/lib/create-function.js +++ b/lib/create-function.js @@ -9,9 +9,9 @@ const ejs = require('ejs'); const functionTemplateFile = path.join('templates', 'function-template.ejs'); const validFunctionRuntimes = [ - 'aws-nodejs8.10', 'aws-nodejs10.x', 'aws-nodejs12.x', + 'aws-nodejs14.x', ]; const humanReadableFunctionRuntimes = `${validFunctionRuntimes