-
Notifications
You must be signed in to change notification settings - Fork 923
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into meteorlxy-markdown-to-vue
- Loading branch information
Showing
60 changed files
with
1,952 additions
and
1,771 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
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 |
---|---|---|
@@ -1,32 +1,30 @@ | ||
import { path } from '@vuepress/utils' | ||
import { describe, expect, it, vi } from 'vitest' | ||
import { expect, it, vi } from 'vitest' | ||
import { resolveUserConfigPath } from '../../src/index.js' | ||
|
||
const resolveFixtures = (str: string): string => | ||
path.resolve(__dirname, '../__fixtures__/config', str) | ||
|
||
describe('cli > config > resolveUserConfigPath', () => { | ||
it('should resolve absolute file path correctly', () => { | ||
const absolutePath = resolveFixtures('custom-config.ts') | ||
const configFile = resolveUserConfigPath(absolutePath) | ||
expect(configFile).toEqual(absolutePath) | ||
}) | ||
it('should resolve absolute file path correctly', () => { | ||
const absolutePath = resolveFixtures('custom-config.ts') | ||
const configFile = resolveUserConfigPath(absolutePath) | ||
expect(configFile).toEqual(absolutePath) | ||
}) | ||
|
||
it('should resolve relative file path correctly', () => { | ||
const relativePath = 'custom-config.ts' | ||
const configFile = resolveUserConfigPath(relativePath, resolveFixtures('')) | ||
expect(configFile).toEqual(resolveFixtures(relativePath)) | ||
}) | ||
it('should resolve relative file path correctly', () => { | ||
const relativePath = 'custom-config.ts' | ||
const configFile = resolveUserConfigPath(relativePath, resolveFixtures('')) | ||
expect(configFile).toEqual(resolveFixtures(relativePath)) | ||
}) | ||
|
||
it('should throw an error if file does not exist', () => { | ||
const consoleError = console.error | ||
console.error = vi.fn() | ||
it('should throw an error if file does not exist', () => { | ||
const consoleError = console.error | ||
console.error = vi.fn() | ||
|
||
expect(() => { | ||
resolveUserConfigPath('4-0-4') | ||
}).toThrow() | ||
expect(console.error).toHaveBeenCalled() | ||
expect(() => { | ||
resolveUserConfigPath('4-0-4') | ||
}).toThrow() | ||
expect(console.error).toHaveBeenCalled() | ||
|
||
console.error = consoleError | ||
}) | ||
console.error = consoleError | ||
}) |
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
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
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
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
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
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.