Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
language: node_js

node_js:
- "15"
- "14"
- "12"
- "11"
- "10"
install:
- npm ci
- npm i

script:
- npm run lint:ci
Expand Down
27 changes: 27 additions & 0 deletions __tests__/ethers.module.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { NestFactory } from '@nestjs/core';
import { Module } from '@nestjs/common';
import { EthersModule } from '../src';
import { platforms } from './utils/platforms';
import { extraWait } from './utils/extraWait';

describe('Ethers Module Initialization', () => {
for (const PlatformAdapter of platforms) {
describe(PlatformAdapter.name, () => {
describe('forRoot', () => {
it('should compile without options', async () => {
@Module({
imports: [EthersModule.forRoot()],
})
class TestModule {}

const app = await NestFactory.create(
TestModule,
new PlatformAdapter(),
);
await app.init();
await extraWait(PlatformAdapter, app);
});
});
});
}
});
12 changes: 12 additions & 0 deletions __tests__/utils/extraWait.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Adapter } from './platforms';
import { INestApplication } from '@nestjs/common';
import { FastifyAdapter } from '@nestjs/platform-fastify';

export async function extraWait(adapter: Adapter, app: INestApplication) {
if (adapter === FastifyAdapter) {
const instance = app.getHttpAdapter().getInstance();
if (instance && typeof instance.ready === 'function') {
await instance.ready();
}
}
}
8 changes: 8 additions & 0 deletions __tests__/utils/platforms.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { AbstractHttpAdapter } from '@nestjs/core';
import { Type } from '@nestjs/common';
import { FastifyAdapter } from '@nestjs/platform-fastify';
import { ExpressAdapter } from '@nestjs/platform-express';

export type Adapter = Type<AbstractHttpAdapter<any, any, any>>;

export const platforms: Adapter[] = [ExpressAdapter, FastifyAdapter];
Loading