nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: unexpectedjs/unexpected
Pull request #684 (2020-01-02 18:24:06)

Bring in unexpected-markdown 5 and reconfigure test setup to match.
The new version of unexpected-markdown uses async/await syntax
which will not work on node 6. Since Unexpected still supports
this currently, we need a few special affordances:
- do not unconditionally include unexpected-markdown in mocha.opts
- use the "MODERN_NODE" trick to execute doc test on node 8+ only
- require unexpected-markdown only when executing doc tests


Patch:
diff --git a/Makefile b/Makefile
index 5c2655f3..0f904d4f 100644
--- a/Makefile
+++ b/Makefile
@@ -66,7 +66,11 @@ endif
 
 .PHONY: test
 test: test-sources
-	@./node_modules/.bin/mocha --opts $(MOCHA_OPTS) $(TEST_SOURCES) $(TEST_SOURCES_MARKDOWN)
+ifeq ($(MODERN_NODE), true)
+	@./node_modules/.bin/mocha --opts $(MOCHA_OPTS) --require unexpected-markdown $(TEST_SOURCES) $(TEST_SOURCES_MARKDOWN)
+else
+	@./node_modules/.bin/mocha --opts $(MOCHA_OPTS) $(TEST_SOURCES)
+endif
 
 nyc-includes:
 ifeq ($(MODERN_NODE), true)
@@ -77,7 +81,7 @@ endif
 
 .PHONY: coverage
 coverage: nyc-includes test-sources
-	@./node_modules/.bin/nyc --include $(NYC_INCLUDES) --reporter=lcov --reporter=text --all -- mocha --opts $(MOCHA_OPTS) $(TEST_SOURCES) $(TEST_SOURCES_MARKDOWN)
+	@./node_modules/.bin/nyc --include $(NYC_INCLUDES) --reporter=lcov --reporter=text --all -- mocha --opts $(MOCHA_OPTS) --require unexpected-markdown $(TEST_SOURCES) $(TEST_SOURCES_MARKDOWN)
 	@echo google-chrome coverage/lcov-report/index.html
 
  .PHONY: test-browser
diff --git a/package.json b/package.json
index 30877ee1..9cb550a0 100644
--- a/package.json
+++ b/package.json
@@ -74,7 +74,7 @@
     "tap-spot": "^1.1.1",
     "unexpected-documentation-site-generator": "^6.0.0",
     "unexpected-magicpen": "^2.1.0",
-    "unexpected-markdown": "^4.0.0"
+    "unexpected-markdown": "^5.0.0"
   },
   "files": [
     "unexpected.js",


Test patch:
diff --git a/test/mocha.opts b/test/mocha.opts
index b8aeb6cf..22a15e32 100644
--- a/test/mocha.opts
+++ b/test/mocha.opts
@@ -4,4 +4,3 @@
 --timeout 20000
 --require ./test/common
 --require ./test/promisePolyfill
---require unexpected-markdown
Repository: unexpectedjs/unexpected
Pull request #852 (2022-08-20 14:06:28)

Fix bug that caused expect({foo: 123}, 'to satisfy', {foo: undefined}) to pass
Whoopsie...


Patch:
diff --git a/lib/assertions.js b/lib/assertions.js
index 4dbdf1e6..8d7691c3 100644
--- a/lib/assertions.js
+++ b/lib/assertions.js
@@ -1986,7 +1986,8 @@ module.exports = (expect) => {
       let forceExhaustivelyComparison = false;
       uniqueKeys.forEach((key, index) => {
         const subjectHasKey = subjectType.hasKey(subject, key);
-        const valueKey = valueType.hasKey(value, key, true)
+        const valueHasKey = valueType.hasKey(value, key, true);
+        const valueKey = valueHasKey
           ? valueType.valueForKey(value, key)
           : undefined;
         const valueKeyType = expect.findTypeOf(valueKey);
@@ -1995,7 +1996,7 @@ module.exports = (expect) => {
             // ensure value only expect.it key is marked missing
             forceExhaustivelyComparison = true;
           }
-        } else if (subjectHasKey && typeof valueKey === 'undefined') {
+        } else if (subjectHasKey && !valueHasKey) {
           // ignore subject only keys unless we are being exhaustive
           return;
         }


Test patch:
diff --git a/test/assertions/to-satisfy.spec.js b/test/assertions/to-satisfy.spec.js
index 488f7179..cf7b258f 100644
--- a/test/assertions/to-satisfy.spec.js
+++ b/test/assertions/to-satisfy.spec.js
@@ -1747,9 +1747,30 @@ describe('to satisfy assertion', () => {
     });
   });
 
-  it('should assert missing properties with undefined in the RHS object', () => {
-    expect({ foo: 123 }, 'to satisfy', {
-      bar: undefined,
+  describe('when asserting missing properties with undefined in the RHS object', () => {
+    describe('when the property is missing', () => {
+      it('should succeed', () => {
+        expect({ foo: 123 }, 'to satisfy', {
+          bar: undefined,
+        });
+      });
+    });
+
+    describe('when the property is present', () => {
+      it('should fail with an error', () => {
+        expect(
+          () =>
+            expect({ foo: 123 }, 'to satisfy', {
+              foo: undefined,
+            }),
+          'to throw',
+          'expected { foo: 123 } to satisfy { foo: undefined }\n' +
+            '\n' +
+            '{\n' +
+            '  foo: 123 // should equal undefined\n' +
+            '}'
+        );
+      });
     });
   });
Repository: unexpectedjs/unexpected
Pull request #856 (2023-07-29 10:11:24)

Avoid uncaught exception in 'to satisfy' when the diff is only in properties with symbol keys
I ran into this rather nasty case when using `to satisfy` to compare objects that only have Symbol properties.


Patch:
diff --git a/lib/makePromise.js b/lib/makePromise.js
index 2e4f920c..823daea7 100644
--- a/lib/makePromise.js
+++ b/lib/makePromise.js
@@ -94,6 +94,9 @@ function extractPromisesFromObject(obj) {
     Object.keys(obj).forEach((key) => {
       promises.push(...extractPromisesFromObject(obj[key]));
     });
+    Object.getOwnPropertySymbols(obj).forEach((key) => {
+      promises.push(...extractPromisesFromObject(obj[key]));
+    });
     return promises;
   }
   return [];


Test patch:
diff --git a/test/types/Symbol-type.spec.js b/test/types/Symbol-type.spec.js
index 08cd0f57..8b12d393 100644
--- a/test/types/Symbol-type.spec.js
+++ b/test/types/Symbol-type.spec.js
@@ -113,6 +113,31 @@ if (
             '}'
         );
       });
+
+      describe('when only symbol properties differ', function () {
+        // Regression test for not looping over Object.getOwnPropertySymbols(obj)
+        // in expect.promise.{any,all,settle} when an object is passed:
+        it('should error and include the Symbol properties in the diff', () => {
+          const a = {};
+          a[symbolA] = 'foo';
+          const b = {};
+          b[symbolA] = 'bar';
+          expect(
+            function () {
+              expect(a, 'to satisfy', b);
+            },
+            'to throw',
+            "expected { [Symbol('a')]: 'foo' } to satisfy { [Symbol('a')]: 'bar' }\n" +
+              '\n' +
+              '{\n' +
+              "  [Symbol('a')]: 'foo' // should equal 'bar'\n" +
+              '                       //\n' +
+              '                       // -foo\n' +
+              '                       // +bar\n' +
+              '}'
+          );
+        });
+      });
     });
   });
 }
