mirror of
https://github.com/logto-io/logto.git
synced 2024-12-23 20:33:16 -05:00
34 lines
777 B
TypeScript
34 lines
777 B
TypeScript
/**
|
|
* Setup environment variables for unit test
|
|
*/
|
|
|
|
import envSet from '#src/env-set/index.js';
|
|
|
|
jest.mock('#src/lib/logto-config.js');
|
|
jest.mock('#src/env-set/check-alteration-state.js');
|
|
|
|
// eslint-disable-next-line unicorn/prefer-top-level-await
|
|
(async () => {
|
|
await envSet.load();
|
|
})();
|
|
|
|
/**
|
|
* Mocking `import.meta.url` and `got` here since they inevitably needs native ESM, but jest is sticking with CJS.
|
|
* Will figure out a way to run tests in native ESM mode.
|
|
*/
|
|
|
|
jest.mock('./src/connectors/meta-url.js', () => ({
|
|
metaUrl: 'file:///',
|
|
}));
|
|
|
|
jest.mock('../cli/lib/meta-url.js', () => ({
|
|
metaUrl: 'file:///',
|
|
}));
|
|
|
|
jest.mock('../cli/lib/commands/database/alteration/meta-url.js', () => ({
|
|
metaUrl: 'file:///',
|
|
}));
|
|
|
|
jest.mock('got', () => ({
|
|
got: {},
|
|
}));
|