Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mockApi failing on WSL2 #25

Open
shubhbapna opened this issue Apr 13, 2023 · 0 comments
Open

mockApi failing on WSL2 #25

shubhbapna opened this issue Apr 13, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@shubhbapna
Copy link
Collaborator

Describe the bug
It seems like mockApi is failing in a WSL2 windows 11 environment

To Reproduce

Workflow
name: Act Push Test 1
on: push
jobs:
  push1:
    runs-on: ubuntu-latest
    steps:
      - run: echo "push 1"
      - name: secrets
        run: echo $TEST1
        env:
          TEST1: ${{secrets.SECRET1}}
      - name: env
        run: echo $ENV1
      - name: pass
        run: echo "pass"
      - name: fail
        run: echo "fail" && exit 1
Code

Taken from act.test.ts

 test("run with proxy", async () => {
    const mockapi = new Mockapi({
      google: {
        baseUrl: "http://google.com",
        endpoints: {
          root: {
            get: {
              path: "/",
              method: "get",
              parameters: {
                query: [],
                path: [],
                body: [],
              },
            },
          },
        },
      },
    });

    const act = new Act();
    const output = await act.runJob("mock", {
      workflowFile: resources,
      mockApi: [
        mockapi.mock.google.root
          .get()
          .setResponse({ status: 200, data: "mock response" }),
      ],
    });
    expect(output).toStrictEqual([
      {
        name: "Main https api call",
        status: 0,
        output: expect.stringMatching(/<HTML><HEAD>.+/),
      },
      {
        name: "Main http api call",
        status: 0,
        output: "mock response",
      },
    ]);
  });

Expected behavior
Test should pass. Test passes in other linux environments

Logs

run › run with proxy

    expect(received).toStrictEqual(expected) // deep equality

    - Expected  - 7
    + Received  + 2

      Array [
        Object {
          "name": "Main https api call",
    -     "output": StringMatching /<HTML><HEAD>.+/,
    -     "status": 0,
    -   },
    -   Object {
    -     "name": "Main http api call",
    -     "output": "mock response",
    -     "status": 0,
    +     "output": "",
    +     "status": 1,
        },
      ]

      133 |       ],
      134 |     });
    > 135 |     expect(output).toStrictEqual([
          |                    ^
      136 |       {
      137 |         name: "Main https api call",
      138 |         status: 0,

      at Object.<anonymous> (test/unit/act/act.test.ts:135:20)
@shubhbapna shubhbapna added the bug Something isn't working label Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant