Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(HII-9538): Use node 20 #802

Merged
merged 13 commits into from
Jun 10, 2024
15 changes: 4 additions & 11 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
with:
fetch-depth: 0

- name: Install Node 16
- name: Install Node 20
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
cache: npm
cache-dependency-path: '**/package-lock.json'

Expand All @@ -37,13 +37,6 @@ jobs:
distribution: temurin
java-version: 17

- name: Install Node 20
uses: actions/setup-node@v3
with:
node-version: 20
cache: npm
cache-dependency-path: '**/package-lock.json'

- name: Analyze with SonarCloud
uses: ./sonar-scanner
with:
Expand All @@ -55,10 +48,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install Node 16
- name: Install Node 20
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
cache: npm
cache-dependency-path: '**/package-lock.json'

Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
20
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ before running actions.

Development tools needed are:

* Latest Node 16 LTS release
* Latest Node 20 LTS release
* Docker
* Pre-commit

Expand Down
15 changes: 0 additions & 15 deletions cloud-run/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cloud-run/test/wait-revision.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ describe('Wait for revision', () => {
clusterInput,
canarySpec,
10,
)).rejects.toEqual(new Error('Invalid JSON: Failed to load status for revision "xxxxxxx-00013-loc". Reason: Unexpected token E in JSON at position 0'));
)).rejects.toEqual(new Error('Invalid JSON: Failed to load status for revision "xxxxxxx-00013-loc". Reason: Unexpected token \'E\', "ERROR: No JSON" is not valid JSON'));
expect(exec.exec).toHaveBeenCalled();
});

Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ module.exports = {
rootDir: process.cwd(),
testEnvironment: 'node',
maxWorkers: '50%',
setupFiles: ['./jest.setup.js'],
};
20 changes: 20 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const mock = { fs: jest.requireActual('fs') };

/**
* Calling require("mock-fs") will make jest
* return memfs.fs for further calls to require("fs")
*/
jest.mock('mock-fs', () => {
const memfs = jest.requireActual('memfs');

mock.fs = memfs.fs;

return Object.assign((volume = { }) => {
memfs.vol.reset();
memfs.vol.fromNestedJSON(volume);
memfs.vol.mkdirSync('.', { recursive: true });
memfs.vol.mkdirSync('/tmp', { recursive: true });
}, { restore: () => {} });
});

jest.mock('fs', () => mock.fs);
2 changes: 1 addition & 1 deletion kubernetes/test/apply-kubectl.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const exec = require('@actions/exec');
const mockFs = require('mock-fs');
const exec = require('@actions/exec');
const applyKubectl = require('../src/apply-kubectl');

jest.mock('@actions/exec');
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/test/autoscale.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const exec = require('@actions/exec');
const mockFs = require('mock-fs');
const exec = require('@actions/exec');
const fs = require('fs');
const applyAutoscale = require('../src/autoscale');

Expand Down
2 changes: 1 addition & 1 deletion kubernetes/test/check-namespace-exists.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const mockFs = require('mock-fs');
const exec = require('@actions/exec');

jest.mock('@actions/exec');

const mockFs = require('mock-fs');
const checkNamespaceExists = require('../src/check-namespace-exists');

const mockOutput = (data, opts) => {
Expand Down
3 changes: 1 addition & 2 deletions kubernetes/test/check-number-of-pods-running.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const mockFs = require('mock-fs');
const exec = require('@actions/exec');

jest.mock('@actions/exec');

const mockFs = require('mock-fs');

const checkRequiredNumberOfPodsIsRunning = require('../src/check-number-of-pods-running');

const mockErrorOutput = (data, opts) => {
Expand Down
6 changes: 2 additions & 4 deletions kubernetes/test/create-base-kustomize.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
let fs = require('fs');

const mockFs = require('mock-fs');
const createBaseKustomize = require('../src/create-base-kustomize');
const fs = require('fs');

fs = require('fs');
const createBaseKustomize = require('../src/create-base-kustomize');

describe('Creates base kustomize yaml files', () => {
beforeEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/test/run-deploy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jest.mock('../../utils', () => ({
getImageDigest: jest.fn(),
}));

const exec = require('@actions/exec');
const mockFs = require('mock-fs');
const exec = require('@actions/exec');
const { getClusterInfo } = require('../../cloud-run/src/cluster-info');
const { setupGcloud } = require('../../setup-gcloud');
const patchDeployment = require('../src/patch-deployment-yaml');
Expand Down
3 changes: 1 addition & 2 deletions maven/test/mvn.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
const mockFs = require('mock-fs');
const path = require('path');
let fs = require('fs');

const mockFs = require('mock-fs');

const os = require('os');

// Make sure we get a mocked FS.
Expand Down
Loading
Loading