GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test_runner: fix invalid timer call · nodejs/node@ba57c24

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/test_runner/mock
    • mock_timers.js
  • test/parallel
    • test-runner-mock-timers.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/test_runner/mock/mock_timers.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/mock/mock_timers.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ class MockTimers {
371371
ObjectDefineProperty(
372372
nodeTimers,
373373
'setTimeout',
374-
this.#realSetTimeout,
374+
this.#realTimersSetTimeout,
375375
);
376376
ObjectDefineProperty(
377377
nodeTimers,
Collapse file

‎test/parallel/test-runner-mock-timers.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-runner-mock-timers.js
+24-15Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ describe('Mock Timers Test Suite', () => {
4646
code: 'ERR_INVALID_ARG_VALUE',
4747
});
4848
});
49-
50-
it('should check that propertyDescriptor gets back after reseting timers', (t) => {
49+
it('should check that propertyDescriptor gets back after resetting timers', (t) => {
5150
const getDescriptor = (ctx, fn) => Object.getOwnPropertyDescriptor(ctx, fn);
5251
const getCurrentTimersDescriptors = () => {
5352
const timers = [
@@ -71,26 +70,36 @@ describe('Mock Timers Test Suite', () => {
7170
nodeTimersPromises: nodeTimersPromisesDescriptors,
7271
};
7372
};
74-
const before = getCurrentTimersDescriptors();
73+
74+
const originalDescriptors = getCurrentTimersDescriptors();
75+
7576
t.mock.timers.enable();
7677
const during = getCurrentTimersDescriptors();
7778
t.mock.timers.reset();
7879
const after = getCurrentTimersDescriptors();
7980

80-
assert.deepStrictEqual(
81-
before,
82-
after,
83-
);
81+
for (const env in originalDescriptors) {
82+
for (const prop in originalDescriptors[env]) {
83+
const originalDescriptor = originalDescriptors[env][prop];
84+
const afterDescriptor = after[env][prop];
8485

85-
assert.notDeepStrictEqual(
86-
before,
87-
during,
88-
);
86+
assert.deepStrictEqual(
87+
originalDescriptor,
88+
afterDescriptor,
89+
);
8990

90-
assert.notDeepStrictEqual(
91-
during,
92-
after,
93-
);
91+
assert.notDeepStrictEqual(
92+
originalDescriptor,
93+
during[env][prop],
94+
);
95+
96+
assert.notDeepStrictEqual(
97+
during[env][prop],
98+
after[env][prop],
99+
);
100+
101+
}
102+
}
94103
});
95104

96105
it('should reset all timers when calling .reset function', (t) => {

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.