Repository: pbiswas101/Mathball
Pull request #7 (2019-01-27 08:22:45)

Added function to find the nth catalan number

**Q**: What version of *Node.js* you've used in the project?
**A**: Node v10.12.0

**Q**: Mention the *Issue Number*!
**A**: #6 

- *Give additional information regarding the PR below:*

------------



Patch:
diff --git a/src/catalan/index.js b/src/catalan/index.js
new file mode 100644
index 0000000..dcbeff1
--- /dev/null
+++ b/src/catalan/index.js
@@ -0,0 +1,31 @@
+/* Nth Catalan Number
+ * Function: catalan()
+ */
+
+function validate(arg) {
+	if (typeof arg != "number" || arg < 0 || !Number.isInteger(arg)) {
+		throw new TypeError(
+			`Invalid argument recieved: ${JSON.stringify(
+				arg
+			)}\n'catalan()' only accepts a non-negative integer!\n`
+		);
+	}
+}
+
+function binomialCoeff(n, k) {
+	let res = 1;
+	if (k > n - k) {
+		k = n - k;
+	}
+	for (let i = 0; i < k; i++) {
+		res = res * (n - i);
+		res = res / (i + 1);
+	}
+	return res;
+}
+
+exports.catalan = num => {
+	validate(num);
+	let c = binomialCoeff(2 * num, num);
+	return c / (num + 1);
+};


Test patch:
diff --git a/test/catalan-spec.js b/test/catalan-spec.js
new file mode 100644
index 0000000..863bf33
--- /dev/null
+++ b/test/catalan-spec.js
@@ -0,0 +1,40 @@
+const assert = require("assert"),
+	catalan = require("../src/catalan").catalan;
+
+describe("[Function: catalan]", () => {
+	it("should be a function", () => {
+		assert.strictEqual(typeof catalan, "function");
+	});
+
+	it("should return a number when a positive integer is passed", () => {
+		assert.strictEqual(typeof catalan(1), "number");
+	});
+
+	it("should return '1' when '0' is passed", () => {
+		assert.strictEqual(catalan(0), 1);
+	});
+
+	it("should return '4862' when '9' is passed", () => {
+		assert.strictEqual(catalan(9), 4862);
+	});
+
+	it("should return '42' when '5' is passed", () => {
+		assert.strictEqual(catalan(5), 42);
+	});
+
+	it("should throw an error when a negative number is passed", () => {
+		assert.throws(() => catalan(-20), TypeError);
+	});
+
+	it("should throw an error when a floating point is passed", () => {
+		assert.throws(() => catalan(31.101996), TypeError);
+	});
+
+	it("should throw an error when a string is passed", () => {
+		assert.throws(() => catalan("31"), TypeError);
+	});
+
+	it("should throw an error when no arguments passed", () => {
+		assert.throws(() => catalan(), TypeError);
+	});
+});