Skip to content

Commit

Permalink
chore: re-introduce node v14 compatibiliy, bump deps (#404)
Browse files Browse the repository at this point in the history
* ci: re-introduce node v14 compat

* build: use typescript target es2020

* chore: set node.js engine compat to v14.18

* chore: bump deps

* ci: fix build

* test: fix ci install

* test: reference main dependency to local folder

* test: fix e2e tests

* refactor: use relative path to test artifacts in e2e tests

Co-authored-by: Victor Korzunin <5180700+floydspace@users.noreply.github.com>
  • Loading branch information
dnalborczyk and floydspace committed Dec 27, 2022
1 parent c63222d commit f130bc8
Show file tree
Hide file tree
Showing 22 changed files with 2,108 additions and 64,725 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pull.yml
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x]
node-version: [14, 16, 18]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -27,7 +27,7 @@ jobs:
with:
name: e2e-test-artifact
path: |
e2e/**/.serverless/*.json
e2e/**/.serverless/*.zip
.test-artifacts/**/.serverless/*.json
.test-artifacts/**/.serverless/*.zip
retention-days: 7
- run: npm run build --if-present
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x]
node-version: [14, 16, 18]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -5,3 +5,4 @@ node_modules
dist
*.log
yarn.lock
.test-artifacts/
1 change: 0 additions & 1 deletion e2e/.gitignore

This file was deleted.

25 changes: 12 additions & 13 deletions e2e/Makefile
Expand Up @@ -2,25 +2,24 @@ test-e2e: test-e2e-minimal test-e2e-individually test-e2e-complete

build:
npm run build
npm link

test-e2e-minimal: build
rm -fr ./e2e/.test-artifacts && mkdir -p ./e2e/.test-artifacts/minimal && rsync -r ./examples/minimal/ ./e2e/.test-artifacts/minimal/
cd ./e2e/.test-artifacts/minimal && npm ci && npm link serverless-esbuild && npx sls package
cd ./e2e/.test-artifacts/minimal/.serverless && unzip minimal-example.zip
rm -fr ./.test-artifacts && mkdir -p ./.test-artifacts/minimal && rsync -r ./examples/minimal/ ./.test-artifacts/minimal/
cd ./.test-artifacts/minimal && npm install && npx sls package
cd ./.test-artifacts/minimal/.serverless && unzip minimal-example.zip
npx jest -c jest.config.e2e.js --ci ./e2e/minimal.test.ts
rm -fr ./e2e/.test-artifacts
rm -fr ./.test-artifacts

test-e2e-individually: build
rm -fr ./e2e/.test-artifacts && mkdir -p ./e2e/.test-artifacts/individually && rsync -r ./examples/individually/ ./e2e/.test-artifacts/individually/
cd ./e2e/.test-artifacts/individually && yarn install --frozen-lockfile && npm link serverless-esbuild && npx sls package
cd ./e2e/.test-artifacts/individually/.serverless && unzip hello1.zip && unzip hello2.zip
rm -fr ./.test-artifacts && mkdir -p ./.test-artifacts/individually && rsync -r ./examples/individually/ ./.test-artifacts/individually/
cd ./.test-artifacts/individually && yarn install && npx sls package
cd ./.test-artifacts/individually/.serverless && unzip hello1.zip && unzip hello2.zip
npx jest -c jest.config.e2e.js --ci ./e2e/individually.test.ts
rm -fr ./e2e/.test-artifacts
rm -fr ./.test-artifacts

test-e2e-complete: build
rm -fr ./e2e/.test-artifacts && mkdir -p ./e2e/.test-artifacts/complete && rsync -r ./examples/complete/ ./e2e/.test-artifacts/complete/
cd ./e2e/.test-artifacts/complete && npm ci && npm link serverless-esbuild && npx sls package
cd ./e2e/.test-artifacts/complete/.serverless && unzip complete-example.zip
rm -fr ./.test-artifacts && mkdir -p ./.test-artifacts/complete && rsync -r ./examples/complete/ ./.test-artifacts/complete/
cd ./.test-artifacts/complete && npm install && npx sls package
cd ./.test-artifacts/complete/.serverless && unzip complete-example.zip
npx jest -c jest.config.e2e.js --ci ./e2e/complete.test.ts
rm -fr ./e2e/.test-artifacts
rm -fr ./.test-artifacts
10 changes: 7 additions & 3 deletions e2e/complete.test.ts
@@ -1,11 +1,15 @@
import fs from 'fs';
import cloudformation from './.test-artifacts/complete/.serverless/cloudformation-template-update-stack.json';
import path from 'path';

test('complete', () => {
const indexContents = fs.readFileSync('e2e/.test-artifacts/complete/.serverless/src/index.js').toString();
const testArtifactPath = path.resolve(__dirname, '../.test-artifacts/complete/.serverless');

const cloudformation = require(path.join(testArtifactPath, 'cloudformation-template-update-stack.json'));

const indexContents = fs.readFileSync(path.join(testArtifactPath, 'src/index.js')).toString();
expect(indexContents).toMatchSnapshot();

const nodeModules = fs.readdirSync('e2e/.test-artifacts/complete/.serverless/node_modules').toString();
const nodeModules = fs.readdirSync(path.join(testArtifactPath, 'node_modules')).toString();
expect(nodeModules).toEqual(expect.stringContaining('isin-validator'));

expect(cloudformation.AWSTemplateFormatVersion).toMatchSnapshot();
Expand Down
10 changes: 7 additions & 3 deletions e2e/individually.test.ts
@@ -1,9 +1,13 @@
import fs from 'fs';
import cloudformation from './.test-artifacts/individually/.serverless/cloudformation-template-update-stack.json';
import path from 'path';

test('individually', () => {
const hello1indexContents = fs.readFileSync('e2e/.test-artifacts/individually/.serverless/hello1.js').toString();
const hello2indexContents = fs.readFileSync('e2e/.test-artifacts/individually/.serverless/hello2.js').toString();
const testArtifactPath = path.resolve(__dirname, '../.test-artifacts/individually/.serverless');

const cloudformation = require(path.join(testArtifactPath, 'cloudformation-template-update-stack.json'));

const hello1indexContents = fs.readFileSync(path.join(testArtifactPath, 'hello1.js')).toString();
const hello2indexContents = fs.readFileSync(path.join(testArtifactPath, 'hello2.js')).toString();
expect(hello1indexContents).toMatchSnapshot();

expect(hello2indexContents).toMatchSnapshot();
Expand Down
8 changes: 6 additions & 2 deletions e2e/minimal.test.ts
@@ -1,8 +1,12 @@
import fs from 'fs';
import cloudformation from './.test-artifacts/minimal/.serverless/cloudformation-template-update-stack.json';
import path from 'path';

test('minimal', () => {
const indexContents = fs.readFileSync('e2e/.test-artifacts/minimal/.serverless/index.js').toString();
const testArtifactPath = path.resolve(__dirname, '../.test-artifacts/minimal/.serverless');

const cloudformation = require(path.join(testArtifactPath, 'cloudformation-template-update-stack.json'));

const indexContents = fs.readFileSync(path.join(testArtifactPath, 'index.js')).toString();
expect(indexContents).toMatchSnapshot();

expect(cloudformation.AWSTemplateFormatVersion).toMatchSnapshot();
Expand Down
1 change: 1 addition & 0 deletions examples/complete/.gitignore
@@ -1,2 +1,3 @@
.build
.serverless
package-lock.json

0 comments on commit f130bc8

Please sign in to comment.