mirror of
https://github.com/logto-io/logto.git
synced 2025-01-06 20:40:08 -05:00
chore(test): add dotenv (#1681)
* chore(test): integration test update add dotenv * chore(core): update pnpm lock update pnpm lock
This commit is contained in:
parent
875a828831
commit
61177ca2a1
4 changed files with 7 additions and 2 deletions
|
@ -41,7 +41,7 @@ type UserInfo = {
|
||||||
|
|
||||||
const getUserInfoFromRequest = async (request: Request): Promise<UserInfo> => {
|
const getUserInfoFromRequest = async (request: Request): Promise<UserInfo> => {
|
||||||
const { isProduction, isIntegrationTest, developmentUserId, oidc } = envSet.values;
|
const { isProduction, isIntegrationTest, developmentUserId, oidc } = envSet.values;
|
||||||
const userId = developmentUserId || request.headers['development-user-id']?.toString();
|
const userId = request.headers['development-user-id']?.toString() ?? developmentUserId;
|
||||||
|
|
||||||
if ((!isProduction || isIntegrationTest) && userId) {
|
if ((!isProduction || isIntegrationTest) && userId) {
|
||||||
return { sub: userId, roleNames: [UserRole.Admin] };
|
return { sub: userId, roleNames: [UserRole.Admin] };
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
// Need to disable following rules to mock text-decode/text-encoder and crypto for jsdom
|
// Need to disable following rules to mock text-decode/text-encoder and crypto for jsdom
|
||||||
// https://github.com/jsdom/jsdom/issues/1612
|
// https://github.com/jsdom/jsdom/issues/1612
|
||||||
import { Crypto } from '@peculiar/webcrypto';
|
import { Crypto } from '@peculiar/webcrypto';
|
||||||
|
import dotenv from 'dotenv';
|
||||||
import { TextDecoder, TextEncoder } from 'text-encoder';
|
import { TextDecoder, TextEncoder } from 'text-encoder';
|
||||||
|
|
||||||
// eslint-disable-next-line unicorn/prefer-module
|
// eslint-disable-next-line unicorn/prefer-module
|
||||||
const fetch = require('node-fetch');
|
const fetch = require('node-fetch');
|
||||||
|
|
||||||
|
dotenv.config();
|
||||||
|
|
||||||
/* eslint-disable @silverhand/fp/no-mutation */
|
/* eslint-disable @silverhand/fp/no-mutation */
|
||||||
global.crypto = new Crypto();
|
global.crypto = new Crypto();
|
||||||
global.fetch = fetch;
|
global.fetch = fetch;
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
"@silverhand/ts-config": "^0.17.0",
|
"@silverhand/ts-config": "^0.17.0",
|
||||||
"@types/jest": "^27.4.1",
|
"@types/jest": "^27.4.1",
|
||||||
"@types/node": "^16.0.0",
|
"@types/node": "^16.0.0",
|
||||||
|
"dotenv": "^16.0.0",
|
||||||
"eslint": "^8.19.0",
|
"eslint": "^8.19.0",
|
||||||
"got": "^11.8.2",
|
"got": "^11.8.2",
|
||||||
"jest": "^27.5.1",
|
"jest": "^27.5.1",
|
||||||
|
|
|
@ -1142,6 +1142,7 @@ importers:
|
||||||
'@silverhand/ts-config': ^0.17.0
|
'@silverhand/ts-config': ^0.17.0
|
||||||
'@types/jest': ^27.4.1
|
'@types/jest': ^27.4.1
|
||||||
'@types/node': ^16.0.0
|
'@types/node': ^16.0.0
|
||||||
|
dotenv: ^16.0.0
|
||||||
eslint: ^8.19.0
|
eslint: ^8.19.0
|
||||||
got: ^11.8.2
|
got: ^11.8.2
|
||||||
jest: ^27.5.1
|
jest: ^27.5.1
|
||||||
|
@ -1163,6 +1164,7 @@ importers:
|
||||||
'@silverhand/ts-config': 0.17.0_typescript@4.6.4
|
'@silverhand/ts-config': 0.17.0_typescript@4.6.4
|
||||||
'@types/jest': 27.4.1
|
'@types/jest': 27.4.1
|
||||||
'@types/node': 16.11.12
|
'@types/node': 16.11.12
|
||||||
|
dotenv: 16.0.0
|
||||||
eslint: 8.19.0
|
eslint: 8.19.0
|
||||||
got: 11.8.3
|
got: 11.8.3
|
||||||
jest: 27.5.1_ts-node@10.9.1
|
jest: 27.5.1_ts-node@10.9.1
|
||||||
|
@ -7594,7 +7596,6 @@ packages:
|
||||||
/dotenv/16.0.0:
|
/dotenv/16.0.0:
|
||||||
resolution: {integrity: sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==}
|
resolution: {integrity: sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
dev: false
|
|
||||||
|
|
||||||
/dotenv/7.0.0:
|
/dotenv/7.0.0:
|
||||||
resolution: {integrity: sha512-M3NhsLbV1i6HuGzBUH8vXrtxOk+tWmzWKDMbAVSUp3Zsjm7ywFeuwrUXhmhQyRK1q5B5GGy7hcXPbj3bnfZg2g==}
|
resolution: {integrity: sha512-M3NhsLbV1i6HuGzBUH8vXrtxOk+tWmzWKDMbAVSUp3Zsjm7ywFeuwrUXhmhQyRK1q5B5GGy7hcXPbj3bnfZg2g==}
|
||||||
|
|
Loading…
Reference in a new issue