-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Lexus Drumgold <[email protected]>
- Loading branch information
1 parent
86497f4
commit edaa955
Showing
98 changed files
with
2,435 additions
and
925 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
abar | ||
attw | ||
barx | ||
cdir | ||
cefc | ||
cindex | ||
codecov | ||
commitlintrc | ||
dbar | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* @file Fixtures - DRIVE | ||
* @module fixtures/drive | ||
*/ | ||
|
||
import type { DriveLetter } from '@flex-development/pathe' | ||
|
||
/** | ||
* Windows drive letter. | ||
* | ||
* @const {DriveLetter} DRIVE | ||
*/ | ||
const DRIVE: DriveLetter = 'T:' | ||
|
||
export default DRIVE |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* @file Plugins - chaiPath | ||
* @module tests/plugins/chaiPath | ||
*/ | ||
|
||
import type Chai from 'chai' | ||
import path from 'node:path' | ||
|
||
export default plugin | ||
|
||
/** | ||
* Chai assertion plugin for the Node.js [path][node-path] API. | ||
* | ||
* [node-path]: https://nodejs.org/api/path.html | ||
* | ||
* @see {@linkcode Chai.ChaiStatic} | ||
* @see {@linkcode Chai.ChaiUtils} | ||
* | ||
* @param {ChaiStatic} chai | ||
* `chai` export | ||
* @param {Chai.ChaiUtils} utils | ||
* `chai` utilities | ||
* @return {undefined} | ||
*/ | ||
function plugin(chai: Chai.ChaiStatic, utils: Chai.ChaiUtils): undefined { | ||
utils.addMethod(chai.Assertion.prototype, extname.name, extname) | ||
|
||
return void 0 | ||
|
||
/** | ||
* Assert the return value of {@linkcode path.extname}. | ||
* | ||
* @this {Chai.Assertion} | ||
* | ||
* @param {unknown} expected | ||
* Expected file extension | ||
* @return {undefined} | ||
*/ | ||
function extname(this: Chai.Assertion, expected: unknown): undefined { | ||
/** | ||
* Subject of assertion. | ||
* | ||
* @const {string} subject | ||
*/ | ||
const subject: string = utils.flag(this, 'object') | ||
|
||
/** | ||
* File extension. | ||
* | ||
* @const {string} ext | ||
*/ | ||
const actual: string = path.extname(subject) | ||
|
||
return void this.assert( | ||
actual === expected, | ||
'expected extname of #{this} to be #{exp} but got #{act}', | ||
'expected extname of #{this} to not be #{act}', | ||
expected, | ||
actual | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* @file Test Setup - chai | ||
* @module tests/setup/chai | ||
* @see https://chaijs.com | ||
*/ | ||
|
||
import chaiPath from '#tests/plugins/chai-path' | ||
import chaiString from 'chai-string' | ||
import { chai } from 'vitest' | ||
|
||
/** | ||
* initialize chai plugins. | ||
* | ||
* @see https://github.com/onechiporenko/chai-string | ||
*/ | ||
chai.use(chaiPath) | ||
chai.use(chaiString) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* @file Test Utilities - cwdWindows | ||
* @module tests/utils/cwdWindows | ||
*/ | ||
|
||
import DRIVE from '#fixtures/drive' | ||
import { ok } from 'devlop' | ||
import { posix, win32 } from 'node:path' | ||
|
||
/** | ||
* Get the path to the current working directory as a windows drive path. | ||
* | ||
* @return {string} | ||
* Absolute path to current working directory | ||
*/ | ||
function cwdWindows(): string { | ||
ok(typeof process.env['PWD'] === 'string', 'expected `process.env.PWD`') | ||
return DRIVE + process.env['PWD'].replaceAll(posix.sep, win32.sep) | ||
} | ||
|
||
export default cwdWindows |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/interfaces/__tests__/file-url-to-path-options.spec-d.mts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @file Unit Tests - FileUrlToPathOptions | ||
* @module pathe/interfaces/tests/unit-d/FileUrlToPathOptions | ||
*/ | ||
|
||
import type TestSubject from '#interfaces/file-url-to-path-options' | ||
import type { PlatformOptions } from '@flex-development/pathe' | ||
|
||
describe('unit-d:interfaces/FileUrlToPathOptions', () => { | ||
it('should extend PlatformOptions', () => { | ||
expectTypeOf<TestSubject>().toMatchTypeOf<PlatformOptions>() | ||
}) | ||
}) |
20 changes: 20 additions & 0 deletions
20
src/interfaces/__tests__/path-to-file-url-options.spec-d.mts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* @file Unit Tests - PathToFileUrlOptions | ||
* @module pathe/interfaces/tests/unit-d/PathToFileUrlOptions | ||
*/ | ||
|
||
import type TestSubject from '#interfaces/path-to-file-url-options' | ||
import type { | ||
PlatformOptions, | ||
ResolveWithOptions | ||
} from '@flex-development/pathe' | ||
|
||
describe('unit-d:interfaces/PathToFileUrlOptions', () => { | ||
it('should extend PlatformOptions', () => { | ||
expectTypeOf<TestSubject>().toMatchTypeOf<PlatformOptions>() | ||
}) | ||
|
||
it('should extend ResolveWithOptions', () => { | ||
expectTypeOf<TestSubject>().toMatchTypeOf<ResolveWithOptions>() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @file Unit Tests - RelativeOptions | ||
* @module pathe/interfaces/tests/unit-d/RelativeOptions | ||
*/ | ||
|
||
import type TestSubject from '#interfaces/relative-options' | ||
import type { ResolveWithOptions } from '@flex-development/pathe' | ||
|
||
describe('unit-d:interfaces/RelativeOptions', () => { | ||
it('should extend ResolveWithOptions', () => { | ||
expectTypeOf<TestSubject>().toMatchTypeOf<ResolveWithOptions>() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* @file Unit Tests - ResolveWithOptions | ||
* @module pathe/interfaces/tests/unit-d/ResolveWithOptions | ||
*/ | ||
|
||
import type TestSubject from '#interfaces/resolve-with-options' | ||
import type { Cwd } from '@flex-development/pathe' | ||
import type { Nilable } from '@flex-development/tutils' | ||
|
||
describe('unit-d:interfaces/ResolveWithOptions', () => { | ||
it('should match [cwd?: Cwd | null | undefined]', () => { | ||
expectTypeOf<TestSubject>() | ||
.toHaveProperty('cwd') | ||
.toEqualTypeOf<Nilable<Cwd>>() | ||
}) | ||
|
||
it('should match [env?: Partial<Record<string, string>> | null | undefined]', () => { | ||
expectTypeOf<TestSubject>() | ||
.toHaveProperty('env') | ||
.toEqualTypeOf<Nilable<Partial<Record<string, string>>>>() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* @file Unit Tests - ToPathOptions | ||
* @module pathe/interfaces/tests/unit-d/ToPathOptions | ||
*/ | ||
|
||
import type TestSubject from '#interfaces/to-path-options' | ||
import type { | ||
FileUrlToPathOptions, | ||
PlatformOptions | ||
} from '@flex-development/pathe' | ||
|
||
describe('unit-d:interfaces/ToPathOptions', () => { | ||
it('should extend FileUrlToPathOptions', () => { | ||
expectTypeOf<TestSubject>().toMatchTypeOf<FileUrlToPathOptions>() | ||
}) | ||
|
||
it('should extend PlatformOptions', () => { | ||
expectTypeOf<TestSubject>().toMatchTypeOf<PlatformOptions>() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* @file Interfaces - FileUrlToPathOptions | ||
* @module pathe/interfaces/FileUrlToPathOptions | ||
*/ | ||
|
||
import type { PlatformOptions } from '@flex-development/pathe' | ||
|
||
/** | ||
* Options for converting `file:` URLs to paths. | ||
* | ||
* @see {@linkcode PlatformOptions} | ||
* | ||
* @extends {PlatformOptions} | ||
*/ | ||
interface FileUrlToPathOptions extends PlatformOptions {} | ||
|
||
export type { FileUrlToPathOptions as default } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.