make jest and typescript accept the node-fetch ESM edition

This commit is contained in:
Norbert de Langen 2023-06-08 09:57:17 +02:00
parent ebf5cb642e
commit 0e7dfa2637
No known key found for this signature in database
GPG Key ID: FD0E78AF9A837762
3 changed files with 11 additions and 4 deletions

View File

@ -28,21 +28,25 @@ const modulesToTransform = [
'decode-named-character-reference',
'estree',
'is-absolute-url',
'lit',
'lit-html',
'lit',
'mdast',
'micromark',
'nanoid',
'node-fetch',
'remark',
'rxjs',
'data-uri-to-buffer',
'fetch-blob',
'formdata-polyfill',
'slash',
'space-separated-tokens',
'stringify-entities',
'unified',
'unist',
'uuid',
'vfile',
'vfile-message',
'vfile',
'zwitch',
];

View File

@ -1,3 +1,5 @@
/// <reference types="node" />
import originalFetch from 'node-fetch';
import retry from 'fetch-retry';
import { nanoid } from 'nanoid';
@ -8,7 +10,7 @@ import { getSessionId } from './session-id';
const URL = process.env.STORYBOOK_TELEMETRY_URL || 'https://storybook.js.org/event-log';
const fetch = retry(originalFetch);
const fetch = retry(originalFetch as any);
let tasks: Promise<any>[] = [];

View File

@ -1,7 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"strict": true
"strict": true,
"types": ["node"]
},
"include": ["src/**/*"]
}