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

Is it possible to run with Jest? #41

Open
edouard-lopez opened this issue Jan 11, 2022 · 0 comments
Open

Is it possible to run with Jest? #41

edouard-lopez opened this issue Jan 11, 2022 · 0 comments

Comments

@edouard-lopez
Copy link

Thanks for the tool, I'm running all my other test with jest and was wondering if it is possible to use it for nexpect test?

Test

import nexpect from 'nexpect';

nexpect
  .spawn('yarn', ['start'])
  .expect('hello')
  .run(function(err) {
    if (!err) {
      console.log('hello was echoed');
    }
  });

Output

Currently I got

❯ node_modules/.bin/jest --verbose --watch ./src/__tests__/cli.test.ts
FAIL  src/__tests__/cli.test.ts
  ● Test suite failed to run

    Your test suite must contain at least one test.

      at onResult (node_modules/jest-cli/node_modules/@jest/core/build/TestScheduler.js:175:18)
      at node_modules/emittery/index.js:260:13
          at Array.map (<anonymous>)
      at Emittery.emit (node_modules/emittery/index.js:258:23)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        1.132 s
Ran all test suites matching /.\/src\/__tests__\/cli.test.ts/i.

Active Filters: filename /./src/__tests__/cli.test.ts/
 › Press c to clear filters.

Watch Usage
 › Press a to run all tests.
 › Press f to run only failed tests.
 › Press o to only run tests related to changed files.
 › Press p to filter by a filename regex pattern.
 › Press t to filter by a test name regex pattern.
 › Press q to quit watch mode.
 › Press Enter to trigger a test run.

  ●  Cannot log after tests are done. Did you forget to wait for something async in your test?
    Attempted to log "hello was echoed".

      10 |   });
      11 |

      at console.log (node_modules/jest-cli/node_modules/@jest/console/build/CustomConsole.js:187:10)
      at src/__tests__/cli.test.ts:12:17
      at ChildProcess.<anonymous> (node_modules/nexpect/lib/nexpect.js:303:9)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant