Skip to content

Commit

Permalink
chore(tests): update test environment
Browse files Browse the repository at this point in the history
- bump vite from 4.3.9 to 4.4.4
- bump vitest from 0.32.2 to 0.33.0
- drop @vitest/ui and serve
- reorganize fixtures
- replace @vitest/coverage-c8 with @vitest/coverage-v8
- vitest-dev/vitest#3339

Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
  • Loading branch information
unicornware committed Jul 18, 2023
1 parent 72a9672 commit d2ddb0d
Show file tree
Hide file tree
Showing 91 changed files with 522 additions and 1,030 deletions.
3 changes: 2 additions & 1 deletion __fixtures__/float.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* @module fixtures/FLOAT
*/

import type { Float } from '#src/types'
import INT from './integer'

export default INT / 100
export default (INT / 100) as Float
4 changes: 3 additions & 1 deletion __fixtures__/integer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
* @module fixtures/INTEGER
*/

export default 13
import type { Integer } from '#src/types'

export default 13 as Integer
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @file Test Fixtures - Author
* @module tests/fixtures/Author
* @module tests/fixtures/interfaces/Author
*/

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**
* @file Test Fixtures - Book
* @module tests/fixtures/Book
* @module tests/fixtures/interfaces/Book
*/

import type { Nullable, Simplify } from '#src/types'
import type Author from './author.interface'
import type Publisher from './publisher.interface'
import type Author from './author'
import type Publisher from './publisher'

/**
* Object representing a book.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @file Test Fixtures - Person
* @module tests/fixtures/Person
* @module tests/fixtures/interfaces/Person
*/

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @file Test Fixtures - Publisher
* @module tests/fixtures/Publisher
* @module tests/fixtures/interfaces/Publisher
*/

/**
Expand Down
31 changes: 31 additions & 0 deletions __fixtures__/types/vehicle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* @file Test Fixtures - Vehicle
* @module tests/fixtures/types/Vehicle
*/

/**
* Object representing a vehicle.
*/
type Vehicle = {
/**
* Vehicle manufacturer.
*/
make: string

/**
* Vehicle model.
*/
model: string

/**
* Vehicle identification number.
*/
vin: string

/**
* Vehicle model year.
*/
year: number
}

export type { Vehicle as default }
41 changes: 16 additions & 25 deletions __fixtures__/vehicle.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
/**
* @file Test Fixtures - Vehicle
* @module tests/fixtures/Vehicle
* @file Test Fixtures - VEHICLE
* @module fixtures/VEHICLE
*/

import type { Opaque } from '#src/types'
import type Vehicle from './types/vehicle'

/**
* Object representing a vehicle.
* Vehicle tag.
*
* @const {symbol} VEHICLE_TAG
*/
type Vehicle = {
/**
* Vehicle brand.
*/
make: string

/**
* Vehicle model.
*/
model: string

/**
* Vehicle identification number.
*/
vin: string

/**
* Vehicle model year.
*/
year: number
}
export const VEHICLE_TAG: symbol = Symbol('vehicle')

export type { Vehicle as default }
export default {
[VEHICLE_TAG]: 'vehicle',
make: faker.vehicle.manufacturer(),
model: faker.vehicle.model(),
vin: '0WBW1G4D29TC62167',
year: faker.date.past({ years: 3 }).getFullYear()
} as Opaque<Vehicle, 'vehicle'>
6 changes: 4 additions & 2 deletions __tests__/interfaces/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@
* @module tests/interfaces/Mock
*/

import type { Fn } from '#src'
import type { Fn } from '@flex-development/tutils'
import type * as vitest from 'vitest'

/**
* {@linkcode vitest.Mock} utility.
*
* @template F - Function being mocked
*
* @extends {Fn<Parameters<F>,ReturnType<F>>}
* @extends {vitest.Mock<Parameters<F>,ReturnType<F>>}
*/
interface Mock<F extends Fn = Fn>
extends vitest.Mock<Parameters<F>, ReturnType<F>> {}
extends Fn<Parameters<F>, ReturnType<F>>,
vitest.Mock<Parameters<F>, ReturnType<F>> {}

export type { Mock as default }
4 changes: 3 additions & 1 deletion __tests__/interfaces/spy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import type * as vitest from 'vitest'
*
* @template F - Function being spied on
*
* @extends {Fn<Parameters<F>,ReturnType<F>>}
* @extends {vitest.SpyInstance<Parameters<F>,ReturnType<F>>}
*/
interface Spy<F extends Fn = Fn>
extends vitest.SpyInstance<Parameters<F>, ReturnType<F>> {}
extends Fn<Parameters<F>, ReturnType<F>>,
vitest.SpyInstance<Parameters<F>, ReturnType<F>> {}

