Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Recording tests with jest results in 0-length AppMaps in tmp/appmap/process #166

Closed
kgilpin opened this issue Dec 23, 2022 · 3 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@kgilpin
Copy link
Contributor

kgilpin commented Dec 23, 2022

➜  sequence-diagram git:(feat/seq-diagram-diff-text) ✗ npx @appland/appmap-agent-js -- yarn jest 

(node:16740) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:16752) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:16755) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:16768) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:16769) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:16770) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:16771) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:16772) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:16773) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:16774) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:16775) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:16776) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
 PASS  tests/unit/diff.spec.ts
 PASS  tests/integration/sequenceDiagram.spec.ts
 PASS  tests/unit/sequenceDiagram.spec.ts
 PASS  tests/integration/sequenceDiagramDiff.spec.ts
 PASS  tests/unit/sql.spec.ts
 FAIL  tests/unit/http.spec.ts
  ● Sequence diagram › HTTP server request › is recorded

    assert.strictEqual(received, expected)

    Expected value to strictly be equal to:
      302
    Received:
      undefined

    Difference:

      Comparing two different types of values. Expected number but received undefined.

      28 |       assert(action, `Server RPC 'PATCH /checkout/update/{state}' not found`);
      29 |       assert(isServerRPC(action));
    > 30 |       assert.strictEqual(action.status, 302);
         |              ^
      31 |     });
      32 |   });
      33 |

      at Object.<anonymous> (tests/unit/http.spec.ts:30:14)

  ● Sequence diagram › HTTP client request › is recorded

    assert.strictEqual(received, expected)

    Expected value to strictly be equal to:
      200
    Received:
      undefined

    Difference:

      Comparing two different types of values. Expected number but received undefined.

      43 |       assert(action, `Client RPC 'POST https://api.stripe.com/v1/customers' not found`);
      44 |       assert(isClientRPC(action));
    > 45 |       assert.strictEqual(action.status, 200);
         |              ^
      46 |     });
      47 |
      48 |     it('sorts to the left of the database', () => {

      at Object.<anonymous> (tests/unit/http.spec.ts:45:14)

Test Suites: 1 failed, 5 passed, 6 total
Tests:       2 failed, 18 passed, 20 total
Snapshots:   0 total
Time:        4.961 s
Ran all test suites.
➜  sequence-diagram git:(feat/seq-diagram-diff-text) ✗ find tmp/appmap 
tmp/appmap
tmp/appmap/process
tmp/appmap/process/anonymous-11.appmap.json
tmp/appmap/process/anonymous-2.appmap.json
tmp/appmap/process/anonymous-18.appmap.json
tmp/appmap/process/anonymous-7.appmap.json
tmp/appmap/process/anonymous-14.appmap.json
tmp/appmap/process/anonymous-17.appmap.json
tmp/appmap/process/anonymous-4.appmap.json
tmp/appmap/process/anonymous-1.appmap.json
tmp/appmap/process/anonymous.appmap.json
tmp/appmap/process/anonymous-12.appmap.json
tmp/appmap/process/anonymous-8.appmap.json
tmp/appmap/process/anonymous-20.appmap.json
tmp/appmap/process/anonymous-15.appmap.json
tmp/appmap/process/anonymous-6.appmap.json
tmp/appmap/process/anonymous-3.appmap.json
tmp/appmap/process/anonymous-19.appmap.json
tmp/appmap/process/anonymous-10.appmap.json
tmp/appmap/process/anonymous-13.appmap.json
tmp/appmap/process/anonymous-9.appmap.json
tmp/appmap/process/anonymous-5.appmap.json
tmp/appmap/process/anonymous-16.appmap.json
tmp/appmap/jest

Every AppMap:

Screen Shot 2022-12-23 at 5 11 43 PM

@kgilpin kgilpin added the bug Something isn't working label Dec 23, 2022
@lachrist
Copy link
Contributor

The problem is that yarn jest is not recognized as a jest command. The agent does not know how to insert jest hook and uses the process instead of the jest recorder. The reason why your appmaps are empty is because the process recorder is not able to record the workers used by jest. So you are only recording the jest test runner which is not instrumented by default.

@lachrist
Copy link
Contributor

I could not reproduce the assertions failures. On my setup. The tests run fine with the agent (but that appmaps are indeed empty).

@lachrist
Copy link
Contributor

#168

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants