Skip to content

Commit 32fc19a

Browse files
authored
fix: Windows path compatibility in resolver tests (Fission-AI#524)
- Use path.join() in test expectations instead of hardcoded forward slashes - Add openspec/config.yaml with cross-platform requirements to prevent similar issues in future proposals The tests were failing on Windows because path.join() uses backslashes on Windows, but the test expectations hardcoded forward slashes.
1 parent 84f3725 commit 32fc19a

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

openspec/config.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
schema: spec-driven
2+
3+
context: |
4+
Tech stack: TypeScript, Node.js (≥20.19.0), ESM modules
5+
Package manager: pnpm
6+
CLI framework: Commander.js
7+
8+
Cross-platform requirements:
9+
- This tool runs on macOS, Linux, AND Windows
10+
- Always use path.join() or path.resolve() for file paths - never hardcode slashes
11+
- Never assume forward-slash path separators
12+
- Tests must use path.join() for expected path values, not hardcoded strings
13+
- Consider case sensitivity differences in file systems
14+
15+
rules:
16+
specs:
17+
- Include scenarios for Windows path handling when dealing with file paths
18+
- Requirements involving paths must specify cross-platform behavior
19+
tasks:
20+
- Add Windows CI verification as a task when changes involve file paths
21+
- Include cross-platform testing considerations
22+
design:
23+
- Document any platform-specific behavior or limitations
24+
- Prefer Node.js path module over string manipulation for paths

test/core/artifact-graph/resolver.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,12 +335,12 @@ version: [[[invalid yaml
335335
it('should return correct path', () => {
336336
const projectRoot = '/path/to/project';
337337
const schemasDir = getProjectSchemasDir(projectRoot);
338-
expect(schemasDir).toBe('/path/to/project/openspec/schemas');
338+
expect(schemasDir).toBe(path.join('/path/to/project', 'openspec', 'schemas'));
339339
});
340340

341341
it('should work with relative-looking paths', () => {
342342
const schemasDir = getProjectSchemasDir('./my-project');
343-
expect(schemasDir).toBe('my-project/openspec/schemas');
343+
expect(schemasDir).toBe(path.join('my-project', 'openspec', 'schemas'));
344344
});
345345
});
346346

0 commit comments

Comments
 (0)