Skip to content

Commit

Permalink
Merge pull request #5152 from rmosolgo/fix-sync-dump-with-outfile
Browse files Browse the repository at this point in the history
Fix dumping payload with outfile
  • Loading branch information
rmosolgo authored Nov 8, 2024
2 parents 777b861 + be65137 commit bf5a03b
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
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

0 comments on commit bf5a03b

Please sign in to comment.