nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: RobinTail/express-zod-api
Pull request #292 (2022-01-16 22:19:13)

Disabling X-Powered-By header
https://expressjs.com/en/advanced/best-practice-security.html


Patch:
diff --git a/src/server.ts b/src/server.ts
index 959a5f3f..845b114a 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -77,6 +77,7 @@ export function createServer(
     ? createLogger(config.logger)
     : config.logger;
   const app = express();
+  app.disable("x-powered-by");
   const errorHandler = config.errorHandler || defaultResultHandler;
   const compressor = config.server.compression
     ? compression({


Test patch:
diff --git a/tests/unit/server.spec.ts b/tests/unit/server.spec.ts
index cde8baab..55b29d97 100644
--- a/tests/unit/server.spec.ts
+++ b/tests/unit/server.spec.ts
@@ -3,6 +3,7 @@ import http from "http";
 let appMock: ReturnType<typeof newAppMock>;
 const expressJsonMock = jest.fn();
 const newAppMock = () => ({
+  disable: jest.fn(),
   use: jest.fn(),
   listen: jest.fn((port, cb) => {
     if (cb) {
@@ -84,6 +85,7 @@ describe("Server", () => {
       };
       createServer(configMock, routingMock);
       expect(appMock).toBeTruthy();
+      expect(appMock.disable).toHaveBeenCalledWith("x-powered-by");
       expect(appMock.use).toBeCalledTimes(3);
       expect(Array.isArray(appMock.use.mock.calls[0][0])).toBeTruthy();
       expect(appMock.use.mock.calls[0][0][0]).toBe(expressJsonMock);
Repository: RobinTail/express-zod-api
Pull request #298 (2022-01-23 16:14:04)

No uploads in response
`z.upload()` should not be used within output


Patch:
diff --git a/src/open-api-helpers.ts b/src/open-api-helpers.ts
index 231a485d..3044d34a 100644
--- a/src/open-api-helpers.ts
+++ b/src/open-api-helpers.ts
@@ -79,11 +79,19 @@ export const depictAny: DepictHelper<z.ZodAny> = ({ initial }) => ({
   format: "any",
 });
 
-export const depictUpload: DepictHelper<ZodUpload> = ({ initial }) => ({
-  ...initial,
-  type: "string",
-  format: "binary",
-});
+export const depictUpload: DepictHelper<ZodUpload> = ({
+  initial,
+  isResponse,
+}) => {
+  if (isResponse) {
+    throw new OpenAPIError("Please use z.upload() only for input.");
+  }
+  return {
+    ...initial,
+    type: "string",
+    format: "binary",
+  };
+};
 
 export const depictFile: DepictHelper<ZodFile> = ({
   schema: { isBinary, isBase64 },


Test patch:
diff --git a/tests/unit/__snapshots__/open-api-helpers.spec.ts.snap b/tests/unit/__snapshots__/open-api-helpers.spec.ts.snap
index b6d9ad68..5753bd68 100644
--- a/tests/unit/__snapshots__/open-api-helpers.spec.ts.snap
+++ b/tests/unit/__snapshots__/open-api-helpers.spec.ts.snap
@@ -511,6 +511,8 @@ Object {
 }
 `;
 
+exports[`Open API helpers depictUpload() should throw when using in response 1`] = `[Error: Please use z.upload() only for input.]`;
+
 exports[`Open API helpers excludeExampleFromDepiction() should remove example property of supplied object 1`] = `
 Object {
   "test": "some",
diff --git a/tests/unit/open-api-helpers.spec.ts b/tests/unit/open-api-helpers.spec.ts
index 5522fed7..0d9de539 100644
--- a/tests/unit/open-api-helpers.spec.ts
+++ b/tests/unit/open-api-helpers.spec.ts
@@ -130,6 +130,19 @@ describe("Open API helpers", () => {
         })
       ).toMatchSnapshot();
     });
+    test("should throw when using in response", () => {
+      try {
+        depictUpload({
+          schema: z.upload(),
+          isResponse: true,
+          initial: { description: "test" },
+        });
+        fail("Should not be here");
+      } catch (e) {
+        expect(e).toBeInstanceOf(OpenAPIError);
+        expect(e).toMatchSnapshot();
+      }
+    });
   });
 
   describe("depictFile()", () => {
Repository: vuejs/test-utils
Pull request #2231 (2023-11-03 15:28:39)

fix: wrapper.text method
### Summary

This change fixes wrapper.text to handle suspense components with multiple elements in a slot.
When suspense component had multiple elements in a slot, wrapper.text returned empty.


Patch:
diff --git a/src/baseWrapper.ts b/src/baseWrapper.ts
index a141d3a..71f074b 100644
--- a/src/baseWrapper.ts
+++ b/src/baseWrapper.ts
@@ -261,7 +261,7 @@ export default abstract class BaseWrapper<ElementType extends Node>
   }
 
   text() {
-    return textContent(this.element)
+    return this.getRootNodes().map(textContent).join('')
   }
 
   exists() {


Test patch:
diff --git a/tests/text.spec.ts b/tests/text.spec.ts
index a3a3338..05e58b3 100644
--- a/tests/text.spec.ts
+++ b/tests/text.spec.ts
@@ -1,5 +1,5 @@
 import { describe, expect, it } from 'vitest'
-import { defineComponent, h } from 'vue'
+import { defineComponent, h, Suspense } from 'vue'
 
 import { mount } from '../src'
 
@@ -93,4 +93,24 @@ describe('text', () => {
     const wrapper = mount(() => h(ReturnSlot, {}, () => h(MultiRootText)))
     expect(wrapper.text()).toBe('foobarbaz')
   })
+
+  it('returns correct text for suspense component has multiple elements in a slot', () => {
+    const wrapper = mount({
+      render: () =>
+        h(
+          Suspense,
+          {},
+          {
+            default: () =>
+              h(
+                defineComponent({
+                  template: `<!-- some comments --><div>Text content</div>`
+                })
+              )
+          }
+        )
+    })
+
+    expect(wrapper.text()).toBe('Text content')
+  })
 })
Repository: vuejs/vue-loader
Pull request #81 (2015-11-28 07:52:39)

Preserve line number for linters
<img width="871" alt="2015-11-28 2 44 54" src="https://cloud.githubusercontent.com/assets/1676871/11450769/fef7d14a-95de-11e5-8fdc-7a58f2ff6be6.png">

this PR will keep and comment all non-script source code in scripts output,
thus it will preserve line number and be friendly to linters(include file newLine ending).



Patch:
diff --git a/lib/parser.js b/lib/parser.js
index 8302fb4..4f4774a 100644
--- a/lib/parser.js
+++ b/lib/parser.js
@@ -70,16 +70,38 @@ module.exports = function (content) {
 
     var start = node.childNodes[0].__location.start
     var end = node.childNodes[node.childNodes.length - 1].__location.end
+
+    var result
+    if (type === 'script') {
+      result = commentScript(content.slice(0, start)) +
+              content.slice(start, end) +
+              commentScript(content.slice(end))
+    } else {
+      result = content.slice(start, end).trim()
+    }
+
     output[type].push({
       lang: lang,
       scoped: scoped,
-      content: content.substring(start, end).trim()
+      content: result
     })
   })
 
   cb(null, 'module.exports = ' + JSON.stringify(output))
 }
 
+function commentScript (content) {
+  return content.split(/\n\r|\n|\r/g)
+  .map(function (line) {
+    if (line.trim() === '') {
+      return line
+    } else {
+      return '// ' + line
+    }
+  })
+  .join('\n')
+}
+
 function getAttribute (node, name) {
   if (node.attrs) {
     var i = node.attrs.length


Test patch:
diff --git a/test/test.js b/test/test.js
index 2e52caf..781d35c 100644
--- a/test/test.js
+++ b/test/test.js
@@ -141,6 +141,7 @@ describe('vue-loader', function () {
       getFile('test.build.js.map', function (map) {
         var smc = new SourceMapConsumer(JSON.parse(map))
         getFile('test.build.js', function (code) {
+          console.log(code)
           var line
           code.split('\n').some(function (l, i) {
             if (l.indexOf('Hello from Component A') > -1) {
@@ -153,7 +154,7 @@ describe('vue-loader', function () {
             column: 0
           })
           expect(pos.source.indexOf('webpack:///test/fixtures/basic.vue') > -1)
-          expect(pos.line).to.equal(4)
+          expect(pos.line).to.equal(15)
           done()
         })
       })
Repository: vuejs/vue-loader
Pull request #811 (2017-05-13 06:10:12)

fix: extractCSS should only be applied to styles
fix https://github.com/Microsoft/TypeScript-Vue-Starter/pull/3

 If `extractCSS` is true, vue-loader will consult text extractor if loaders[lang] is not explicitly configured. This causes pug-loader and ts-loader malfunctions.

This PR makes extractCSS is only applied to styles.


Patch:
diff --git a/lib/loader.js b/lib/loader.js
index e584c22..72339c7 100644
--- a/lib/loader.js
+++ b/lib/loader.js
@@ -213,7 +213,7 @@ module.exports = function (content) {
       }
     }
 
-    var loader = options.extractCSS
+    var loader = options.extractCSS && type === 'styles'
       ? loaders[lang] || getCSSExtractLoader(lang)
       : loaders[lang]
 


Test patch:
diff --git a/test/test.js b/test/test.js
index 5b99899..2854fa6 100644
--- a/test/test.js
+++ b/test/test.js
@@ -166,6 +166,32 @@ describe('vue-loader', function () {
     })
   })
 
+  it('pre-processors with extract css', done => {
+    test({
+      entry: './test/fixtures/pre.vue',
+      vue: {
+        extractCSS: true
+      },
+      plugins: [
+        new ExtractTextPlugin('test.output.css')
+      ]
+    }, (window, module) => {
+      var vnode = mockRender(module)
+
+      expect(vnode.children[0].tag).to.equal('h1')
+      expect(vnode.children[1].tag).to.equal('comp-a')
+      expect(vnode.children[2].tag).to.equal('comp-b')
+
+      expect(module.data().msg).to.contain('Hello from coffee!')
+
+      var css = mfs.readFileSync('/test.output.css').toString()
+      css = normalizeNewline(css)
+      expect(css).to.contain('body {\n  font: 100% Helvetica, sans-serif;\n  color: #999;\n}')
+
+      done()
+    })
+  })
+
   it('scoped style', done => {
     test({
       entry: './test/fixtures/scoped-css.vue',
Repository: vuejs/vue-loader
Pull request #977 (2017-09-14 16:46:06)

add vue-template-compiler options passing for v12
related #976 


Patch:
diff --git a/lib/template-compiler/index.js b/lib/template-compiler/index.js
index d868bbb..53bcb4f 100644
--- a/lib/template-compiler/index.js
+++ b/lib/template-compiler/index.js
@@ -23,6 +23,7 @@ module.exports = function (html) {
   var compilerOptions = {
     preserveWhitespace: options.preserveWhitespace,
     modules: defaultModules.concat(userModules || []),
+    directives: vueOptions.compilerDirectives || options.compilerDirectives || {},
     scopeId: options.hasScoped ? options.id : null
   }
 


Test patch:
diff --git a/test/fixtures/custom-directive.vue b/test/fixtures/custom-directive.vue
new file mode 100644
index 0000000..b11d74e
--- /dev/null
+++ b/test/fixtures/custom-directive.vue
@@ -0,0 +1,3 @@
+<template>
+  <p v-i18n="keypath"></p>
+</template>
diff --git a/test/test.js b/test/test.js
index 369b699..c972f77 100644
--- a/test/test.js
+++ b/test/test.js
@@ -872,6 +872,29 @@ describe('vue-loader', function () {
     })
   })
 
+  it('custom compiler directives', done => {
+    test({
+      entry: './test/fixtures/custom-directive.vue',
+      vue: {
+        compilerDirectives: {
+          i18n (el, dir) {
+            if (dir.name === 'i18n' && dir.value) {
+              el.i18n = dir.value
+              if (!el.props) {
+                el.props = []
+              }
+              el.props.push({ name: 'textContent', value: `_s(${JSON.stringify(dir.value)})` })
+            }
+          }
+        }
+      }
+    }, (window, module) => {
+      var vnode = mockRender(module)
+      expect(vnode.data.domProps.textContent).to.equal('keypath')
+      done()
+    })
+  })
+
   it('functional component with styles', done => {
     test({
       entry: './test/fixtures/functional-style.vue'
Repository: reubeno/brush
Pull request #371 (2025-02-01 07:14:33)

fix(builtins): fix read builtin ignoring tab chars
Some ASCII whitespace characters (e.g., `\t`) are also considered control characters. Don't ignore *all* of them in `read`.


Patch:
diff --git a/brush-core/src/builtins/read.rs b/brush-core/src/builtins/read.rs
index 9c0df04..ab4f6a5 100644
--- a/brush-core/src/builtins/read.rs
+++ b/brush-core/src/builtins/read.rs
@@ -219,7 +219,7 @@ impl ReadCommand {
             }
 
             // Ignore other control characters without including them in the input.
-            if ch.is_ascii_control() {
+            if ch.is_ascii_control() && !ch.is_ascii_whitespace() {
                 continue;
             }
 


Test patch:
diff --git a/brush-shell/tests/cases/builtins/read.yaml b/brush-shell/tests/cases/builtins/read.yaml
index 60dac4f..42a4e36 100644
--- a/brush-shell/tests/cases/builtins/read.yaml
+++ b/brush-shell/tests/cases/builtins/read.yaml
@@ -36,3 +36,9 @@ cases:
       while IFS= read line; do
           echo "LINE: '$line'"
       done <<<"${content}"
+
+  - name: "read text with tabs and custom IFS"
+    stdin: |
+      while IFS="" read myvar; do
+          echo "myvar1: |${myvar}|"
+      done < <(printf "a\tb\nc d\te\n")
Repository: reubeno/brush
Pull request #480 (2025-05-09 16:27:31)

test: add compat test for $_ (not yet passing)
This captures the issue described by #479. Once the test passes we can close out that issue.


Patch:
diff --git a/brush-core/src/shell.rs b/brush-core/src/shell.rs
index 07fac2f..4b286ec 100644
--- a/brush-core/src/shell.rs
+++ b/brush-core/src/shell.rs
@@ -258,7 +258,7 @@ impl Shell {
             }
         }
 
-        // TODO(vars): implement $_
+        // TODO(#479): implement $_
 
         // BASH
         if let Some(shell_name) = &options.shell_name {


Test patch:
diff --git a/brush-shell/tests/cases/well_known_vars.yaml b/brush-shell/tests/cases/well_known_vars.yaml
index 9e9e568..0a76bf9 100644
--- a/brush-shell/tests/cases/well_known_vars.yaml
+++ b/brush-shell/tests/cases/well_known_vars.yaml
@@ -30,6 +30,23 @@ cases:
       [[ $MACHTYPE == ${BASH_VERSINFO[5]} ]]
       echo 'MACHTYPE == ${BASH_VERSINFO[5]: ' $?
 
+  - name: "dollar-_"
+    known_failure: true # Issue #479
+    stdin: |
+      # Check on start
+      [[ "$0" == "$_" ]] && echo '$_ matches $0 on start'
+
+      # Now do something
+      echo first middle last >/dev/null
+      echo "\$_ after first echo command: $_"
+      echo
+      echo "\$_ after second echo command: $_"
+
+      # See if a child process sees a changed $_ and which token they see
+      echo "Spawning child process..."
+      env -v | grep '^_='
+      echo "\$_ after child process exited: $_"
+
   - name: "BASH_ALIASES"
     stdin: |
       echo "Initial BASH_ALIASES: " ${BASH_ALIASES[@]}