nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: webpack/enhanced-resolve
Pull request #275 (2021-01-11 11:25:12)

improve github actions configuration


Patch:
diff --git a/package.json b/package.json
index bcc76bb..4aa0538 100644
--- a/package.json
+++ b/package.json
@@ -52,10 +52,10 @@
     "pretty": "prettier --loglevel warn --write \"lib/**/*.{js,json}\" \"test/*.js\"",
     "pretest": "yarn lint",
     "test": "mocha --full-trace --check-leaks",
+    "test:only": "mocha --full-trace --check-leaks",
     "precover": "yarn lint",
-    "cover": "nyc --reporter=html node node_modules/mocha/bin/_mocha",
-    "pretravis": "yarn lint",
-    "travis": "nyc --reporter=lcovonly node node_modules/mocha/bin/_mocha"
+    "cover": "nyc --reporter=html node node_modules/mocha/bin/_mocha --full-trace --check-leaks",
+    "cover:ci": "nyc --reporter=lcovonly node node_modules/mocha/bin/_mocha --full-trace --check-leaks"
   },
   "husky": {
     "hooks": {


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 633ba42..b8b6bb1 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -2,21 +2,35 @@ name: Test
 
 on:
   push:
-    branches: [ master ]
+    branches: [master]
   pull_request:
-    branches: [ master ]
+    branches: [master]
 
 jobs:
-  build:
+  lint:
     runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - name: Use Node.js
+        uses: actions/setup-node@v1
+        with:
+          node-version: 14.x
+      - run: yarn --frozen-lockfile
+      - run: yarn lint
+  test:
     strategy:
+      fail-fast: false
       matrix:
+        os: [ubuntu-latest, windows-latest, macos-latest]
         node-version: [10.x, 12.x, 14.x]
+    runs-on: ${{ matrix.os }}
     steps:
-    - uses: actions/checkout@v2
-    - name: Use Node.js ${{ matrix.node-version }}
-      uses: actions/setup-node@v1
-      with:
-        node-version: ${{ matrix.node-version }}
-    - run: yarn --frozen-lockfile
-    - run: yarn test
+      - uses: actions/checkout@v2
+      - name: Use Node.js ${{ matrix.node-version }}
+        uses: actions/setup-node@v1
+        with:
+          node-version: ${{ matrix.node-version }}
+      - run: yarn --frozen-lockfile
+      - run: yarn cover:ci
+      - if: ${{ matrix.os != 'windows-latest' }}
+        run: bash <(curl -s https://codecov.io/bash) -X gcov
Repository: webpack/enhanced-resolve
Pull request #285 (2021-02-10 07:28:57)

feature: enforceExtension when extensions contain empty string
enforceExtension should default to true when extensions contain empty string

requested by @sokra to complement webpack pull request:
feat: accept empty string in config.resolve.extensions
https://github.com/webpack/webpack/pull/12613

- tests added
- no conflict with existing tests
- no conflict with webpack


Patch:
diff --git a/lib/ResolverFactory.js b/lib/ResolverFactory.js
index 3f12653..3a9c7ee 100644
--- a/lib/ResolverFactory.js
+++ b/lib/ResolverFactory.js
@@ -190,7 +190,12 @@ function createOptions(options) {
 		descriptionFiles: Array.from(
 			new Set(options.descriptionFiles || ["package.json"])
 		),
-		enforceExtension: options.enforceExtension || false,
+		enforceExtension:
+			options.enforceExtension === undefined
+				? options.extensions && options.extensions.includes("")
+					? true
+					: false
+				: options.enforceExtension,
 		extensions: new Set(options.extensions || [".js", ".json", ".node"]),
 		fileSystem: options.useSyncFileSystemCalls
 			? new SyncAsyncFileSystemDecorator(


Test patch:
diff --git a/test/extensions.js b/test/extensions.js
index dde8659..4963f35 100644
--- a/test/extensions.js
+++ b/test/extensions.js
@@ -11,6 +11,17 @@ const resolver = ResolverFactory.createResolver({
 	fileSystem: nodeFileSystem
 });
 
+const resolver2 = ResolverFactory.createResolver({
+	extensions: [".ts", "", ".js"],
+	fileSystem: nodeFileSystem
+});
+
+const resolver3 = ResolverFactory.createResolver({
+	extensions: [".ts", "", ".js"],
+	enforceExtension: false,
+	fileSystem: nodeFileSystem
+});
+
 const fixture = path.resolve(__dirname, "fixtures", "extensions");
 
 describe("extensions", function () {
@@ -70,4 +81,18 @@ describe("extensions", function () {
 			done();
 		});
 	});
+	it("should default enforceExtension to true when extensions includes an empty string", function (done) {
+		const missingDependencies = new Set();
+		resolver2.resolve({}, fixture, "./foo", { missingDependencies }, () => {
+			missingDependencies.should.not.containEql(path.resolve(fixture, "foo"));
+			done();
+		});
+	});
+	it("should respect enforceExtension when extensions includes an empty string", function (done) {
+		const missingDependencies = new Set();
+		resolver3.resolve({}, fixture, "./foo", { missingDependencies }, () => {
+			missingDependencies.should.containEql(path.resolve(fixture, "foo"));
+			done();
+		});
+	});
 });
Repository: busyorg/busy
Pull request #712 (2017-09-07 12:33:15)

Add replacement for features not ready
This PR add to steemd.com for "activity", open steemit.com for user wallet and google for a search.


Patch:
diff --git a/src/Wrapper.js b/src/Wrapper.js
index 995f8539..aaf7f186 100644
--- a/src/Wrapper.js
+++ b/src/Wrapper.js
@@ -66,7 +66,7 @@ export default class Wrapper extends React.PureComponent {
         this.props.logout();
         break;
       case 'activity':
-        this.props.history.push('#activity');
+        window.open(`https://steemd.com/@${this.props.user.name}`);
         break;
       case 'bookmarks':
         this.props.history.push('/bookmarks');
diff --git a/src/components/Navigation/Sidenav.js b/src/components/Navigation/Sidenav.js
index a3bcff77..ceec9a0b 100644
--- a/src/components/Navigation/Sidenav.js
+++ b/src/components/Navigation/Sidenav.js
@@ -29,10 +29,10 @@ const Sidenav = ({ username }) =>
           </NavLink>
         </li>
         <li>
-          <NavLink to="#wallet" activeClassName="Sidenav__item--active">
+          <a target="_blank" rel="noopener noreferrer" href={`https://steemit.com/@${username}/transfers`}>
             <i className="iconfont icon-wallet" />
             <FormattedMessage id="wallet" defaultMessage="Wallet" />
-          </NavLink>
+          </a>
         </li>
       </ul>}
   </div>);
diff --git a/src/components/Navigation/Topnav.js b/src/components/Navigation/Topnav.js
index f83f2506..176aa195 100644
--- a/src/components/Navigation/Topnav.js
+++ b/src/components/Navigation/Topnav.js
@@ -129,7 +129,10 @@ const Topnav = ({
         </div>
         <div className="center">
           <div className="Topnav__input-container">
-            <Input placeholder={intl.formatMessage({ id: 'search_placeholder', defaultMessage: 'Search...' })} />
+            <Input
+              onPressEnter={event => window.open(`https://www.google.com/search?q=${encodeURIComponent(`steemit:${event.target.value}`)}`)}
+              placeholder={intl.formatMessage({ id: 'search_placeholder', defaultMessage: 'Search...' })}
+            />
             <i className="iconfont icon-search" />
           </div>
         </div>


Test patch:
diff --git a/src/stories/__snapshots__/stories.test.js.snap b/src/stories/__snapshots__/stories.test.js.snap
index cb751030..0d25157e 100644
--- a/src/stories/__snapshots__/stories.test.js.snap
+++ b/src/stories/__snapshots__/stories.test.js.snap
@@ -664,11 +664,9 @@ exports[`Storyshots Navigation Sidenav logged 1`] = `
       </li>
       <li>
         <a
-          aria-current={false}
-          className={undefined}
-          href="#wallet"
-          onClick={[Function]}
-          style={undefined}
+          href="https://steemit.com/@guest123/transfers"
+          rel="noopener noreferrer"
+          target="_blank"
         >
           <i
             className="iconfont icon-wallet"
Repository: busyorg/busy
Pull request #792 (2017-10-13 20:54:01)

Accept only images for file upload
https://trello.com/c/4LvkIGOs/321-upload-image-should-show-only-image-to-browse


Patch:
diff --git a/src/components/Comments/CommentForm.js b/src/components/Comments/CommentForm.js
index 190b6160..7ae54baa 100644
--- a/src/components/Comments/CommentForm.js
+++ b/src/components/Comments/CommentForm.js
@@ -210,6 +210,7 @@ class CommentForm extends React.Component {
           <p className="CommentForm__imagebox">
             <input
               type="file"
+              accept="image/*"
               id={`inputfile${this.props.parentPost.id}`}
               onChange={this.handleImageChange}
             />
diff --git a/src/components/Comments/EmbeddedCommentForm.js b/src/components/Comments/EmbeddedCommentForm.js
index 30ee9de5..0995a7e9 100644
--- a/src/components/Comments/EmbeddedCommentForm.js
+++ b/src/components/Comments/EmbeddedCommentForm.js
@@ -200,6 +200,7 @@ class EmbeddedCommentForm extends React.Component {
         <p className="EmbeddedCommentForm__imagebox">
           <input
             type="file"
+            accept="image/*"
             id={`inputfile-edit${this.props.parentPost.id}`}
             onChange={this.handleImageChange}
           />
diff --git a/src/components/Editor/Editor.js b/src/components/Editor/Editor.js
index 6f855b7a..e3b62858 100644
--- a/src/components/Editor/Editor.js
+++ b/src/components/Editor/Editor.js
@@ -526,7 +526,7 @@ class Editor extends React.Component {
             </Dropzone>
           </div>
           <p className="Editor__imagebox">
-            <input type="file" id="inputfile" onChange={this.handleImageChange} />
+            <input type="file" id="inputfile" accept="image/*" onChange={this.handleImageChange} />
             <label htmlFor="inputfile">
               {this.state.imageUploading ? (
                 <Icon type="loading" />


Test patch:
diff --git a/src/stories/__snapshots__/stories.test.js.snap b/src/stories/__snapshots__/stories.test.js.snap
index 8c28b53a..f8ae6c1f 100644
--- a/src/stories/__snapshots__/stories.test.js.snap
+++ b/src/stories/__snapshots__/stories.test.js.snap
@@ -432,6 +432,7 @@ exports[`Storyshots Editor Editor 1`] = `
             className="Editor__imagebox"
           >
             <input
+              accept="image/*"
               id="inputfile"
               onChange={[Function]}
               type="file"
Repository: busyorg/busy
Pull request #793 (2017-10-13 21:47:12)

Add beta text
![image](https://user-images.githubusercontent.com/1968722/31567638-ccfbb9aa-b070-11e7-8aa9-8a16eef7e78b.png)
https://trello.com/c/MqwRi6zT/327-add-beta-text-next-to-logo


Patch:
diff --git a/src/components/Navigation/Topnav.js b/src/components/Navigation/Topnav.js
index f7b8e27e..e924f81d 100644
--- a/src/components/Navigation/Topnav.js
+++ b/src/components/Navigation/Topnav.js
@@ -132,6 +132,9 @@ const Topnav = ({
           <Link className="Topnav__brand" to="/">
             busy
           </Link>
+          <span className="Topnav__version">
+            beta
+          </span>
         </div>
         <div className="center">
           <div className="Topnav__input-container">
diff --git a/src/components/Navigation/Topnav.less b/src/components/Navigation/Topnav.less
index bc1befd7..8b2eb600 100644
--- a/src/components/Navigation/Topnav.less
+++ b/src/components/Navigation/Topnav.less
@@ -22,6 +22,12 @@
     }
   }
 
+  &__version {
+    margin-left: 2px;
+    color: #99aab5;
+    font-weight: 500;
+  }
+
   &__container {
     display: flex;
     justify-content: space-around;
@@ -41,7 +47,8 @@
       border: 0 !important;
       padding: 0 0 0 43px !important;
 
-      &:hover, &:focus {
+      &:hover,
+      &:focus {
         box-shadow: none !important;
         border-color: #e9e7e7 !important;
       }


Test patch:
diff --git a/src/stories/__snapshots__/stories.test.js.snap b/src/stories/__snapshots__/stories.test.js.snap
index f8ae6c1f..b437ec11 100644
--- a/src/stories/__snapshots__/stories.test.js.snap
+++ b/src/stories/__snapshots__/stories.test.js.snap
@@ -712,6 +712,11 @@ exports[`Storyshots Navigation Topnav logged 1`] = `
         >
           busy
         </a>
+        <span
+          className="Topnav__version"
+        >
+          beta
+        </span>
       </div>
       <div
         className="center"
@@ -896,6 +901,11 @@ exports[`Storyshots Navigation Topnav unlogged 1`] = `
         >
           busy
         </a>
+        <span
+          className="Topnav__version"
+        >
+          beta
+        </span>
       </div>
       <div
         className="center"
Repository: buxlabs/boxwood
Pull request #667 (2020-11-28 21:01:37)

Fixed style tag optimization bug


Patch:
diff --git a/src/plugins/DataPlugin.js b/src/plugins/DataPlugin.js
index d11b047..d133ea7 100644
--- a/src/plugins/DataPlugin.js
+++ b/src/plugins/DataPlugin.js
@@ -3,6 +3,7 @@ const { parseData, getDataFormat } = require('../utilities/data')
 const { isPlainObject } = require('pure-conditions')
 const { optimizeNode } = require('../utilities/optimize')
 const { createTranslationError } = require('../utilities/errors')
+const CODE_TAGS = ['style', 'script']
 
 class DataPlugin extends Plugin {
   beforeprerun () {
@@ -32,7 +33,14 @@ class DataPlugin extends Plugin {
         errors.push(createTranslationError('Data tag must specify a format (js, json or yaml).', stack))
       }
     }
-    if (this.variables.length > 0) {
+
+    if (CODE_TAGS.includes(tag)) {
+      fragment.children.forEach(node => {
+        node.skipDataOptimization = true
+      })
+    }
+
+    if (this.variables.length > 0 && !fragment.skipDataOptimization) {
       optimizeNode(fragment, this.variables, [], true)
     }
   }


Test patch:
diff --git a/test/spec/tags/style.spec.js b/test/spec/tags/style.spec.js
index 0c39727..a9fce81 100644
--- a/test/spec/tags/style.spec.js
+++ b/test/spec/tags/style.spec.js
@@ -236,7 +236,7 @@ test('style: does not produce errors for an imported component', async assert =>
   assert.deepEqual(warnings, [])
 })
 
-test.skip('style: does not produce errors when data tag is present', async assert => {
+test('style: does not produce errors when data tag is present', async assert => {
   const { errors, warnings } = await compile(`
     <import link from="components/link.html"/>
     <import layout from='layouts/default.html'/>
Repository: busyorg/busy
Pull request #2226 (2019-08-25 14:59:36)

initial vp setting
1. try to load vp setting when login. likely fail, then reload is needed
2. default setting => slider is on.


Patch:
diff --git a/src/client/settings/settingsReducer.js b/src/client/settings/settingsReducer.js
index 82efa014..5ce3537e 100644
--- a/src/client/settings/settingsReducer.js
+++ b/src/client/settings/settingsReducer.js
@@ -1,10 +1,11 @@
 import * as settingsTypes from './settingsActions';
 import * as authTypes from '../auth/authActions';
 import { rewardsValues } from '../../common/constants/rewards';
+import { USER_METADATA_KEY } from '../helpers/constants';
 
 const initialState = {
   locale: 'auto',
-  votingPower: 'auto',
+  votingPower: 'on', // due to initial voting setting loading problem, set to on.
   votePercent: 10000,
   showNSFWPosts: false,
   nightmode: false,
@@ -18,6 +19,37 @@ const initialState = {
 const settings = (state = initialState, action) => {
   switch (action.type) {
     case authTypes.LOGIN_SUCCESS:
+      try {
+        const {
+          locale,
+          votingPower,
+          votePercent,
+          showNSFWPosts,
+          nightmode,
+          rewriteLinks,
+          exitPageSetting,
+          rewardSetting,
+          useBeta,
+        } = JSON.parse(localStorage.getItem(USER_METADATA_KEY)).settings;
+        return {
+          ...state,
+          locale: locale || initialState.locale,
+          votingPower: votingPower || initialState.votingPower,
+          votePercent: votePercent || initialState.votePercent,
+          showNSFWPosts: showNSFWPosts || initialState.showNSFWPosts,
+          nightmode: nightmode || initialState.nightmode,
+          rewriteLinks:
+            typeof rewriteLinks === 'boolean' ? rewriteLinks : initialState.rewriteLinks,
+          exitPageSetting:
+            typeof exitPageSetting === 'boolean' ? exitPageSetting : initialState.exitPageSetting,
+          rewardSetting: rewardSetting || initialState.rewardSetting,
+          useBeta: typeof useBeta === 'boolean' ? useBeta : initialState.useBeta,
+        };
+      } catch (error) {
+        // this is due to localStorage hasn't been ready. Can be ignored. but reload is needed for VP settings.
+        console.log(error);
+        return state;
+      }
     case authTypes.RELOAD_SUCCESS:
       if (action.meta && action.meta.refresh) return state;
       if (action.payload && action.payload.settings) {


Test patch:
diff --git a/src/client/settings/__tests__/settingsReducer.js b/src/client/settings/__tests__/settingsReducer.js
index 27cde171..00a5f9ab 100644
--- a/src/client/settings/__tests__/settingsReducer.js
+++ b/src/client/settings/__tests__/settingsReducer.js
@@ -7,7 +7,7 @@ import { rewardsValues } from '../../../common/constants/rewards';
 describe('settingsReducer', () => {
   const initialState = {
     locale: 'auto',
-    votingPower: 'auto',
+    votingPower: 'on',
     votePercent: 10000,
     loading: false,
     showNSFWPosts: false,
Repository: mcollina/autocannon
Pull request #96 (2016-11-16 15:22:51)

Added all http methods/verbs
I listed them in the order they're presented here: https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Summary_table


Patch:
diff --git a/lib/httpMethods.js b/lib/httpMethods.js
new file mode 100644
index 0000000..b9b34e6
--- /dev/null
+++ b/lib/httpMethods.js
@@ -0,0 +1,13 @@
+// most http methods taken from RFC 7231
+// PATCH is defined in RFC 5789
+module.exports = [
+  'GET',
+  'HEAD',
+  'POST',
+  'PUT',
+  'DELETE',
+  'CONNECT',
+  'OPTIONS',
+  'TRACE',
+  'PATCH'
+]
diff --git a/lib/httpRequestBuilder.js b/lib/httpRequestBuilder.js
index cc53f16..f189161 100644
--- a/lib/httpRequestBuilder.js
+++ b/lib/httpRequestBuilder.js
@@ -1,14 +1,7 @@
 'use strict'
 
 const xtend = require('xtend')
-
-const methods = [
-  'GET',
-  'DELETE',
-  'POST',
-  'PUT',
-  'PATCH'
-]
+const methods = require('./httpMethods')
 
 // this is a build request factory, that curries the build request function
 // and sets the default for it


Test patch:
diff --git a/test/httpClient.test.js b/test/httpClient.test.js
index 04509d9..a87971d 100644
--- a/test/httpClient.test.js
+++ b/test/httpClient.test.js
@@ -125,15 +125,6 @@ test('client supports response trailers', (t) => {
   })
 })
 
-test('client does not supports HEAD', (t) => {
-  t.plan(1)
-
-  const opts = server.address()
-  opts.method = 'HEAD'
-
-  t.throws(() => new Client(opts))
-})
-
 test('client supports sending a body', (t) => {
   t.plan(4)
 
diff --git a/test/httpRequestBuilder.test.js b/test/httpRequestBuilder.test.js
index 777871d..d3f20be 100644
--- a/test/httpRequestBuilder.test.js
+++ b/test/httpRequestBuilder.test.js
@@ -4,6 +4,7 @@ const test = require('tap').test
 const helper = require('./helper')
 const server = helper.startServer()
 const RequestBuilder = require('../lib/httpRequestBuilder')
+const httpMethods = require('../lib/httpMethods')
 
 test('request builder should create a request with sensible defaults', (t) => {
   t.plan(1)
@@ -54,5 +55,17 @@ test('request builder should throw on unknown http method', (t) => {
 
   const build = RequestBuilder(opts)
 
-  t.throws(() => build({method: 'HEAD'}))
+  t.throws(() => build({method: 'UNKNOWN'}))
+})
+
+test('request builder should accept all valid standard http methods', (t) => {
+  t.plan(httpMethods.length)
+  httpMethods.forEach((method) => {
+    const opts = server.address()
+
+    const build = RequestBuilder(opts)
+
+    t.doesNotThrow(() => build({method: method}), `${method} should be usable by the request builded`)
+  })
+  t.end()
 })
Repository: mcollina/autocannon
Pull request #364 (2021-05-05 04:19:43)

fix: use headers from requests if any
This PR aims to fix a behavior expected in https://github.com/rafaelGSS/autobench#config-file by specifying `headers` inside `opts.requests`.

Currently, the lib isn't using `request[index].headers` in the requests, this PR should solve it.

RafaelGSS: I removed a duplicated test made by me. Sorry.

Patch:
diff --git a/lib/requestIterator.js b/lib/requestIterator.js
index 0a1c4eb..1402dbd 100644
--- a/lib/requestIterator.js
+++ b/lib/requestIterator.js
@@ -88,7 +88,7 @@ RequestIterator.prototype.rebuildRequest = function () {
   let data
   this.resetted = false
   if (this.currentRequest) {
-    this.currentRequest.headers = this.headers
+    this.currentRequest.headers = this.currentRequest.headers || this.headers
     data = this.requestBuilder(this.currentRequest, this.context)
     if (data) {
       this.currentRequest.requestBuffer = this.reqDefaults.idReplacement


Test patch:
diff --git a/test/httpClient.test.js b/test/httpClient.test.js
index 5f33eac..e1d663f 100644
--- a/test/httpClient.test.js
+++ b/test/httpClient.test.js
@@ -287,6 +287,34 @@ test('client supports custom headers', (t) => {
   })
 })
 
+test('client supports custom headers in requests', (t) => {
+  t.plan(2)
+
+  const opts = server.address()
+  opts.requests = [
+    {
+      path: '/',
+      method: 'POST',
+      headers: {
+        'content-type': 'application/json'
+      },
+      body: JSON.stringify({
+        foo: 'example'
+      })
+    }
+  ]
+  const client = new Client(opts)
+
+  server.once('request', (req, res) => {
+    t.equal(req.headers['content-type'], 'application/json', 'custom header matches')
+  })
+
+  client.on('response', (statusCode, length) => {
+    t.equal(statusCode, 200, 'status code matches')
+    client.destroy()
+  })
+})
+
 test('client supports host custom header', (t) => {
   t.plan(2)
 
diff --git a/test/requestIterator.test.js b/test/requestIterator.test.js
index fac1860..e35e04f 100644
--- a/test/requestIterator.test.js
+++ b/test/requestIterator.test.js
@@ -44,6 +44,35 @@ test('request iterator should create requests with overwritten defaults', (t) =>
     'request is okay')
 })
 
+test('request iterator should use headers from requests', (t) => {
+  t.plan(2)
+
+  const opts = server.address()
+  opts.requests = [
+    {
+      path: '/',
+      method: 'POST',
+      headers: {
+        'content-type': 'application/json'
+      },
+      body: JSON.stringify({ foo: 'bar' })
+    },
+    {
+      path: '/2',
+      method: 'POST',
+      headers: {
+        'content-type': 'text/html'
+      },
+      body: JSON.stringify({ foo: 'bar' })
+    }
+  ]
+  const iterator = new RequestIterator(opts)
+
+  t.same(iterator.currentRequest.headers['content-type'], 'application/json')
+  iterator.nextRequest()
+  t.same(iterator.currentRequest.headers['content-type'], 'text/html')
+})
+
 test('request iterator should create requests with overwritten defaults', (t) => {
   t.plan(3)