diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4f106756..ff1c20a1a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,18 +14,20 @@ jobs: - node-version: 10.x test-on-old-node: 1 - node-version: 12.x + test-on-old-node: 1 # test-on-brower: 1 - node-version: 14.x - node-version: 16.x + - node-version: 18.x steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install Node - ${{ matrix.node-version }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - name: Cache node modules - uses: actions/cache@v2 + uses: actions/cache@v3 env: cache-name: cache-node-modules with: @@ -58,3 +60,5 @@ jobs: - name: Coverage On Node ${{ matrix.node-version }} run: npm run coverage + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 diff --git a/README.md b/README.md index e3f5f414d..d2305a460 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # superagent [![build status](https://img.shields.io/travis/visionmedia/superagent.svg)](https://travis-ci.org/visionmedia/superagent) +[![code coverage](https://img.shields.io/codecov/c/github/visionmedia/superagent.svg)](https://codecov.io/gh/visionmedia/superagent) [![code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo) [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![made with lass](https://img.shields.io/badge/made_with-lass-95CC28.svg)](https://lass.js.org) diff --git a/ci/remove-deps-4-old-node.js b/ci/remove-deps-4-old-node.js index 2a598bca7..4cf9deefe 100644 --- a/ci/remove-deps-4-old-node.js +++ b/ci/remove-deps-4-old-node.js @@ -11,6 +11,7 @@ const UNSUPPORT_DEPS_4_OLD = new Set([ 'eslint-plugin-node', 'husky', 'lint-staged', + 'marked', 'remark-cli', 'remark-preset-github', 'xo' diff --git a/package.json b/package.json index d3c122a34..ef9660c68 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "husky": "7", "lint-staged": "12", "marked": "^4.1.0", - "mocha": "6.2.2", + "mocha": "^6.2.3", "multer": "1.4.5-lts.1", "nyc": "^15.1.0", "remark-cli": "^11.0.0", @@ -122,6 +122,7 @@ "build:dist": "npm run browserify && npm run minify", "build:lib": "babel --config-file ./.lib.babelrc src --out-dir lib", "build:test": "babel --config-file ./.test.babelrc test --out-dir lib/node/test", + "coverage": "nyc report --reporter=text-lcov > coverage.lcov", "lint": "eslint -c .eslintrc src test && remark . -qfo && eslint -c .lib.eslintrc lib/**/*.js && eslint -c .dist.eslintrc dist/**/*.js", "minify": "cross-env NODE_ENV=production browserify src/node/index.js -o dist/superagent.min.js -s superagent -g [ babelify --configFile ./.dist.babelrc ] -p tinyify", "nyc": "cross-env NODE_ENV=test nyc ava", diff --git a/test/node/query.js b/test/node/query.js index ec614a35b..dfa0efd75 100644 --- a/test/node/query.js +++ b/test/node/query.js @@ -200,8 +200,7 @@ describe('req.query(Object)', () => { }); }); - it('query-string should be sent on pipe', function (done) { - this.timeout(15_000); + it('query-string should be sent on pipe', (done) => { const request_ = request.put(`${base}/?name=tobi`); const stream = fs.createReadStream('test/node/fixtures/user.json'); @@ -213,9 +212,16 @@ describe('req.query(Object)', () => { done(err); }); - stream.on('error', function (err) { + stream.on('error', (err) => { done(err); }); - stream.pipe(request_); + + // wait until stream is valid before piping + stream.on('open', () => { + // wait until request_ is ready before piping + setTimeout(() => { + stream.pipe(request_); + }, 10); + }); }); });