Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): upgrade and package.json cleanup #118

Merged
merged 8 commits into from Oct 14, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 8 additions & 25 deletions .eslintrc
@@ -1,45 +1,25 @@
{
"parser": "@typescript-eslint/parser",
"plugins": [
"prettier"
],
"plugins": ["prettier"],
"parserOptions": {
"ecmaVersion": 8
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [
".ts"
]
"@typescript-eslint/parser": [".ts"]
},
"import/resolver": {
"node": {
"extensions": [
".ts"
]
"extensions": [".ts"]
},
"typescript": {
"alwaysTryTypes": true
}
},
"import/extensions": 0
},
"extends": [
"plugin:@typescript-eslint/recommended",
"prettier"
],
"extends": ["plugin:@typescript-eslint/recommended", "prettier"],
"rules": {
"prettier/prettier": [
2,
{
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 100,
"tabWidth": 2,
"semi": true,
"endOfLine": "auto"
}
],
"no-useless-constructor": "off",
"react/forbid-prop-types": 0,
"no-unused-expressions": 0,
Expand All @@ -60,7 +40,10 @@
"camelcase": "off",
"consistent-return": 0,
"import/prefer-default-export": 0,
"lines-between-class-members": "off"
"lines-between-class-members": "off",

// TODO: consider turning this rule on
"@typescript-eslint/no-unsafe-declaration-merging": "off"
},
"env": {
"jest": true
Expand Down
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Expand Up @@ -5,7 +5,7 @@

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
- package-ecosystem: 'npm' # See documentation for possible values
directory: '/' # Location of package manifests
schedule:
interval: "daily"
interval: 'daily'
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [16.x, 18.x, 20.x]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
8 changes: 8 additions & 0 deletions .prettierrc
@@ -0,0 +1,8 @@
{
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 100,
"tabWidth": 2,
"semi": true,
"endOfLine": "auto"
}
22 changes: 11 additions & 11 deletions CODE_OF_CONDUCT.md
Expand Up @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
- Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities
Expand Down Expand Up @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
Expand Down
9 changes: 4 additions & 5 deletions README.md
@@ -1,13 +1,12 @@
[![npm version](https://img.shields.io/npm/v/@automock/jest/latest?label=%40automock%2Fjest)](https://npmjs.org/package/@automock/jest "View this project on npm")
[![npm downloads](https://img.shields.io/npm/dm/@automock/jest.svg?label=%40automock%2Fjest)](https://npmjs.org/package/@automock/jest "View this project on npm")
[![npm version](https://img.shields.io/npm/v/@automock/sinon/latest?label=%40automock%2Fsinon)](https://npmjs.org/package/@automock/sinon "View this project on npm")
[![npm downloads](https://img.shields.io/npm/dm/@automock/sinon.svg?label=%40automock%2Fsinon)](https://npmjs.org/package/@automock/sinon "View this project on npm")
[![npm version](https://img.shields.io/npm/v/@automock/jest/latest?label=%40automock%2Fjest)](https://npmjs.org/package/@automock/jest 'View this project on npm')
[![npm downloads](https://img.shields.io/npm/dm/@automock/jest.svg?label=%40automock%2Fjest)](https://npmjs.org/package/@automock/jest 'View this project on npm')
[![npm version](https://img.shields.io/npm/v/@automock/sinon/latest?label=%40automock%2Fsinon)](https://npmjs.org/package/@automock/sinon 'View this project on npm')
[![npm downloads](https://img.shields.io/npm/dm/@automock/sinon.svg?label=%40automock%2Fsinon)](https://npmjs.org/package/@automock/sinon 'View this project on npm')

[![Codecov Coverage](https://img.shields.io/codecov/c/github/automock/automock/master.svg?style=flat-square)](https://codecov.io/gh/automock/automock)
[![ci](https://github.com/omermorad/jest-unit/actions/workflows/set-coverage.yml/badge.svg?branch=master)](https://github.com/automock/automock/actions)
[![e2e](https://github.com/omermorad/jest-unit/actions/workflows/e2e.yml/badge.svg?branch=master)](https://github.com/automock/automock/actions)


<p align="center">
<img width="200" src="https://raw.githubusercontent.com/omermorad/automock/master/logo.png" alt="Logo" />
</p>
Expand Down
7 changes: 3 additions & 4 deletions docs/automock.md
Expand Up @@ -110,7 +110,7 @@ provide default values or behavior for the methods of the mocked dependency.
### `.mock<TDependency>(token: string): MockOverride<TDependency, TClass>`

The `.mock(token)` method is used to declare a dependency to be mocked using a token string. It takes the `token`
parameter, which represents the token string representing the dependency to be mocked.
parameter, which represents the token string representing the dependency to be mocked.

When using `.mock()` method with a token, the type of the dependency is not known at compile time. To specify the type,
use the generic argument like .mock<SomeType>('MY_TOKEN'). This provides better type safety and ensures that the mocked
Expand All @@ -129,7 +129,6 @@ const { unit, unitRef } = TestBed.create

> :bulb: The `using()` method allows you to provide default values or behavior for the methods of the mocked dependency, read more in the `MockOverride` API Reference


### `.compile(): UnitTestBed<TClass>`

The `.compile()` method finalizes `TestBed` setup and returns an object that contains the instance of the class under
Expand Down Expand Up @@ -245,7 +244,7 @@ under the `models.animal` namespace:
```typescript
export class ClassWithModels {
public constructor(private models: PrismaService) {}

public async findUsers(): Promise<User[]> {
return this.models.user.find();
}
Expand Down Expand Up @@ -294,7 +293,7 @@ import { TestBed } from '@automock/core';
class UserService {
public constructor(
@Inject('DATABASE_1') private readonly database1: Database,
@Inject('DATABASE_2') private readonly database2: Database,
@Inject('DATABASE_2') private readonly database2: Database
) {}

public async getUsers() {
Expand Down
2 changes: 1 addition & 1 deletion e2e/jest/tsconfig.json
Expand Up @@ -5,4 +5,4 @@
"experimentalDecorators": true,
"allowJs": true
}
}
}
2 changes: 1 addition & 1 deletion e2e/sinon/tsconfig.json
Expand Up @@ -5,4 +5,4 @@
"experimentalDecorators": true,
"allowJs": true
}
}
}
12 changes: 6 additions & 6 deletions jest.config.ts
Expand Up @@ -8,7 +8,12 @@ export default async (): Promise<Config.InitialOptions> => {
moduleFileExtensions: ['js', 'json', 'ts'],
testRegex: '.(spec|test).ts$',
transform: {
'^.+\\.(t|j)s$': 'ts-jest',
'^.+\\.(t|j)s$': [
'ts-jest',
{
isolatedModules: true,
},
],
},
coveragePathIgnorePatterns: ['/node_modules/', 'spec-assets.ts', 'testbed-factory.ts'],
testPathIgnorePatterns: ['/node_modules/'],
Expand All @@ -17,11 +22,6 @@ export default async (): Promise<Config.InitialOptions> => {
testEnvironment: 'node',
reporters: ['default', 'jest-junit'],
testResultsProcessor: 'jest-junit',
globals: {
'ts-jest': {
isolatedModules: true,
},
},
projects: [
'<rootDir>/packages/core',
'<rootDir>/packages/adapters/nestjs',
Expand Down
24 changes: 5 additions & 19 deletions lerna.json
Expand Up @@ -3,31 +3,17 @@
"command": {
"publish": {
"registry": "https://registry.npmjs.org/",
"allowBranch": [
"master",
"next"
],
"allowBranch": ["master", "next"],
"message": "chore(*): release packages [skip ci]",
"conventionalCommits": true
},
"version": {
"allowBranch": [
"master",
"next"
],
"allowBranch": ["master", "next"],
"message": "chore(*): version packages [skip ci]",
"conventionalCommits": true
}
},
"workspaces": [
"packages/*",
"packages/adapters/*",
"packages/testbeds/*"
],
"workspaces": ["packages/*", "packages/adapters/*", "packages/testbeds/*"],
"npmClient": "yarn",
"packages": [
"packages/*",
"packages/adapters/*",
"packages/testbeds/*"
]
}
"packages": ["packages/*", "packages/adapters/*", "packages/testbeds/*"]
}
52 changes: 18 additions & 34 deletions package.json
Expand Up @@ -28,47 +28,31 @@
"test": "yarn jest",
"lint": "yarn lerna run lint --parallel"
},
"dependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@manypkg/cli": "^0.20.0",
"@types/jest": "^27.5.2",
"@types/lodash.clonedeep": "^4.5.6",
"@types/node": "^16.18.0",
"@typescript-eslint/eslint-plugin": "^5.3.1",
"@typescript-eslint/parser": "^5.3.1",
"eslint": "7.14.0",
"eslint-config-prettier": "^7.2.0",
"eslint-import-resolver-typescript": "^2.5.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-jest": "^25.2.4",
"eslint-plugin-prettier": "^3.4.1",
"husky": "^7.0.4",
"jest": "^27.5.1",
"jest-junit": "^15.0.0",
"lerna": "^7.0.0",
"lint-staged": "^11.2.6",
"lodash.clonedeep": "^4.5.0",
"prettier": "^2.4.1",
"prettier-eslint": "^13.0.0",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.0",
"ts-jest": "^27.1.5",
"devDependencies": {
"@types/jest": "^29.5.5",
"@types/node": "^20.8.5",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"lerna": "^7.3.1",
"prettier": "^3.0.3",
"rimraf": "^5.0.5",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"tsconfig-paths": "^3.11.0",
"tslint-config-airbnb": "^5.11.2",
"typescript": "^4.9.5"
"typescript": "^5.2.2"
},
"engines": {
"node": "^16.10.0 || ^18.12.0 || >=20.0.0"
},
"workspaces": [
"packages/*",
"packages/adapters/*",
"packages/testbeds/*"
],
"lint-staged": {
"*.ts": [
"eslint --ext .ts --fix"
]
},
"jest-junit": {
"outputDirectory": "test-reports",
"ancestorSeparator": " › ",
Expand Down
23 changes: 4 additions & 19 deletions packages/adapters/nestjs/CHANGELOG.md
Expand Up @@ -5,42 +5,27 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

# [1.4.0](https://github.com/omermorad/automock/compare/@automock/adapters.nestjs@1.3.1...@automock/adapters.nestjs@1.4.0) (2023-08-04)


### Features

* **adapters.nestjs:** support undefined dependency reflection ([a9ccaa6](https://github.com/omermorad/automock/commit/a9ccaa646289320d631b3f783ff9d51639b7dc1b))




- **adapters.nestjs:** support undefined dependency reflection ([a9ccaa6](https://github.com/omermorad/automock/commit/a9ccaa646289320d631b3f783ff9d51639b7dc1b))

## [1.3.1](https://github.com/omermorad/automock/compare/@automock/adapters.nestjs@1.3.0...@automock/adapters.nestjs@1.3.1) (2023-07-30)


### Bug Fixes

* **adapters.nestjs:** fix broken reflection when initiate class ([#80](https://github.com/omermorad/automock/issues/80)) ([5bb215a](https://github.com/omermorad/automock/commit/5bb215ad169a49a81a37cb6203975572795bdc25))




- **adapters.nestjs:** fix broken reflection when initiate class ([#80](https://github.com/omermorad/automock/issues/80)) ([5bb215a](https://github.com/omermorad/automock/commit/5bb215ad169a49a81a37cb6203975572795bdc25))

# [1.3.0](https://github.com/omermorad/automock/compare/@automock/adapters.nestjs@1.2.1...@automock/adapters.nestjs@1.3.0) (2023-07-29)


### Features

* **core,adapters.nestjs,common:** support property injection strategy ([#75](https://github.com/omermorad/automock/issues/75)) ([ce4c08d](https://github.com/omermorad/automock/commit/ce4c08dde68d63f95b766fa0b942d7794069d0bf))




- **core,adapters.nestjs,common:** support property injection strategy ([#75](https://github.com/omermorad/automock/issues/75)) ([ce4c08d](https://github.com/omermorad/automock/commit/ce4c08dde68d63f95b766fa0b942d7794069d0bf))

# 1.2.1 (2023-07-01)

### Code Refactoring

* **adapters.nestjs**: tuples instead of map when collecting dependencies ([8c5c6cbe](https://github.com/omermorad/automock/commit/8c5c6cbee97790add30570b79684481780d25bea))
- **adapters.nestjs**: tuples instead of map when collecting dependencies ([8c5c6cbe](https://github.com/omermorad/automock/commit/8c5c6cbee97790add30570b79684481780d25bea))

# 1.2.0 (2023-06-10)

Expand Down
2 changes: 1 addition & 1 deletion packages/adapters/nestjs/index.ts
@@ -1,3 +1,3 @@
import DependenciesReflector from './src';

export = DependenciesReflector
export = DependenciesReflector;
2 changes: 1 addition & 1 deletion packages/adapters/nestjs/jest.config.ts
Expand Up @@ -6,7 +6,7 @@ export default async (): Promise<Config.InitialOptions> => {

return {
...baseConfig,
name: 'adapters.nestjs',
id: 'adapters.nestjs',
displayName: 'adapters.nestjs',
collectCoverageFrom: ['src/**/*.ts', '__test__/**/*.ts'],
coveragePathIgnorePatterns: ['index.ts', '__test__/integration.assets.ts'],
Expand Down