diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f6756a4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x, 22.x, 23.x] + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install pnpm + uses: pnpm/action-setup@v3 + with: + version: 8 + + - name: Install dependencies + run: pnpm install + + - name: Build + run: pnpm build + + - name: Test + run: pnpm test + + - name: Test Coverage + run: pnpm test:coverage diff --git a/src/shell-server/__tests__/shell-config.test.ts b/src/shell-server/__tests__/shell-config.test.ts index b20e6fd..ba3f4a6 100644 --- a/src/shell-server/__tests__/shell-config.test.ts +++ b/src/shell-server/__tests__/shell-config.test.ts @@ -39,6 +39,25 @@ vi.mock('../lib/logger.js', () => ({ } })); +// Mock the shell-config module for all tests +vi.mock('../shell-config.js', () => { + // Default implementation that can be overridden in individual tests + return { + default: () => { + if (process.env.SHELL) { + return process.env.SHELL; + } + + const options = mockOpts(); + if (options.shell) { + return options.shell; + } + + return mockPlatform() === 'win32' ? 'cmd.exe' : '/bin/bash'; + } + }; +}); + describe('Shell configuration', () => { beforeEach(() => { // Reset all mocks