question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Flow can't find 'chai' export expect()/assert()/should()

See original GitHub issue

@samwgoldman if I leverage chai using the customary import for ‘expect’:

import { expect } from 'chai';

Flow(v0.35.0) carps:

/reusable/utilities/foo.spec.js:14
 14: import { expect } from 'chai';
              ^^^^^^ Named import from module `chai`. This module has no named export called `expect`.

I am leveraging your flow-typed/definitions/npm/chai_v3.5.x/flow_v0.24.0-/chai_v3.5.x.js.

Do I need to add something to that declaration to expose ‘expect’ or import ‘expect’ differently?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

12reactions
AndrewSouthpawcommented, May 15, 2017

I’m running into this issue as well, with the same flow-typed definition. We’re using Flow 0.46. Anyone else seeing it?

4reactions
flegallcommented, Jan 22, 2017

Hi, I’ve just hit the same bug today.

I’ve pushed a branch of a project that exposes it : https://github.com/flegall/monorepo-fullstack-starter/tree/flowtype_482

What’s strange is that only the expect function has this problem in my case. I’m using Jest with Chai Assertions. I’ve noticed that the behaviour doesn’t appear any more when removing the jest definition file (which exposes a global expect method).

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to assert in my tests that a Chai assertion will fail (Error vs ...
The reason is by doing import {AssertionError} from ... it is actually looking for an exported property of the package 'assertion-error', ...
Read more >
Expect / Should - Chai Assertion Library
Chai is a BDD / TDD assertion library for [node](http://nodejs.org) and the browser that can be delightfully paired with any javascript testing framework....
Read more >
chaijs/chai - Gitter
Hello , I register the chai module in my wdio.conf.js file require('chai/register-assert');. In my test file I write: assert.equal(...); assert.include(.
Read more >
chaijs/chai.js - chromium/src/third_party - Git at Google
the assertion `expect(numKittens).to.equal(7);`, the `object` flag will. * contain `numKittens` so that the ... expect(function () {}).to.not.throw();.
Read more >
Mocha - the fun, simple, flexible JavaScript test framework
chai - expect() , assert() and should -style assertions; better-assert - C-style self-documenting assert(); unexpected - “the extensible BDD assertion toolkit” ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found