@@ -2,11 +2,14 @@ import { describe, it, expect, beforeEach, afterEach } from 'vitest';
22import * as fs from 'node:fs' ;
33import * as path from 'node:path' ;
44import * as os from 'node:os' ;
5+ import { FileSystemUtils } from '../../../src/utils/file-system.js' ;
56import { artifactOutputExists , resolveArtifactOutputs } from '../../../src/core/artifact-graph/outputs.js' ;
67
78describe ( 'artifact-graph/outputs' , ( ) => {
89 let tempDir : string ;
910
11+ const canonical = ( targetPath : string ) : string => FileSystemUtils . canonicalizeExistingPath ( targetPath ) ;
12+
1013 beforeEach ( ( ) => {
1114 tempDir = path . join ( os . tmpdir ( ) , `openspec-outputs-test-${ Date . now ( ) } ` ) ;
1215 fs . mkdirSync ( tempDir , { recursive : true } ) ;
@@ -20,7 +23,7 @@ describe('artifact-graph/outputs', () => {
2023 const filePath = path . join ( tempDir , 'proposal.md' ) ;
2124 fs . writeFileSync ( filePath , 'content' ) ;
2225
23- expect ( resolveArtifactOutputs ( tempDir , 'proposal.md' ) ) . toEqual ( [ fs . realpathSync ( filePath ) ] ) ;
26+ expect ( resolveArtifactOutputs ( tempDir , 'proposal.md' ) ) . toEqual ( [ canonical ( filePath ) ] ) ;
2427 expect ( artifactOutputExists ( tempDir , 'proposal.md' ) ) . toBe ( true ) ;
2528 } ) ;
2629
@@ -38,7 +41,7 @@ describe('artifact-graph/outputs', () => {
3841 fs . mkdirSync ( nestedDir , { recursive : true } ) ;
3942 fs . writeFileSync ( filePath , 'content' ) ;
4043
41- expect ( resolveArtifactOutputs ( tempDir , 'specs/*/spec.md' ) ) . toEqual ( [ fs . realpathSync ( filePath ) ] ) ;
44+ expect ( resolveArtifactOutputs ( tempDir , 'specs/*/spec.md' ) ) . toEqual ( [ canonical ( filePath ) ] ) ;
4245 expect ( artifactOutputExists ( tempDir , 'specs/*/spec.md' ) ) . toBe ( true ) ;
4346 } ) ;
4447
@@ -50,7 +53,7 @@ describe('artifact-graph/outputs', () => {
5053 fs . writeFileSync ( matching , 'content' ) ;
5154 fs . writeFileSync ( nonMatching , 'content' ) ;
5255
53- expect ( resolveArtifactOutputs ( tempDir , 'specs/foo*.md' ) ) . toEqual ( [ fs . realpathSync ( matching ) ] ) ;
56+ expect ( resolveArtifactOutputs ( tempDir , 'specs/foo*.md' ) ) . toEqual ( [ canonical ( matching ) ] ) ;
5457 } ) ;
5558
5659 it ( 'supports question-mark glob patterns' , ( ) => {
@@ -60,7 +63,7 @@ describe('artifact-graph/outputs', () => {
6063 fs . writeFileSync ( matching , 'content' ) ;
6164 fs . writeFileSync ( path . join ( specsDir , 'a10.md' ) , 'content' ) ;
6265
63- expect ( resolveArtifactOutputs ( tempDir , 'specs/a?.md' ) ) . toEqual ( [ fs . realpathSync ( matching ) ] ) ;
66+ expect ( resolveArtifactOutputs ( tempDir , 'specs/a?.md' ) ) . toEqual ( [ canonical ( matching ) ] ) ;
6467 } ) ;
6568
6669 it ( 'supports character class glob patterns' , ( ) => {
@@ -73,8 +76,8 @@ describe('artifact-graph/outputs', () => {
7376 fs . writeFileSync ( path . join ( specsDir , 'c.md' ) , 'content' ) ;
7477
7578 expect ( resolveArtifactOutputs ( tempDir , 'specs/[ab].md' ) ) . toEqual ( [
76- fs . realpathSync ( aPath ) ,
77- fs . realpathSync ( bPath ) ,
79+ canonical ( aPath ) ,
80+ canonical ( bPath ) ,
7881 ] ) ;
7982 } ) ;
8083
@@ -92,10 +95,10 @@ describe('artifact-graph/outputs', () => {
9295 fs . symlinkSync ( realChangeDir , aliasChangeDir , process . platform === 'win32' ? 'junction' : 'dir' ) ;
9396
9497 expect ( resolveArtifactOutputs ( aliasChangeDir , 'proposal.md' ) ) . toEqual ( [
95- fs . realpathSync ( proposalPath ) ,
98+ canonical ( proposalPath ) ,
9699 ] ) ;
97100 expect ( resolveArtifactOutputs ( aliasChangeDir , 'specs/*/spec.md' ) ) . toEqual ( [
98- fs . realpathSync ( specPath ) ,
101+ canonical ( specPath ) ,
99102 ] ) ;
100103 } ) ;
101104
0 commit comments