-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add node-version-file input for reading Node.js version from files #5
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,243 @@ | ||||||||||||||||||||||||||||||||||||||||
| import { describe, it, expect, beforeEach, afterEach, vi } from "vite-plus/test"; | ||||||||||||||||||||||||||||||||||||||||
| import { readFileSync } from "node:fs"; | ||||||||||||||||||||||||||||||||||||||||
| import { resolveNodeVersionFile } from "./node-version-file.js"; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| vi.mock("@actions/core", () => ({ | ||||||||||||||||||||||||||||||||||||||||
| info: vi.fn(), | ||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| vi.mock("node:fs", () => ({ | ||||||||||||||||||||||||||||||||||||||||
| readFileSync: vi.fn(), | ||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| describe("resolveNodeVersionFile", () => { | ||||||||||||||||||||||||||||||||||||||||
| const originalEnv = process.env; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| beforeEach(() => { | ||||||||||||||||||||||||||||||||||||||||
| vi.resetAllMocks(); | ||||||||||||||||||||||||||||||||||||||||
| process.env = { ...originalEnv, GITHUB_WORKSPACE: "/workspace" }; | ||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| afterEach(() => { | ||||||||||||||||||||||||||||||||||||||||
| process.env = originalEnv; | ||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+14
to
+24
|
||||||||||||||||||||||||||||||||||||||||
| const originalEnv = process.env; | |
| beforeEach(() => { | |
| vi.resetAllMocks(); | |
| process.env = { ...originalEnv, GITHUB_WORKSPACE: "/workspace" }; | |
| }); | |
| afterEach(() => { | |
| process.env = originalEnv; | |
| }); | |
| beforeEach(() => { | |
| vi.resetAllMocks(); | |
| vi.stubEnv("GITHUB_WORKSPACE", "/workspace"); | |
| }); | |
| afterEach(() => { | |
| vi.unstubAllEnvs(); | |
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The action entrypoint is
dist/index.mjs(per action.yml), but the compileddistoutput doesn't include the newnode-version-file/resolveNodeVersionFilelogic (no references found). Please run the build/pack step and commit the updateddist/index.mjs, otherwise users won't actually get this feature when using the action.