diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 4d579f4..4b0c095 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -7,8 +7,6 @@ on: pull_request: branches: [ master ] - workflow_dispatch: {} - jobs: Job: name: Node.js diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 64a499b..1c6cbb1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,8 +4,6 @@ on: push: branches: [ master ] - workflow_dispatch: {} - jobs: release: name: Node.js @@ -13,5 +11,3 @@ jobs: secrets: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} GIT_TOKEN: ${{ secrets.GIT_TOKEN }} - with: - checkTest: false diff --git a/package.json b/package.json index 961c9e7..b64d111 100644 --- a/package.json +++ b/package.json @@ -5,12 +5,13 @@ "main": "index.js", "scripts": { "contributor": "git-contributor", - "ts-test": "tsc -p ./test/fixtures/types/tsconfig.json", - "test": "egg-bin test --ts false && npm run ts-test", + "test:ts": "tsc -p ./test/fixtures/types/tsconfig.json", + "test:js": "egg-bin test --ts false", + "test": "npm run test:js && npm run test:ts", "cov": "egg-bin cov --ts false", "lint-fix": "eslint . --fix", "lint": "eslint .", - "ci": "npm run lint && npm run ts-test && npm run cov" + "ci": "npm run lint && npm run test:ts && npm run cov" }, "repository": { "type": "git", diff --git a/test/gzip/file_stream.test.js b/test/gzip/file_stream.test.js index 38a36c1..6a00e80 100644 --- a/test/gzip/file_stream.test.js +++ b/test/gzip/file_stream.test.js @@ -1,5 +1,3 @@ -'use strict'; - const fs = require('fs'); const os = require('os'); const path = require('path'); @@ -36,6 +34,19 @@ describe('test/gzip/file_stream.test.js', () => { }); }); + it('should compress file into Buffer', async () => { + const sourceFile = path.join(__dirname, '..', 'fixtures', 'xx.log'); + const gzipStream = new compressing.gzip.FileStream({ source: sourceFile }); + const gzipChunks = []; + for await (const chunk of gzipStream) { + gzipChunks.push(chunk); + } + + const destFile = path.join(os.tmpdir(), uuid.v4() + '.log.gz'); + await fs.promises.writeFile(destFile, Buffer.concat(gzipChunks)); + console.log(destFile); + }); + it('should compress buffer', done => { const sourceFile = path.join(__dirname, '..', 'fixtures', 'xx.log'); const sourceBuffer = fs.readFileSync(sourceFile);