export type { Spy as default }
6 changes: 0 additions & 6 deletions __tests__/serve.json

This file was deleted.

12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"release": "bash ./scripts/release.sh",
"test": "vitest run",
"test:cov": "yarn clean:coverage; yarn test --coverage",
"test:cov:serve": "serve __tests__ --listen 5432 --no-port-switching",
"test:cov:serve": "vite preview --outDir ./coverage",
"test:cov:upload": "./codecov -t $CODECOV_TOKEN -f ./coverage/lcov.info",
"test:watch": "vitest",
"typecheck": "vitest typecheck --run",
Expand Down Expand Up @@ -120,8 +120,7 @@
"@typescript-eslint/eslint-plugin": "5.61.0",
"@typescript-eslint/parser": "5.61.0",
"@vates/toggle-scripts": "1.0.0",
"@vitest/coverage-c8": "0.32.4",
"@vitest/ui": "0.32.4",
"@vitest/coverage-v8": "0.33.0",
"add-stream": "1.0.0",
"chai": "5.0.0-alpha.0",
"chai-each": "0.0.1",
Expand Down Expand Up @@ -163,15 +162,14 @@
"pretty-format": "29.6.0",
"sade": "1.8.1",
"semver": "7.5.3",
"serve": "14.2.0",
"tempfile": "5.0.0",
"trash-cli": "5.0.0",
"ts-dedent": "2.2.0",
"typescript": "5.1.6",
"version-bump-prompt": "6.1.0",
"vite": "4.3.9",
"vite": "4.4.4",
"vite-tsconfig-paths": "4.2.0",
"vitest": "0.32.2",
"vitest": "0.33.0",
"vitest-github-actions-reporter": "0.10.0",
"yaml-eslint-parser": "1.2.2"
},
Expand All @@ -185,7 +183,7 @@
},
"resolutions": {
"@ardatan/sync-fetch": "larsgw/sync-fetch#head=worker_threads",
"vitest@npm:0.32.2": "patch:vitest@npm%3A0.32.2#patches/vitest+0.32.2.dev.patch"
"vitest@npm:0.33.0": "patch:vitest@npm%3A0.33.0#patches/vitest+0.33.0.dev.patch"
},
"engines": {
"node": ">=16.20.0",
Expand Down
10 changes: 0 additions & 10 deletions patches/vitest+0.32.2.dev.patch

This file was deleted.

17 changes: 17 additions & 0 deletions patches/vitest+0.33.0.dev.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/dist/index.d.ts b/dist/index.d.ts
index v0.33.0..v0.33.0
--- a/dist/index.d.ts
+++ b/dist/index.d.ts
@@ -115,1 +115,1 @@
- <Expected>(...MISMATCH: MismatchArgs<Equal<Actual, Expected, Options['branded']>, Options['positive']>): true;
+ <Expected>(...MISMATCH: MismatchArgs<Equal<Actual, Expected>, Options['positive']>): true;
diff --git a/dist/vendor-cli-api.bf4b62a8.js b/dist/vendor-cli-api.bf4b62a8.js
index v0.33.0..v0.33.0
--- a/dist/vendor-cli-api.bf4b62a8.js
+++ b/dist/vendor-cli-api.bf4b62a8.js
@@ -11958,3 +11958,2 @@
- const suite = lastSuite;
- while (lastSuite !== file && lastSuite.end < index)
- lastSuite = suite.suite;
+ while (lastSuite !== file && lastSuite.end < index)
+ lastSuite = lastSuite.suite;
2 changes: 1 addition & 1 deletion src/enums/__tests__/compare-result.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import type TestSubject from '../compare-result'

describe('unit-d:enums/CompareResult', () => {
it('should match [EQUAL = 8]', () => {
it('should match [EQUAL = 0]', () => {
expectTypeOf<typeof TestSubject>()
.toHaveProperty('EQUAL')
.toEqualTypeOf<0>()
Expand Down
4 changes: 2 additions & 2 deletions src/types/__tests__/assign.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* @module tutils/types/tests/unit-d/Assign
*/

import type Author from '#fixtures/author.interface'
import type Book from '#fixtures/book.interface'
import type Author from '#fixtures/interfaces/author'
import type Book from '#fixtures/interfaces/book'
import type TestSubject from '../assign'
import type EmptyArray from '../empty-array'
import type EmptyObject from '../empty-object'
Expand Down
2 changes: 1 addition & 1 deletion src/types/__tests__/at.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @module tutils/types/tests/unit-d/At
*/

import type Vehicle from '#fixtures/vehicle'
import type Vehicle from '#fixtures/types/vehicle'
import type TestSubject from '../at'
import type EmptyArray from '../empty-array'
import type EmptyString from '../empty-string'
Expand Down
2 changes: 1 addition & 1 deletion src/types/__tests__/class-abstract.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @module tutils/types/tests/unit-d/AbstractClass
*/

import type Vehicle from '#fixtures/vehicle'
import type Vehicle from '#fixtures/types/vehicle'
import type TestSubject from '../class-abstract'

describe('unit-d:types/AbstractClass', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/types/__tests__/class.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @module tutils/types/tests/unit-d/Class
*/

import type Vehicle from '#fixtures/vehicle'
import type Vehicle from '#fixtures/types/vehicle'
import type TestSubject from '../class'
import type Constructor from '../constructor'

Expand Down
2 changes: 1 addition & 1 deletion src/types/__tests__/constructor-abstract.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @module tutils/types/tests/unit-d/AbstractConstructor
*/

import type Vehicle from '#fixtures/vehicle'
import type Vehicle from '#fixtures/types/vehicle'
import type TestSubject from '../constructor-abstract'

describe('unit-d:types/AbstractConstructor', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/types/__tests__/constructor.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @module tutils/types/tests/unit-d/Constructor
*/

import type Vehicle from '#fixtures/vehicle'
import type Vehicle from '#fixtures/types/vehicle'
import type TestSubject from '../constructor'

describe('unit-d:types/Constructor', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/types/__tests__/crush.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @module tutils/types/tests/unit-d/Crush
*/

import type Vehicle from '#fixtures/vehicle'
import type Vehicle from '#fixtures/types/vehicle'
import type TestSubject from '../crush'
import type EmptyObject from '../empty-object'
import type Fn from '../fn'
Expand Down
4 changes: 2 additions & 2 deletions src/types/__tests__/entries.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* @module tutils/types/tests/unit-d/Entries
*/

import type Book from '#fixtures/book.interface'
import type Vehicle from '#fixtures/vehicle'
import type Book from '#fixtures/interfaces/book'
import type Vehicle from '#fixtures/types/vehicle'
import type EmptyArray from '../empty-array'
import type EmptyObject from '../empty-object'
import type TestSubject from '../entries'
Expand Down
6 changes: 3 additions & 3 deletions src/types/__tests__/get.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* @module tutils/types/tests/unit-d/Get
*/

import type Author from '#fixtures/author.interface'
import type Book from '#fixtures/book.interface'
import type Vehicle from '#fixtures/vehicle'
import type Author from '#fixtures/interfaces/author'
import type Book from '#fixtures/interfaces/book'
import type Vehicle from '#fixtures/types/vehicle'
import type At from '../at'
import type EmptyArray from '../empty-array'
import type EmptyObject from '../empty-object'
Expand Down
2 changes: 1 addition & 1 deletion src/types/__tests__/has-keys.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @module tutils/types/tests/unit-d/HasKeys
*/

import type Vehicle from '#fixtures/vehicle'
import type Vehicle from '#fixtures/types/vehicle'
import type EmptyObject from '../empty-object'
import type TestSubject from '../has-keys'
import type NIL from '../nil'
Expand Down
2 changes: 1 addition & 1 deletion src/types/__tests__/if-equal.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @module tutils/types/tests/unit-d/IfEqual
*/

import type Book from '#fixtures/book.interface'
import type Book from '#fixtures/interfaces/book'
import type Digit from '../digit'
import type TestSubject from '../if-equal'

Expand Down
4 changes: 2 additions & 2 deletions src/types/__tests__/if-key-optional-exact.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* @module tutils/types/tests/unit-d/IfExactOptionalKey
*/

import type Author from '#fixtures/author.interface'
import type Book from '#fixtures/book.interface'
import type Author from '#fixtures/interfaces/author'
import type Book from '#fixtures/interfaces/book'
import type TestSubject from '../if-key-optional-exact'

describe('unit-d:types/IfExactOptionalKey', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/types/__tests__/if-key-optional.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* @module tutils/types/tests/unit-d/IfOptionalKey
*/

import type Author from '#fixtures/author.interface'
import type Book from '#fixtures/book.interface'
import type Author from '#fixtures/interfaces/author'
import type Book from '#fixtures/interfaces/book'
import type TestSubject from '../if-key-optional'

describe('unit-d:types/IfOptionalKey', () => {
Expand Down

0 comments on commit d2ddb0d

Please sign in to comment.