-
Notifications
You must be signed in to change notification settings - Fork 564
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'tabarra:develop' into develop
- Loading branch information
Showing
215 changed files
with
15,319 additions
and
8,351 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,6 @@ | ||
The `!NC` comments in code are tags used by a git pre-commit hook to prevent committing the lines containing it, and are generally used to mark TO-DOs that are required to be done before committing the changes. | ||
Import `suite, it, expect` from vitest for writing tests, whith each method having one `suite()` and a list of tests using the `it()` for its definition. | ||
Prefer implicit over explicit function return types. | ||
Except for React components, prefer arrow functions. | ||
Prefer using for..of instead of forEach. | ||
Prefer single quotes over doble quotes. |
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 |
---|---|---|
|
@@ -45,4 +45,4 @@ | |
"reason": "undici sub-dependency dropped support for node 16" | ||
} | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { suite, it, expect, vi, beforeEach, afterEach } from 'vitest'; | ||
import { processStdioWriteRaw, processStdioEnsureEol } from './console'; | ||
|
||
|
||
suite('processStdioWriteRaw & processStdioEnsureEol', () => { | ||
let writeSpy: ReturnType<typeof vi.spyOn>; | ||
|
||
beforeEach(() => { | ||
writeSpy = vi.spyOn(process.stdout as any, 'write').mockImplementation(() => true); | ||
}); | ||
|
||
afterEach(() => { | ||
writeSpy.mockRestore(); | ||
}); | ||
|
||
it('should write a non-newline string and then add a newline', () => { | ||
processStdioWriteRaw("Hello"); | ||
expect(writeSpy).toHaveBeenCalledWith("Hello"); | ||
processStdioEnsureEol(); | ||
expect(writeSpy).toHaveBeenCalledWith('\n'); | ||
}); | ||
|
||
it('should write a string ending in newline without adding an extra one', () => { | ||
processStdioWriteRaw("Hello\n"); | ||
expect(writeSpy).toHaveBeenCalledWith("Hello\n"); | ||
writeSpy.mockClear(); | ||
processStdioEnsureEol(); | ||
expect(writeSpy).not.toHaveBeenCalled(); | ||
}); | ||
|
||
it('should write Uint8Array without trailing newline and then add one', () => { | ||
const buffer = new Uint8Array([72, 101, 108, 108, 111]); // "Hello" | ||
processStdioWriteRaw(buffer); | ||
expect(writeSpy).toHaveBeenCalledWith(buffer); | ||
processStdioEnsureEol(); | ||
expect(writeSpy).toHaveBeenCalledWith('\n'); | ||
}); | ||
|
||
it('should write Uint8Array with trailing newline and not add an extra one', () => { | ||
const newline = 10; | ||
const buffer = new Uint8Array([72, 101, 108, 108, 111, newline]); // "Hello\n" | ||
processStdioWriteRaw(buffer); | ||
expect(writeSpy).toHaveBeenCalledWith(buffer); | ||
writeSpy.mockClear(); | ||
processStdioEnsureEol(); | ||
expect(writeSpy).not.toHaveBeenCalled(); | ||
}); | ||
}); |
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.