Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

jest.setup.js 564 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  1. /* eslint-disable jest/require-top-level-describe */
  2. import { rm } from 'fs/promises';
  3. import nock from 'nock';
  4. import { TEST_CONFIG_DIR } from './.jest/setEnvVars';
  5. // Disable all real network requests
  6. nock.disableNetConnect();
  7. nock.enableNetConnect('127.0.0.1');
  8. nock.emitter.on('no match', (req) => {
  9. if (!req.host.includes('127.0.0.1') && !req.host.includes('localhost')) {
  10. console.error(`Unexpected HTTP request: ${req.method} ${req.href}`);
  11. }
  12. });
  13. afterAll(async () => {
  14. try {
  15. await rm(TEST_CONFIG_DIR, { recursive: true });
  16. } catch {}
  17. });
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...