Skip to content

Commit ad9df2c

Browse files
committed
making integration test pass for windows systems
1 parent 361447d commit ad9df2c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/methods/get-function-info.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { EventEmitter } from "events";
22
import { spawn } from "child_process";
3+
import path from "path";
34

45
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
56

@@ -38,7 +39,8 @@ describe("getFunctionInfo", () => {
3839
},
3940
};
4041

41-
const promise = getFunctionInfo("/path/to/extensions/my-function");
42+
const functionDir = "/path/to/extensions/my-function";
43+
const promise = getFunctionInfo(functionDir);
4244

4345
// Simulate successful CLI response
4446
setTimeout(() => {
@@ -48,12 +50,16 @@ describe("getFunctionInfo", () => {
4850

4951
const result = await promise;
5052

53+
// Calculate expected cwd the same way the implementation does
54+
const resolvedFunctionDir = path.resolve(functionDir);
55+
const expectedCwd = path.dirname(resolvedFunctionDir);
56+
5157
expect(result).toEqual(mockFunctionInfo);
5258
expect(mockSpawn).toHaveBeenCalledWith(
5359
"shopify",
5460
["app", "function", "info", "--json", "--path", "my-function"],
5561
expect.objectContaining({
56-
cwd: "/path/to/extensions",
62+
cwd: expectedCwd,
5763
env: expect.objectContaining({
5864
SHOPIFY_INVOKED_BY: "shopify-function-test-helpers",
5965
}),

0 commit comments

Comments
 (0)