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

Fix dumping payload with outfile #5152

Merged
merged 1 commit into from
Nov 8, 2024
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
33 changes: 33 additions & 0 deletions javascript_client/src/__tests__/__snapshots__/syncTest.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions javascript_client/src/__tests__/syncTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,28 @@ describe("sync operations", () => {
})
})

it("Can dump payload and outfile at the same time", () => {
var options = {
client: "test-2",
path: "./src/__tests__/project",
quiet: true,
outfile: "customOutfile.js",
dumpPayload: "customDumpPayload.js"
}

return sync(options).then(function() {
var generatedCode = fs.readFileSync("./customOutfile.js", "utf8")
expect(generatedCode).toMatch('"GetStuff": "4568c28d403794e011363caf815ec827"')
expect(generatedCode).toMatch('module.exports = OperationStoreClient')
expect(generatedCode).toMatch('var _client = "test-2"')

var generatedPayload = fs.readFileSync("./customDumpPayload.js", "utf8")
expect(generatedPayload).toMatchSnapshot()
fs.unlinkSync("./customOutfile.js")
fs.unlinkSync("./customDumpPayload.js")
})
})

it("Skips outfile generation when using --persist-output artifact", () => {
var options = {
client: "test-2",
Expand Down
1 change: 1 addition & 0 deletions javascript_client/src/sync/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ function sync(options: SyncOptions) {
})
} else if (dumpingPayload) {
sendFunc(payload, { dumpPayload: options.dumpPayload })
resolve(payload)
return
} else {
// This is a local-only run to generate an artifact
Expand Down
Loading