mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
ci(@nestjs) fix unit tests, falling linux build
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
"precommit": "lint-staged",
|
||||
"test": "nyc --require ts-node/register mocha packages/**/*.spec.ts --reporter spec",
|
||||
"integration-test": "mocha integration/**/*.spec.ts --reporter spec --require ts-node/register",
|
||||
"lint": "tslint -p tsconfig.json -c tslint.json \"packages/**/*.ts\"",
|
||||
"lint": "tslint -p tsconfig.json -c tslint.json \"packages/**/*.ts\" -e \"*.spec.ts\"",
|
||||
"format": "prettier **/**/*.ts --ignore-path ./.prettierignore --write && git status",
|
||||
"build": "gulp build && gulp move",
|
||||
"build:lib": "gulp build --dist bundle",
|
||||
@@ -146,7 +146,6 @@
|
||||
},
|
||||
"lint-staged": {
|
||||
"packages/**/*.{ts,json}": [
|
||||
"npm run lint",
|
||||
"npm run format",
|
||||
"git add"
|
||||
]
|
||||
|
||||
@@ -5,6 +5,7 @@ import { ModuleMetadata } from '../../interfaces/modules/module-metadata.interfa
|
||||
import { InvalidModuleConfigException } from './exceptions/invalid-module-config.exception';
|
||||
|
||||
const metadataKeys = [
|
||||
metadata.MODULES,
|
||||
metadata.IMPORTS,
|
||||
metadata.EXPORTS,
|
||||
metadata.COMPONENTS,
|
||||
@@ -49,13 +50,21 @@ export function Module(obj: ModuleMetadata): ClassDecorator {
|
||||
}
|
||||
|
||||
function overrideModuleMetadata(moduleMetadata: ModuleMetadata) {
|
||||
moduleMetadata.modules = moduleMetadata.imports
|
||||
? moduleMetadata.imports
|
||||
: moduleMetadata.modules;
|
||||
|
||||
moduleMetadata.components = moduleMetadata.providers
|
||||
? moduleMetadata.providers
|
||||
: moduleMetadata.components;
|
||||
}
|
||||
|
||||
function showDeprecatedWarnings(moduleMetadata: ModuleMetadata) {
|
||||
const modulesDeprecatedWarning =
|
||||
'The "modules" key in the @Module() decorator is deprecated and will be removed within next major release. Use the "imports" key instead.';
|
||||
const componentsDeprecatetWarning =
|
||||
'The "components" key in the @Module() decorator is deprecated and will be removed within next major release. Use the "providers" key instead.';
|
||||
|
||||
moduleMetadata.modules && deprecate(modulesDeprecatedWarning);
|
||||
moduleMetadata.components && deprecate(componentsDeprecatetWarning);
|
||||
}
|
||||
|
||||
@@ -9,5 +9,8 @@ export interface ModuleMetadata {
|
||||
controllers?: Type<any>[];
|
||||
providers?: Provider[];
|
||||
exports?: Array<DynamicModule | string | Provider | any[]>;
|
||||
/** @deprecated */
|
||||
modules?: Array<Type<any> | DynamicModule | any[]>;
|
||||
/** @deprecated */
|
||||
components?: Provider[];
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ describe('NestContainer', () => {
|
||||
describe('extractMetadata', () => {
|
||||
describe('when module is a dynamic module', () => {
|
||||
it('should return object with "type" and "dynamicMetadata" property', () => {
|
||||
const obj = { module: 'test', components: [] };
|
||||
const obj = { module: 'test', providers: [] };
|
||||
const { module, ...dynamicMetadata } = obj;
|
||||
expect(container.extractMetadata(obj as any)).to.be.deep.equal({
|
||||
type: module,
|
||||
|
||||
@@ -511,7 +511,7 @@ describe('Injector', () => {
|
||||
let module;
|
||||
beforeEach(() => {
|
||||
module = {
|
||||
components: [],
|
||||
providers: [],
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -21,15 +21,15 @@ describe('DependenciesScanner', () => {
|
||||
class TestRoute {}
|
||||
|
||||
@Module({
|
||||
components: [TestComponent],
|
||||
providers: [TestComponent],
|
||||
controllers: [TestRoute],
|
||||
exports: [TestComponent],
|
||||
})
|
||||
class AnotherTestModule {}
|
||||
|
||||
@Module({
|
||||
modules: [AnotherTestModule],
|
||||
components: [TestComponent],
|
||||
imports: [AnotherTestModule],
|
||||
providers: [TestComponent],
|
||||
controllers: [TestRoute],
|
||||
})
|
||||
class TestModule {}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
},
|
||||
"include": [
|
||||
"packages/**/*",
|
||||
"sample/**/*",
|
||||
"integration/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"ordered-imports": [
|
||||
false
|
||||
],
|
||||
"no-implicit-dependencies": false,
|
||||
"no-unnecessary-initializer": false,
|
||||
"unified-signatures": false,
|
||||
"max-line-length": [
|
||||
|
||||
Reference in New Issue
Block a user