Skip to content

Commit

Permalink
Merge pull request #7 from rvitaliy/master
Browse files Browse the repository at this point in the history
update vendors
  • Loading branch information
pashak09 authored May 10, 2024
2 parents 34c0b0d + 4f24fc9 commit 6195264
Show file tree
Hide file tree
Showing 14 changed files with 1,055 additions and 994 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
build:
strategy:
matrix:
node-version: [16.x, 18.x, 19.x]
node-version: [18.x, 20.x, 22.x]
platform:
- os: ubuntu-latest
shell: bash
Expand All @@ -24,15 +24,15 @@ jobs:

steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Nodejs ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.yarn/cache
key: ${{ runner.os }}-yarn-${{ hashFiles('${{ github.workspace }}/yarn.lock') }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Nodejs
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: '20.x'

- name: Install yarn packages
run: yarn install --immutable
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
environment: publish
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Nodejs
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'

- run: yarn install --immutable
Expand Down
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fixturio",
"version": "1.0.2",
"version": "1.0.3",
"description": "Fixtures",
"keywords": [
"Persistence",
Expand All @@ -24,31 +24,31 @@
"url": "https://github.com/pashak09/fixturio"
},
"dependencies": {
"glob": "^9.3.5"
"glob": "^10.3.14"
},
"devDependencies": {
"@types/glob": "^8.1.0",
"@types/jest": "^29.5.2",
"@types/node": "^18.16.1",
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"dts-bundle-generator": "^8.0.1",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.11",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"dts-bundle-generator": "^9.5.1",
"eslint": "^8.44.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.2",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.5.0",
"prettier": "^2.8.8",
"rimraf": "^5.0.1",
"ts-jest": "^29.1.1",
"tsc-alias": "^1.8.6",
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^28.5.0",
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.7.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"ts-jest": "^29.1.2",
"tsc-alias": "^1.8.9",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.1.6"
"typescript": "^5.4.5"
},
"engines": {
"node": ">=16.17.0"
"node": ">=18.12.1"
},
"files": [
"**/*.js",
Expand Down
8 changes: 4 additions & 4 deletions src/FixtureAsserter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ import { FixtureConstructor, InjectDependency } from '@app/index';
export class FixtureAsserter {
assertInjectDependencies(
fixture: FixtureConstructor,
injectDependencies: unknown
injectDependencies: unknown,
): asserts injectDependencies is readonly InjectDependency[] {
this.assertArray(injectDependencies, `Dependencies for ${fixture.name} must be an array`);
this.assertArrayItem(injectDependencies, (injectDependency: unknown): void => {
if (typeof injectDependency !== 'function' && typeof injectDependency !== 'string') {
throw new Error(
`Unknown fixture inject dependency ${injectDependency} for ${fixture.name}`
`Unknown fixture inject dependency ${injectDependency} for ${fixture.name}`,
);
}
});
}

assertFixtureDependencies(
fixture: FixtureConstructor,
fixtureDependencies: unknown
fixtureDependencies: unknown,
): asserts fixtureDependencies is readonly FixtureConstructor[] {
this.assertArray(fixtureDependencies, `Dependencies for ${fixture.name} must be an array`);
this.assertArrayItem(fixtureDependencies, (fixtureDependency: unknown): void => {
Expand All @@ -45,7 +45,7 @@ export class FixtureAsserter {

private assertArrayItem<T>(
items: readonly unknown[],
fn: (...args: readonly unknown[]) => void
fn: (...args: readonly unknown[]) => void,
): asserts items is T[] {
items.forEach(fn);
}
Expand Down
4 changes: 2 additions & 2 deletions src/FixtureContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class FixtureContainer {

constructor(
serviceContainer?: ServiceContainerInterface | undefined,
importer?: FixtureImporterInterface | undefined
importer?: FixtureImporterInterface | undefined,
) {
this.importer = importer ?? new FixtureImporter();
this.manager = new FixtureManager(serviceContainer);
Expand All @@ -25,7 +25,7 @@ export class FixtureContainer {
async installFixtures(options: FixtureLoadFilters): Promise<LoadAllResult> {
return this.manager.loadAll(
fixtureSifter(await this.importer.import(options.rootDir, options.filePatterns)),
options.tags ?? []
options.tags ?? [],
);
}
}
6 changes: 3 additions & 3 deletions src/FixtureImporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export class FixtureImporter implements FixtureImporterInterface {
const files = await this.matchGlob(rootDir, filePatterns);
const imported = await Promise.all(
files.map(
async (path: string): Promise<readonly string[]> => Object.values(await import(path))
)
async (path: string): Promise<readonly string[]> => Object.values(await import(path)),
),
);

return imported.flat();
Expand All @@ -20,7 +20,7 @@ export class FixtureImporter implements FixtureImporterInterface {
filePatterns.map((pattern: string) => resolve(rootDir, pattern)),
{
windowsPathsNoEscape: true,
}
},
);
}
}
6 changes: 3 additions & 3 deletions src/FixtureManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class FixtureManager {

async loadAll(
constructors: readonly FixtureConstructor[],
tags: readonly string[]
tags: readonly string[],
): Promise<LoadAllResult> {
const fixtureSetupBucket = new FixtureSetupBucket();
const fixtureBucket = new FixtureBucket(fixtureSetupBucket);
Expand Down Expand Up @@ -71,15 +71,15 @@ export class FixtureManager {
.map((injectDependency: InjectDependency) => {
if (this.serviceContainer === undefined) {
throw new Error(
`Could not inject ${injectDependency}. You did you provide a serviceContainer ?`
`Could not inject ${injectDependency}. You did you provide a serviceContainer ?`,
);
}

const foundInjectDependency = this.serviceContainer.getService(injectDependency);

if (foundInjectDependency === undefined) {
throw new Error(
`Could not find ${injectDependency}. Did you forget to add ${injectDependency} to your serviceContainer ?`
`Could not find ${injectDependency}. Did you forget to add ${injectDependency} to your serviceContainer ?`,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/FixtureOrderResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class FixtureOrderResolver {
}

private buildDependencyNode(
constructors: readonly FixtureConstructor[]
constructors: readonly FixtureConstructor[],
): readonly DependencyNode[] {
return constructors.map((item: FixtureConstructor): BuildDependencyNode => {
return {
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/FixtureAsserter.Spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('FixtureAsserter', () => {

it('does not throw an error when injectDependencies is a valid array', () => {
expect(() =>
fixtureAsserter.assertInjectDependencies(fixture, ['Test', class {}])
fixtureAsserter.assertInjectDependencies(fixture, ['Test', class {}]),
).not.toThrow();
});
});
Expand Down Expand Up @@ -102,7 +102,7 @@ describe('FixtureAsserter', () => {
];

expect(() =>
fixtureAsserter.assertFixtureDependencies(fixture, fixtureDependencies)
fixtureAsserter.assertFixtureDependencies(fixture, fixtureDependencies),
).not.toThrow();
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/FixtureImporter.Spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('FixtureImporter', () => {
const instance = new FixtureImporter();

expect(await instance.import(rootFolder, ['src/__tests__/fixtures/Fixture1.ts'])).toMatchObject(
[Fixture1]
[Fixture1],
);
});

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/FixtureOrderResolver.Spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('FixtureOrderResolver', () => {
}

return [];
}
},
);

const fixtureOrderResolver = new FixtureOrderResolver(objectDirectorMock);
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface DependencyInjectable {

export interface ServiceContainerInterface {
getService<TInput = unknown, TResult = TInput>(
typeOrToken: InjectDependency<TInput> | string
typeOrToken: InjectDependency<TInput> | string,
): TResult;
}

Expand Down
Loading

0 comments on commit 6195264

Please sign in to comment.