You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 8, 2020. It is now read-only.
Currently Flow libdef definition shipped with ava 1.0.0-beta.3 do not support using ava as a Commonjs module. I realize that ava recommend using babel but the project source code do not use babel. I know that when running ava babel is implicitly used but i don't think using different EcmaScript flavours is correct.
Test Source
/** Test case for the package entry point */// @flow"use strict";consttest=require("ava");constmlTrainerApi=require(".");test("expose the Application symbol",t=>{t.truthy(mlTrainerApi.Application);});
Error Message & Stack Trace
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ src/index.test.js:10:1
Cannot call test because a callable signature is missing in module ava [1].
[1] 7│ const test = require("ava");
8│ const mlTrainerApi = require(".");
9│
10│ test("expose the Application symbol", t => {
11│ t.truthy(mlTrainerApi.Application);
12│ });
13│
Found 1 error
Config
None
Command-Line Arguments
Copy your npm build scripts or the ava command used:
npx flow check
Environment
Node.js v8.10.0
linux 4.15.0-12-generic
ava version 1.0.0-beta.3
npm version 5.6.0
The text was updated successfully, but these errors were encountered:
If I recall correctly, Flow doesn't let you define a module that can be used both as ESM and CommonJS. I did manage to get this to work in TypeScript.
Perhaps there is a way to import the TestInterface and cast the const test to that? I have to admit that I don't know much about Flow — writing the current definition was already quite tricky. If somebody else has a solution please let us know! 😄
novemberborn
changed the title
Flow libdef do not support using AVA as Commonjs module
Flow libdef only works with ESM, not CommonJS
Apr 1, 2018
Description
Currently Flow libdef definition shipped with ava 1.0.0-beta.3 do not support using ava as a Commonjs module. I realize that ava recommend using babel but the project source code do not use babel. I know that when running ava babel is implicitly used but i don't think using different EcmaScript flavours is correct.
Test Source
Error Message & Stack Trace
Config
None
Command-Line Arguments
Copy your npm build scripts or the
ava
command used:Environment
The text was updated successfully, but these errors were encountered: