forked from sombriks/node-libgpiod
-
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.
initial mocking of the os module works
- Loading branch information
Kevin Hill
authored and
Kevin Hill
committed
Nov 19, 2023
1 parent
1c614e0
commit ef955a3
Showing
5 changed files
with
19 additions
and
7 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { vi } from "vitest"; | ||
|
||
export default { | ||
type: vi.fn(() => 'Linux') | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 |
---|---|---|
|
@@ -28,6 +28,7 @@ | |
}, | ||
"devDependencies": { | ||
"node-gyp": "^10.0.1", | ||
"vite": "^5.0.0", | ||
"vitest": "^0.34.6" | ||
} | ||
} |
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,13 +1,13 @@ | ||
import { gpiod } from "../index.mjs"; | ||
|
||
import { afterAll, beforeAll } from 'vitest'; | ||
import { afterEach, beforeEach } from 'vitest'; | ||
|
||
beforeAll(() => { | ||
if (!globalThis.gpiod) { | ||
globalThis.gpiod = gpiod; | ||
} | ||
vi.mock("os"); | ||
|
||
beforeEach(async () => { | ||
if (!globalThis.gpiod) globalThis.gpiod = gpiod; | ||
}); | ||
|
||
afterAll(() => { | ||
afterEach(() => { | ||
delete globalThis.gpiod; | ||
}); |