-
-
Notifications
You must be signed in to change notification settings - Fork 106
Tighten helper binstub parity and PATH lookup #1128
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
Merged
+150
−23
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
19260e3
Tighten binstub sync coverage and helper specs (#1123)
justin808 8a1bb8e
Address createBinStub review nits
justin808 5a78026
Address latest createBinStub review nits
justin808 dd11291
Address binstub review nits
justin808 e7af957
Address remaining binstub coverage review notes
justin808 ed0c02c
Retrigger Claude Code Review
justin808 6f42114
Honor empty PATH entries in helper binstubs
justin808 291baa6
Preserve trailing empty PATH entries
justin808 cf78729
Polish binstub spec PATH default and sync failure message
justin808 88a44c9
Mark createBinStub export as @internal
justin808 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| const { | ||
| accessSync, | ||
| constants, | ||
| mkdtempSync, | ||
| readFileSync, | ||
| rmSync | ||
| } = require("fs") | ||
| const { join, resolve } = require("path") | ||
| const { tmpdir } = require("os") | ||
| const { createBinStub } = require("../../package/configExporter/cli") | ||
|
|
||
| const gemRoot = resolve(__dirname, "../..") | ||
|
|
||
| // The Ruby logic in lib/install/bin/shakapacker-config and | ||
| // lib/install/bin/diff-bundler-config is also duplicated inside the | ||
| // `createBinStub` template in package/configExporter/cli.ts. The Ruby spec | ||
| // (spec/shakapacker/binstub_sync_spec.rb) keeps the three checked-in copies | ||
| // (install template, install diff template, and the dummy app's binstub) | ||
| // honest, but it cannot reach into the JS template. This test closes that | ||
| // gap by invoking createBinStub for both helper names and asserting the | ||
| // generated content matches the corresponding lib/install/bin/* file. | ||
| describe("createBinStub template parity", () => { | ||
| let tmp | ||
|
|
||
| beforeEach(() => { | ||
| tmp = mkdtempSync(join(tmpdir(), "shakapacker-createBinStub-")) | ||
| }) | ||
|
|
||
| afterEach(() => { | ||
|
justin808 marked this conversation as resolved.
|
||
| rmSync(tmp, { recursive: true, force: true }) | ||
| }) | ||
|
|
||
| // diff-bundler-config is a white-box parity case; production init only | ||
| // generates shakapacker-config. | ||
| test.each(["shakapacker-config", "diff-bundler-config"])( | ||
| "generates lib/install/bin/%s byte-for-byte", | ||
| (binstubName) => { | ||
| const generatedPath = join(tmp, "bin", binstubName) | ||
| createBinStub(generatedPath) | ||
|
justin808 marked this conversation as resolved.
|
||
|
|
||
| const generated = readFileSync(generatedPath, "utf8") | ||
| const installed = readFileSync( | ||
| join(gemRoot, "lib", "install", "bin", binstubName), | ||
| "utf8" | ||
| ) | ||
|
|
||
| expect(generated).toBe(installed) | ||
|
justin808 marked this conversation as resolved.
|
||
| expect(() => accessSync(generatedPath, constants.X_OK)).not.toThrow() | ||
| } | ||
| ) | ||
| }) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.