• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

safe-global / safe-events-service / 19743058222

27 Nov 2025 04:44PM UTC coverage: 87.575% (-1.4%) from 89.0%
19743058222

push

github

Uxio0
Update README.md

Co-authored-by: Felipe Alvarado <6717781+falvaradorodriguez@users.noreply.github.com>

188 of 219 branches covered (85.84%)

Branch coverage included in aggregate %.

545 of 618 relevant lines covered (88.19%)

16.32 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

47.83
/src/modules/admin/adminjs.ts
1
import { Module } from '@nestjs/common';
6✔
2
import { Webhook } from '../webhook/repositories/webhook.entity';
6✔
3
import { AuthModule } from './auth/auth.module';
6✔
4
import { AuthService } from './auth/auth.service';
6✔
5

6
// Empty module placeholder for test environment
7
@Module({})
8
class AdminJsTestModule {}
6✔
9

10
async function buildAdminJsModule() {
11
  // Skip loading AdminJS in test environment to avoid rollup's CustomGC handle
12
  // which keeps Jest from exiting cleanly
13
  if (process.env.JEST_WORKER_ID !== undefined) {
6!
14
    console.log('Skipping AdminJS in test environment');
6✔
15
    return AdminJsTestModule;
6✔
16
  }
17

18
  // Nest.js does not support ESM modules
19
  // This workaround is better than modifying tsconfig.json module resolution as
20
  // it brings issues with another libraries
21
  // https://stackoverflow.com/a/75287028/724991
22

23
  const { AdminJS } = await (eval(`import('adminjs')`) as Promise<any>);
×
24
  const AdminJSTypeorm = await (eval(
×
25
    `import('@adminjs/typeorm')`,
26
  ) as Promise<any>);
27
  AdminJS.registerAdapter({
×
28
    Resource: AdminJSTypeorm.Resource,
29
    Database: AdminJSTypeorm.Database,
30
  });
31
  const { AdminModule } = await (eval(
×
32
    `import('@adminjs/nestjs')`,
33
  ) as Promise<any>);
34
  const basePath = (process.env.URL_BASE_PATH || '') + '/admin';
×
35
  return AdminModule.createAdminAsync({
×
36
    imports: [AuthModule],
37
    inject: [AuthService],
38
    useFactory: (authService: AuthService) => ({
×
39
      adminJsOptions: {
40
        rootPath: basePath,
41
        loginPath: basePath + '/login',
42
        logoutPath: basePath + '/logout',
43
        resources: [Webhook],
44
      },
45
      auth: {
46
        authenticate: (email: string, password: string) =>
47
          authService.authenticate(email, password),
×
48
        cookieName: 'adminjs',
49
        cookiePassword: 'secret',
50
      },
51
      sessionOptions: {
52
        resave: true,
53
        saveUninitialized: true,
54
        secret: 'secret',
55
      },
56
    }),
57
  });
58
}
59

60
export const AdminJsModule = buildAdminJsModule();
6✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc