Skip to content

Commit

Permalink
feat(*): don't use esModuleInterop
Browse files Browse the repository at this point in the history
Also enable lib checks

BREAKING CHANGE: esModuleInertop is no longer used. Depending on how this module
is imported, it could be a breaking change

Signed-off-by: Will Soto <willsoto@users.noreply.github.com>
  • Loading branch information
willsoto committed Mar 5, 2021
1 parent 8aa7635 commit 728df76
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 21 deletions.
2 changes: 1 addition & 1 deletion ad-hocs/mocha/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RootHookObject } from "mocha";
import sinon from "sinon";
import * as sinon from "sinon";

export const mochaHooks: () => RootHookObject = () => {
return {
Expand Down
6 changes: 3 additions & 3 deletions ad-hocs/mocha/plugins.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import chai from "chai";
import chaiAsPromised from "chai-as-promised";
import sinonChai from "sinon-chai";
import * as chai from "chai";
import * as chaiAsPromised from "chai-as-promised";
import * as sinonChai from "sinon-chai";

chai.use(chaiAsPromised);
chai.use(sinonChai);
2 changes: 1 addition & 1 deletion src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ValueProvider,
} from "@nestjs/common";
import { ModuleRef } from "@nestjs/core";
import Knex from "knex";
import * as Knex from "knex";
import { Model } from "objection";
import {
KNEX_CONNECTION,
Expand Down
3 changes: 1 addition & 2 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Type } from "@nestjs/common";
import { ModuleMetadata } from "@nestjs/common/interfaces";
import Knex from "knex";
import * as Knex from "knex";
import { Model } from "objection";

export interface ObjectionModuleOptions {
/**
* The name for this connection if more than one database connection is required.
Expand Down
6 changes: 3 additions & 3 deletions test/core.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Injectable } from "@nestjs/common";
import { Test, TestingModule } from "@nestjs/testing";
import { expect } from "chai";
import Knex, { Config } from "knex";
import * as Knex from "knex";
import { Model } from "objection";
import sinon from "sinon";
import * as sinon from "sinon";
import {
KNEX_CONNECTION,
OBJECTION_BASE_MODEL,
Expand All @@ -18,7 +18,7 @@ import {
describe("ObjectionCoreModule", function () {
let testingModule: TestingModule;

const config: Config = {
const config: Knex.Config = {
client: "sqlite3",
useNullAsDefault: true,
connection: {
Expand Down
3 changes: 1 addition & 2 deletions test/fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Inject, Injectable, Module } from "@nestjs/common";
import Knex from "knex";
import * as Knex from "knex";
import { Model } from "objection";
import { Connection, KNEX_CONNECTION, ObjectionModule } from "../src";

@Injectable()
export class ConnectionCheck {
constructor(@Inject(KNEX_CONNECTION) public connection: Connection) {}
Expand Down
3 changes: 1 addition & 2 deletions test/integration.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* eslint-disable new-cap */
import { Test, TestingModule } from "@nestjs/testing";
import { expect } from "chai";
import Knex from "knex";
import * as Knex from "knex";
import { KNEX_CONNECTION } from "../src";
import { ConnectionCheck, ConnectionModule } from "./fixtures";

describe("Integration", function () {
let connectionCheck: ConnectionCheck;
let connection: Knex;
Expand Down
4 changes: 2 additions & 2 deletions test/module.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Test, TestingModule } from "@nestjs/testing";
import { expect } from "chai";
import { default as Knex, default as knex } from "knex";
import * as Knex from "knex";
import { Model } from "objection";
import { KNEX_CONNECTION } from "../src/constants";
import { ObjectionModule } from "../src/module";
import { User } from "./fixtures";

describe("ObjectionModule", function () {
let testingModule: TestingModule;
const config: knex.Config = {
const config: Knex.Config = {
client: "sqlite3",
useNullAsDefault: true,
connection: {
Expand Down
3 changes: 1 addition & 2 deletions test/multiple-connections.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Test, TestingModule } from "@nestjs/testing";
import { expect } from "chai";
import Knex from "knex";
import * as Knex from "knex";
import { Model } from "objection";
import { ObjectionCoreModule } from "../src/core";

describe("when registering multiple connections", function () {
let testingModule: TestingModule;
let connection1: Knex;
Expand Down
3 changes: 0 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist",
"esModuleInterop": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"declaration": true,
Expand All @@ -11,11 +10,9 @@
"lib": ["es2018"],
"module": "commonjs",
"removeComments": false,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "es2018"
},
"include": ["src/**/*.ts", "test/**/*.ts"],
"exclude": ["node_modules", "dist"]
}

0 comments on commit 728df76

Please sign in to comment.