11import path from 'path' ;
2- import { DestroyOrchestrator } from '../../../src/orchestrators/destroy.js' ;
32
43import { describe , it , vi , afterEach , expect } from 'vitest' ;
54import { MockOs } from '../mocks/system.js' ;
65import { Plan } from '../../../src/entities/plan.js' ;
76import { ResourceOperation } from 'codify-schemas' ;
87import { MockReporter } from '../mocks/reporter.js' ;
9- import { ApplyOrchestrator } from '../../../src/orchestrators/apply' ;
108import { PlanOrchestrator } from '../../../src/orchestrators/plan' ;
9+ import { OsUtils } from "../../../src/utils/os-utils.js" ;
1110
1211vi . mock ( '../../../src/plugins/plugin.js' , async ( ) => {
1312 const { MockPlugin } = await import ( '../mocks/plugin.js' ) ;
@@ -16,7 +15,7 @@ vi.mock('../../../src/plugins/plugin.js', async () => {
1615
1716// The apply orchestrator directly calls plan so this will test both
1817describe ( 'Plan orchestrator tests' , ( ) => {
19- it ( 'Can plan a resource (create) including xcode-tools' , async ( ) => {
18+ it ( 'Can plan a resource (create) including xcode-tools' , { skip : ! OsUtils . isMacOS ( ) } , async ( ) => {
2019 const reporter = new MockReporter ( {
2120 validatePlan ( plan : Plan ) {
2221 // Xcode-tools will always show up in the plan
@@ -56,10 +55,15 @@ describe('Plan orchestrator tests', () => {
5655 it ( 'Prioritizes xcode-tools in front of other resources' , async ( ) => {
5756 const reporter = new MockReporter ( {
5857 validatePlan ( plan : Plan ) {
59- // Xcode-tools will always show up in the plan
60- expect ( plan . getResourcePlan ( 'xcode-tools' ) ) . toMatchObject ( {
61- operation : ResourceOperation . CREATE
62- } )
58+ if ( OsUtils . isMacOS ( ) ) {
59+ // Xcode-tools will always show up in the plan
60+ expect ( plan . getResourcePlan ( 'xcode-tools' ) ) . toMatchObject ( {
61+ operation : ResourceOperation . CREATE
62+ } )
63+ } else {
64+ // Xcode-tools should not be in the plan for linux or other OS
65+ expect ( plan . getResourcePlan ( 'xcode-tools' ) ) . to . be . null ;
66+ }
6367 expect ( plan . getResourcePlan ( 'mock.0' ) ) . toMatchObject ( {
6468 operation : ResourceOperation . CREATE ,
6569 } ) ;
@@ -84,8 +88,13 @@ describe('Plan orchestrator tests', () => {
8488 expect ( project ) . to . exist ;
8589 expect ( pluginManager ) . to . exist ;
8690
87- expect ( project . evaluationOrder . length ) . to . eq ( 7 ) ;
88- expect ( project . evaluationOrder [ 0 ] ) . to . eq ( 'xcode-tools' ) ;
91+ if ( OsUtils . isMacOS ( ) ) {
92+ expect ( project . evaluationOrder . length ) . to . eq ( 7 ) ;
93+ expect ( project . evaluationOrder [ 0 ] ) . to . eq ( 'xcode-tools' ) ;
94+ } else {
95+ expect ( project . evaluationOrder . length ) . to . eq ( 6 ) ;
96+ expect ( project . evaluationOrder [ 0 ] ) . to . not . eq ( 'xcode-tools' ) ;
97+ }
8998
9099 // Nothing should be changed in the plan
91100 expect ( MockOs . get ( 'xcode-tools' ) ) . to . be . undefined ;
0 commit comments