Skip to content

Commit

Permalink
fix: update example-ts to latest github-actions version
Browse files Browse the repository at this point in the history
  • Loading branch information
kamontat committed Jun 14, 2024
1 parent 7c04701 commit 7c18412
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 499 deletions.
4 changes: 2 additions & 2 deletions actions/example-ts/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const createConfig = require("@kcws/eslint-config");
const createConfig = require("@kcws/eslint-config")
module.exports = createConfig({
cwd: __dirname,
profile: "node",
jest: true,
prettier: true,
ecma: "latest",
});
})
4 changes: 2 additions & 2 deletions actions/example-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
"clean": "heft clean"
},
"dependencies": {
"@kcws/github-actions": "0.8.1"
"@kcws/github-actions": "0.9.0"
},
"devDependencies": {
"@kcws/eslint-config": "1.21.1",
"@kcws/heft-node-rig": "0.25.0",
"@kcws/heft-node-rig": "0.26.0",
"@kcws/prettier-config": "0.17.2",
"@rushstack/heft": "0.66.18",
"@types/heft-jest": "1.0.6",
Expand Down
16 changes: 7 additions & 9 deletions actions/example-ts/src/runners/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
jest.mock("@actions/core")

import { info } from "@actions/core"

import app from "../app"
import app, { context } from "../app"
import runner from "./main"

describe("application runner", () => {
test("should print info logs with default value", async () => {
jest.spyOn(context.plugins.log, "info")

await app.exec(runner)

expect(info).toHaveBeenCalled()
expect(info).toHaveBeenLastCalledWith("hello world")
expect(context.plugins.log.info).toHaveBeenCalledTimes(2)
})

test("should print info logs with custom value", async () => {
jest.spyOn(context.plugins.log, "info")

await app.exec(runner, { name: "name" })

expect(info).toHaveBeenCalled()
expect(info).toHaveBeenLastCalledWith("hello name")
expect(context.plugins.log.info).toHaveBeenCalledTimes(2)
})
})
11 changes: 4 additions & 7 deletions actions/example-ts/src/runners/post.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
jest.mock("@actions/core")

import { info } from "@actions/core"

import app from "../app"
import app, { context } from "../app"
import runner from "./post"

describe("[post-hook] application runner", () => {
test("should print info logs", async () => {
jest.spyOn(context.plugins.log, "info")

app.exec(runner)
expect(info).toHaveBeenCalledTimes(1)
expect(info).toHaveBeenCalledWith("hello post world")
expect(context.plugins.log.info).toHaveBeenCalledTimes(1)
})
})
11 changes: 4 additions & 7 deletions actions/example-ts/src/runners/pre.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
jest.mock("@actions/core")

import { info } from "@actions/core"

import app from "../app"
import app, { context } from "../app"
import runner from "./pre"

describe("[pre-hook] application runner", () => {
test("should print info logs", async () => {
jest.spyOn(context.plugins.log, "info")

app.exec(runner)
expect(info).toHaveBeenCalledTimes(1)
expect(info).toHaveBeenCalledWith("hello pre world")
expect(context.plugins.log.info).toHaveBeenCalledTimes(1)
})
})
Loading

0 comments on commit 7c18412

Please sign in to comment.