import { OpenAPIObject } from "openapi3-ts/src/model/openapi31" doesn't work with mocha and ESM
BryanHunt opened this issue · comments
If you are building an ESM module and you use the import format:
import { OpenAPIObject } from "openapi3-ts/src/model/openapi31";
and use mocha with:
{
"loader": "ts-node/esm"
}
unit tests will fail.
The "fix" is to use the import format:
import { oas31 } from "openapi3-ts";
Since the second format works, I don't expect any code change here. I'm mainly creating this issue in case others run into the same problem.
It might be good to update the readme to note this.
Thanks, I will do.
Hi there, import { OpenAPIBuilder } from "openapi3-ts/src/dsl/openapi-builder31";
with ts-node does not work for me.
impot * as yaml from 'yaml';
SyntaxError: Cannot use import statement outside a module
As a workaround, import { OpenAPIBuilder } from "openapi3-ts/dist/cjs/dsl/openapi-builder31";
worked, but it looks not elegant.