Skip to content
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
24 changes: 24 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"overrides": [
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"semi": ["error", "always"],
"quotes": ["error", "double"]
}
}
15 changes: 15 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## What

Describe the change.

## Why

Describe the business reason for the change.

## How

Describe the implementation.

## Testing

Describe how to test your changes.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Describes the Dependabot configurations to use for this project. This will automatically open PRs
# for library upgrades whenever a library can be upgraded or patched.
#
# This file will be parsed only on the main project and based on the description outlined here:
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
#
# See more information on the job that runs to perform this check, navigate to this link in the
# Github project:
# Insights -> Dependency graph -> Dependabot
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
15 changes: 15 additions & 0 deletions .github/workflows/npm_test_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: NPM Test Coverage
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason you added running these tests in Github instead of CCI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@d10zero that was how it was already setup - see here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

would we rather CCI?

Copy link
Contributor

@d10zero d10zero Mar 3, 2026

Choose a reason for hiding this comment

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

No I think this is fine! I think its easier/cleaner in github since we are just running npm test - and we don't make changes to this repo often


on: [push]

jobs:
npm_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- run: npm install
- run: npm run test
20 changes: 20 additions & 0 deletions .github/workflows/rebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
on:
issue_comment:
types: [created]
name: Automatic Rebase
jobs:
rebase:
name: Rebase
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fix git safe.directory in container # see https://github.com/actions/runner/issues/2033
run: mkdir -p /home/runner/work/_temp/_github_home && printf "[safe]\n\tdirectory = /github/workspace" > /home/runner/work/_temp/_github_home/.gitconfig
- name: Automatic Rebase
uses: cirrus-actions/rebase@1.8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Dependencies
node_modules/

# Build output
dist/
lib/
out/

# Logs
logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# IDE and editor files
.idea/
.vscode/
*.swp
*.swo
.DS_Store

# Test coverage
coverage/

# npm package files
*.tgz
.npmrc

# Environment variables
.env
.env.local
.env.*.local

# CDKTF output
cdktf.out/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.11
58 changes: 58 additions & 0 deletions __tests__/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import * as core from "@actions/core";
import { RunDiff } from "../src/runDiff";
import run from "../src/index";

// Mock dependencies
jest.mock("@actions/core");
jest.mock("../src/runDiff", () => ({
RunDiff: jest.fn()
}));

describe("index", () => {
beforeEach(() => {
jest.clearAllMocks();
});

it("should execute RunDiff successfully", async () => {
// Mock RunDiff implementation
const mockRun = jest.fn();
(RunDiff as jest.Mock).mockImplementation(() => ({
run: mockRun
}));

await run();

// Verify RunDiff was instantiated and run was called
expect(RunDiff).toHaveBeenCalledTimes(1);
expect(mockRun).toHaveBeenCalledTimes(1);
expect(core.setFailed).not.toHaveBeenCalled();
});

it("should handle Error objects", async () => {
// Mock RunDiff to throw an Error
const errorMessage = "Test error";
const mockRun = jest.fn().mockRejectedValue(new Error(errorMessage));
(RunDiff as jest.Mock).mockImplementation(() => ({
run: mockRun
}));

await run();

// Verify error was handled correctly
expect(core.setFailed).toHaveBeenCalledWith(errorMessage);
});

it("should handle non-Error objects", async () => {
// Mock RunDiff to throw a string
const errorString = "String error";
const mockRun = jest.fn().mockRejectedValue(errorString);
(RunDiff as jest.Mock).mockImplementation(() => ({
run: mockRun
}));

await run();

// Verify error was handled correctly
expect(core.setFailed).toHaveBeenCalledWith(errorString);
});
});
Loading