-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: reform package.json scripts, fix e2e and verify node env for v…
…itest
- Loading branch information
Showing
12 changed files
with
67 additions
and
19 deletions.
There are no files selected for viewing
File renamed without changes.
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,6 +1,5 @@ | ||
.next | ||
dist | ||
.cache | ||
package-lock.json | ||
public | ||
node_modules | ||
|
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,37 @@ | ||
// @vitest-environment node | ||
|
||
import * as fs from 'fs/promises' | ||
import { beforeEach, describe, expect, it, vi } from 'vitest' | ||
|
||
import { readFile } from './read-file' | ||
|
||
vi.mock('fs/promises') | ||
|
||
describe('readFile function', () => { | ||
beforeEach(() => { | ||
vi.resetAllMocks() | ||
}) | ||
|
||
it('should read file content successfully', async () => { | ||
const mockContent = 'This is the file content' | ||
const mockPath = '/path/to/file.txt' | ||
|
||
vi.mocked(fs.readFile).mockResolvedValue(mockContent) | ||
|
||
const result = await readFile(mockPath) | ||
|
||
expect(result).toBe(mockContent) | ||
expect(fs.readFile).toHaveBeenCalledWith(mockPath, 'utf8') | ||
}) | ||
|
||
it('should throw an error when file reading fails', async () => { | ||
const mockPath = '/path/to/nonexistent/file.txt' | ||
const mockError = new Error('File not found') | ||
|
||
vi.mocked(fs.readFile).mockRejectedValue(mockError) | ||
|
||
await expect(readFile(mockPath)).rejects.toThrow( | ||
`Error reading file: ${mockPath}. Error: ${mockError}`, | ||
) | ||
}) | ||
}) |
File renamed without changes.
File renamed without changes.
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,4 +1,4 @@ | ||
module.exports = { | ||
export default { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
|