Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@ jobs:
build:
strategy:
matrix:
mops-version: [ic-mops@1.0.0, ./cli/dist]
moc-version: [0.14.13]
node-version: [22]
include:
- mops-version: ic-mops@1.0.0
test-global: false
- mops-version: ./cli/dist
test-global: false
- mops-version: ./cli/dist
test-global: true

runs-on: ubuntu-latest
name: node ${{ matrix.node-version }}, moc ${{ matrix.moc-version }}, ${{ matrix.mops-version }}
Expand Down Expand Up @@ -82,9 +88,18 @@ jobs:
- name: Pre-cache moc 1.3.0 and test fixture dependencies
run: |
mops toolchain use moc 1.3.0 && mops toolchain use moc ${{ matrix.moc-version }}
cd cli/tests/check/fix && mops install
(cd cli/tests/check/fix && mops install)
(cd cli/tests/build/success && mops install)
(cd cli/tests/build/error && mops install)

- name: Run CLI tests
if: ${{ !matrix.test-global }}
run: cd cli && npm test

- name: Run CLI tests (global)
if: ${{ matrix.test-global }}
env:
MOPS_TEST_GLOBAL: 1
run: cd cli && npm test
Comment thread
rvanasa marked this conversation as resolved.

bundle-smoke-test:
Expand Down
10 changes: 9 additions & 1 deletion cli/tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ export interface CliOptions {
cwd?: string;
}

// When MOPS_TEST_GLOBAL is set, invoke the globally-installed `mops` binary
// directly rather than the npm script. This exercises the real global-install
// code path where the binary lives outside the project tree.
const useGlobalBinary = Boolean(process.env.MOPS_TEST_GLOBAL);

export const cli = async (args: string[], { cwd }: CliOptions = {}) => {
return await execa("npm", ["run", "--silent", "mops", "--", ...args], {
const [cmd, cmdArgs] = useGlobalBinary
? ["mops", args]
: ["npm", ["run", "--silent", "mops", "--", ...args]];
return await execa(cmd, cmdArgs, {
env: { ...process.env, ...(cwd != null && { MOPS_CWD: cwd }) },
...(cwd != null && { cwd }),
stdio: "pipe",
Expand Down
Loading