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: Override smithy-client to fix CodeQL warning #685

Merged
merged 3 commits into from
Nov 25, 2024

Conversation

dani-chmb
Copy link
Contributor

Issue #, if available:

Code Scanning alert

Description of changes:

Addresses similar issue to corresponding render task definition PR.

The changes were tested by running a workflow that calls the action defined by this PR's commit from a simple ecs application.

Screenshot 2024-11-25 at 14 14 32

Note commit ids of the Github actions executed.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@dani-chmb
Copy link
Contributor Author

dani-chmb commented Nov 25, 2024

Unit tests failing since % npm ci gives an error. But on my local machine, % npm ci seems to work.

Update: npm test is the command that's failing.

@@ -9,6 +9,9 @@ jest.mock('@actions/core');
jest.mock('fs', () => ({
promises: { access: jest.fn() },
readFileSync: jest.fn(),
constants: {
O_CREATE: jest.fn()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to address unit test failures.

If we regenerate package-lock.json and then run unit-tests, even on the master branch for this repo (which, at the time of writing, points to this commit)

% rm -rf node_modules
% rm package-lock.json
% npm install
% npm ci
% npm test

We will get the same error that triggered the initial unit test failures for this PR, that is:

> aws-actions-amazon-ecs-deploy-task-definition@2.1.2 test
> eslint **.js && jest --coverage

FAIL ./index.test.js
  ● Test suite failed to run

    TypeError: Cannot read properties of undefined (reading 'O_RDONLY')

      1 | const path = require('path');
    > 2 | const core = require('@actions/core');

Example unit test failure

To fix this, we've added this line, originally found in the render task def repository. Note that the render task def repository is passing unit tests.

@dani-chmb dani-chmb merged commit 69a85ec into aws-actions:master Nov 25, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants