PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: harrisiirak/cron-parser (ts)
Issue: v5 regression: `next()` doesn't set milli-seconds correctly
v5 doesn't set the milli-seconds to zero for the next date. They are carried over from `currentDate` instead.

```ts
const cronExpression = CronExpressionParser.parse('* * * * *', {
   currentDate: '2020-03-06T10:02:01.002Z',
   tz: 'Europe/Berlin'
 })
 const res = cronExpression.next().toISOString()
```
`res` is "2020-03-06T10:03:00.002Z" in v5, but should be "2020-03-06T10:03:00.000Z". With v4 the milli-seconds were correct.
Pull request description: Set milliseconds to 0 before returning schedule (fixes #363)
This is my first attempt at a real code change in the repository. Please let me know if anything needs changing.

Fixes #363

Patch:
diff --git a/src/CronExpression.ts b/src/CronExpression.ts
index aed7127..85235fa 100644
--- a/src/CronExpression.ts
+++ b/src/CronExpression.ts
@@ -396,14 +396,15 @@ export class CronExpression {
       if (startTimestamp === currentDate.getTime()) {
         if (dateMathVerb === 'Add' || currentDate.getMilliseconds() === 0) {
           currentDate.applyDateOperation(dateMathVerb, TimeUnit.Second, this.#fields.hour.values.length);
-        } else {
-          currentDate.setMilliseconds(0);
         }
         continue;
       }
       break;
     }
 
+    if (currentDate.getMilliseconds() !== 0) {
+      currentDate.setMilliseconds(0);
+    }
     this.#currentDate = currentDate;
     return currentDate;
   }


Test patch:
diff --git a/tests/CronExpression.test.ts b/tests/CronExpression.test.ts
index 714d882..82b4672 100644
--- a/tests/CronExpression.test.ts
+++ b/tests/CronExpression.test.ts
@@ -84,6 +84,22 @@ describe('CronExpression', () => {
     expect(cronExpression.toString()).toBe('0 0 0 1 1 0');
   });
 
+  test('should set milliseconds to 0 on next scheduled date (issue #363)', () => {
+    const cronExpression = CronExpressionParser.parse('* * * * *', {
+      currentDate: '2020-03-06T10:02:01.002Z',
+    });
+    const nextDate = cronExpression.next();
+    expect(nextDate.toISOString()).toBe('2020-03-06T10:03:00.000Z');
+  });
+
+  test('should set milliseconds to 0 on previous scheduled date (issue #363)', () => {
+    const cronExpression = CronExpressionParser.parse('* * * * *', {
+      currentDate: '2020-03-06T10:02:01.002Z',
+    });
+    const prevDate = cronExpression.prev();
+    expect(prevDate.toISOString()).toBe('2020-03-06T10:02:00.000Z');
+  });
+
   describe('stringify', () => {
     test('stringify cron expression all stars no seconds 0 * * * * *', () => {
       const expected = '0 * * * * *';
Repository: microsoft/inshellisense (ts)
Issue: Piping into another command - inshellisense does not work on that other command
**Is your feature request related to a problem? Please describe.**
I want to use Inshellisense on multiple commands when constructing more complex command line invocations that use pipes. For example
```
ls | cat -
```
should bring up the options for the `cat` command. But I don't get any options, just a list of filenames, which is useless, as I am piping into `cat` and don't need to supply a filename. 


**Describe the solution you'd like**
```
ls | cat -
```
should bring up the options for the `cat` command


Pull request description: fix: command delimiter to support pipelining
## Description
Closes #57 

Patch:
diff --git a/src/runtime/parser.ts b/src/runtime/parser.ts
index 4416d3c..3f9226c 100644
--- a/src/runtime/parser.ts
+++ b/src/runtime/parser.ts
@@ -8,7 +8,7 @@ export type CommandToken = {
   isPersistent?: boolean;
 };
 
-const cmdDelim = /(\|\|)|(&&)|(;)/;
+const cmdDelim = /(\|\|)|(&&)|(;)|(\|)/;
 const spaceRegex = /\s/;
 
 export const parseCommand = (command: string): CommandToken[] => {


Test patch:
diff --git a/src/tests/runtime/__snapshots__/parser.test.ts.snap b/src/tests/runtime/__snapshots__/parser.test.ts.snap
index 9463594..444287e 100644
--- a/src/tests/runtime/__snapshots__/parser.test.ts.snap
+++ b/src/tests/runtime/__snapshots__/parser.test.ts.snap
@@ -319,3 +319,13 @@ exports[`parseCommand cmd value  1`] = `
   },
 ]
 `;
+
+exports[`parseCommand cmd1 | cmd2  1`] = `
+[
+  {
+    "complete": true,
+    "isOption": false,
+    "token": "cmd2",
+  },
+]
+`;
diff --git a/src/tests/runtime/parser.test.ts b/src/tests/runtime/parser.test.ts
index 8d200bb..37d7dae 100644
--- a/src/tests/runtime/parser.test.ts
+++ b/src/tests/runtime/parser.test.ts
@@ -23,6 +23,7 @@ const testData = [
   { command: `cmd ` },
   { command: `cmd "value' ` },
   { command: `cmd "value'\\"\\"" ` },
+  { command: `cmd1 | cmd2 ` },
 ];
 
 describe(`parseCommand`, () => {
Repository: capricorn86/happy-dom (ts)
Issue: Text.splitText does not throw on invalid index
**Describe the bug**
Calling `Text.spliText` does not throw on invalid index as specified.

**To Reproduce**
`document.createTextNode("abc").splitText(-1)`

**Expected behavior**
Throws a `DOMexception`.

**Additional context**
I will prepare a PR.

Pull request description: #857@patch: Throw DOMException from Text.splitText.
fix #857 and unit tests for `Text.splittext`:
- the DOMException needs to be actually thrown
- missing check for negative index
- added unit test

Patch:
diff --git a/packages/happy-dom/src/nodes/text/Text.ts b/packages/happy-dom/src/nodes/text/Text.ts
index 19a8778f..51c10e67 100644
--- a/packages/happy-dom/src/nodes/text/Text.ts
+++ b/packages/happy-dom/src/nodes/text/Text.ts
@@ -43,15 +43,14 @@ export default class Text extends CharacterData implements IText {
 	 * Breaks the Text node into two nodes at the specified offset, keeping both nodes in the tree as siblings.
 	 *
 	 * @see https://dom.spec.whatwg.org/#dom-text-splittext
-	 * @see https://dom.spec.whatwg.org/#dom-text-splittext
 	 * @param offset Offset.
 	 * @returns New text node.
 	 */
 	public splitText(offset: number): IText {
 		const length = this._data.length;
 
-		if (offset > length) {
-			new DOMException(
+		if (offset < 0 || offset > length) {
+			throw new DOMException(
 				'The index is not in the allowed range.',
 				DOMExceptionNameEnum.indexSizeError
 			);


Test patch:
diff --git a/packages/happy-dom/test/nodes/text/Text.test.ts b/packages/happy-dom/test/nodes/text/Text.test.ts
index cf8bf9de..54df1a34 100644
--- a/packages/happy-dom/test/nodes/text/Text.test.ts
+++ b/packages/happy-dom/test/nodes/text/Text.test.ts
@@ -1,5 +1,7 @@
 import Window from '../../../src/window/Window';
 import Document from '../../../src/nodes/document/Document';
+import DOMException from '../../../src/exception/DOMException';
+import Text from '../../../src/nodes/text/Text';
 
 describe('Text', () => {
 	let window: Window;
@@ -17,6 +19,7 @@ describe('Text', () => {
 	describe('get nodeName()', () => {
 		it('Returns "#text".', () => {
 			const node = document.createTextNode('test');
+			expect(node).toBeInstanceOf(Text);
 			expect(node.nodeName).toBe('#text');
 		});
 	});
@@ -35,4 +38,22 @@ describe('Text', () => {
 			expect(clone.data).toBe(node.data);
 		});
 	});
+
+	describe('splitText()', () => {
+		it('Splits the text node.', () => {
+			const node = document.createTextNode('test');
+			document.body.append(node);
+			const result = node.splitText(2);
+			expect(node.textContent).toBe('te');
+			expect(result).toBeInstanceOf(Text);
+			expect(result.textContent).toBe('st');
+			expect(node.nextSibling).toBe(result);
+			expect(result.previousSibling).toBe(node);
+		});
+		it('Throws on invalid index.', () => {
+			const node = document.createTextNode('test');
+			expect(() => node.splitText(-1)).toThrow(DOMException);
+			expect(() => node.splitText(5)).toThrow(DOMException);
+		});
+	});
 });