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

chore(deps-dev): bump eslint-plugin-sonarjs from 1.0.4 to 2.0.2 #103

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"eslint-plugin-no-null": "^1.0.2",
"eslint-plugin-redundant-undefined": "^1.0.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-sonarjs": "^1.0.4",
"eslint-plugin-sonarjs": "^2.0.2",
"eslint-plugin-unicorn": "^55.0.0",
"mkdirp": "^3.0.1",
"prettier": "^3.3.3",
Expand Down
22 changes: 5 additions & 17 deletions src/create-cluster.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const telemetryLoggerMock = {
test('expect error is cli returns non zero exit code', async () => {
try {
(extensionApi.process.exec as Mock).mockReturnValue({ exitCode: -1, error: 'error' });
await createCluster({}, undefined, '', telemetryLoggerMock, undefined);
await createCluster({}, undefined, '', telemetryLoggerMock);
} catch (err) {
expect(err).to.be.a('Error');
expect(err.message).equal('Failed to create minikube cluster. error');
Expand All @@ -66,7 +66,7 @@ test('expect error is cli returns non zero exit code', async () => {

test('expect cluster to be created', async () => {
(extensionApi.process.exec as Mock).mockReturnValue({ exitCode: 0 });
await createCluster({}, undefined, '', telemetryLoggerMock, undefined);
await createCluster({}, undefined, '', telemetryLoggerMock);
expect(telemetryLogUsageMock).toHaveBeenNthCalledWith(
1,
'createCluster',
Expand All @@ -85,7 +85,7 @@ test('expect error if Kubernetes reports error', async () => {
warn: vi.fn(),
};
(extensionApi.kubernetes.createResources as Mock).mockRejectedValue(new Error('Kubernetes error'));
await createCluster({}, logger, '', telemetryLoggerMock, undefined);
await createCluster({}, logger, '', telemetryLoggerMock);
} catch (err) {
expect(extensionApi.kubernetes.createResources).toBeCalled();
expect(err).to.be.a('Error');
Expand All @@ -99,13 +99,7 @@ test('expect error if Kubernetes reports error', async () => {

test('expect cluster to be created with custom base image', async () => {
(extensionApi.process.exec as Mock).mockReturnValue({ exitCode: 0 });
await createCluster(
{ 'minikube.cluster.creation.base-image': 'myCustomImage' },
undefined,
'',
telemetryLoggerMock,
undefined,
);
await createCluster({ 'minikube.cluster.creation.base-image': 'myCustomImage' }, undefined, '', telemetryLoggerMock);
expect(telemetryLogUsageMock).toHaveBeenNthCalledWith(
1,
'createCluster',
Expand All @@ -132,13 +126,7 @@ test('expect cluster to be created with custom base image', async () => {

test('expect cluster to be created with custom mount', async () => {
(extensionApi.process.exec as Mock).mockReturnValue({ exitCode: 0 });
await createCluster(
{ 'minikube.cluster.creation.mount-string': '/foo:/bar' },
undefined,
'',
telemetryLoggerMock,
undefined,
);
await createCluster({ 'minikube.cluster.creation.mount-string': '/foo:/bar' }, undefined, '', telemetryLoggerMock);
expect(telemetryLogUsageMock).toHaveBeenNthCalledWith(
1,
'createCluster',
Expand Down
2 changes: 1 addition & 1 deletion src/create-cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function createCluster(
const baseImage = params['minikube.cluster.creation.base-image'];
const mountString = params['minikube.cluster.creation.mount-string'];

const env = Object.assign({}, process.env);
const env = { ...process.env };

const startArgs = ['start', '--profile', clusterName, '--driver', driver, '--container-runtime', runtime];

Expand Down
1 change: 1 addition & 0 deletions src/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export class MinikubeDownload {

async makeExecutable(filePath: string): Promise<void> {
if (process.platform === 'darwin' || process.platform === 'linux') {
// eslint-disable-next-line sonarjs/file-permissions
await promises.chmod(filePath, 0o755);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ async function updateClusters(provider: extensionApi.Provider, containers: exten
const lifecycle: extensionApi.ProviderConnectionLifecycle = {
start: async (): Promise<void> => {
try {
const env = Object.assign({}, process.env);
const env = { ...process.env };
env.PATH = getMinikubePath();
await extensionApi.process.exec(minikubeCli, ['start', '--profile', cluster.name], { env });
} catch (err) {
Expand All @@ -129,14 +129,14 @@ async function updateClusters(provider: extensionApi.Provider, containers: exten
}
},
stop: async (): Promise<void> => {
const env = Object.assign({}, process.env);
const env = { ...process.env };
env.PATH = getMinikubePath();
await extensionApi.process.exec(minikubeCli, ['stop', '--profile', cluster.name, '--keep-context-active'], {
env,
});
},
delete: async (logger): Promise<void> => {
const env = Object.assign({}, process.env);
const env = { ...process.env };
env.PATH = getMinikubePath();
env.MINIKUBE_HOME = getMinikubeHome();
await extensionApi.process.exec(minikubeCli, ['delete', '--profile', cluster.name], { env, logger });
Expand Down
2 changes: 1 addition & 1 deletion src/image-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class ImageHandler {
if (selectedCluster) {
let name = image.name;
let filename: string;
const env = Object.assign({}, process.env);
const env = { ...process.env };

// Create a name:tag string for the image
if (image.tag) {
Expand Down
Loading