Skip to content

Commit 80d2436

Browse files
authored
Fix some test flakiness. (#5345)
* Fix test flakiness in node-core-library. * Fix some test flakiness in rush-lib.
1 parent 02b0ed4 commit 80d2436

4 files changed

Lines changed: 26 additions & 2 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/rush",
5+
"comment": "",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/rush"
10+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "",
5+
"type": "none",
6+
"packageName": "@rushstack/node-core-library"
7+
}
8+
],
9+
"packageName": "@rushstack/node-core-library",
10+
"email": "iclanton@users.noreply.github.com"
11+
}

libraries/node-core-library/src/test/FileSystem.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,9 @@ describe(FileSystem.name, () => {
4343
});
4444

4545
test('Should return true for an error on a file descriptor call', () => {
46-
const buffer: Buffer = Buffer.allocUnsafeSlow(1024);
4746
expect.assertions(1);
4847
try {
49-
fs.readSync(11, buffer, 0, buffer.length, -1);
48+
fs.readFileSync(`${__dirname}/nonexistent.txt`);
5049
} catch (error) {
5150
expect(FileSystem.isErrnoException(error)).toBe(true);
5251
}

libraries/rush-lib/src/cli/test/RushCommandLineParser.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ describe('RushCommandLineParser', () => {
4747
afterEach(() => {
4848
jest.clearAllMocks();
4949
EnvironmentConfiguration.reset();
50+
jest
51+
.spyOn(EnvironmentConfiguration, 'buildCacheOverrideJsonFilePath', 'get')
52+
.mockReturnValue(undefined);
53+
jest.spyOn(EnvironmentConfiguration, 'buildCacheOverrideJson', 'get').mockReturnValue(undefined);
5054
});
5155

5256
describe('in basic repo', () => {

0 commit comments

Comments
 (0)