From 6c82e70af99d54938cfbe3b6bcc6c32e1a580703 Mon Sep 17 00:00:00 2001 From: Matthew Mallimo Date: Tue, 25 Jan 2022 16:08:54 -0500 Subject: [PATCH] fix(node): fix node versions. Fix issue with node16 --- .github/workflows/release.yml | 2 +- .github/workflows/tests.yml | 2 +- __tests__/html-report-creator.spec.js | 21 ++++++--------------- html-report-creator.js | 11 ++++++++++- package.json | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a2aacb5..195f069 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v1 with: - node-version: 12 + node-version: 16 - name: Install dependencies run: npm ci - name: Release diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a8e3805..30d59e7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: [ '10.x', '12.x', '14.x' ] + node: [ '12.x', '14.x', '16.x' ] name: Node ${{ matrix.node }} steps: - uses: actions/checkout@v2 diff --git a/__tests__/html-report-creator.spec.js b/__tests__/html-report-creator.spec.js index 329bfe8..babb8c2 100644 --- a/__tests__/html-report-creator.spec.js +++ b/__tests__/html-report-creator.spec.js @@ -16,15 +16,6 @@ const merge = require('lodash/merge'); const mkdirp = require('mkdirp'); const fs = require('fs'); -function prettyPrintHtml(rawHtml) { - return rawHtml.end({ - pretty: true, - indent: ' ', - newline: '\n', - allowEmpty: false, - }); -} - function buildMockResult(mockResult = {}) { const defaultMockResult = { numFailedTestSuites: 0, @@ -97,7 +88,7 @@ describe('html-report-creator', () => { createHtmlReport(mockResult); expect( - prettyPrintHtml(fs.writeFileSync.mock.calls[0][1]) + fs.writeFileSync.mock.calls[0][1] ).toMatchSnapshot(); }); @@ -119,7 +110,7 @@ describe('html-report-creator', () => { createHtmlReport(mockResult); expect( - prettyPrintHtml(fs.writeFileSync.mock.calls[0][1]) + fs.writeFileSync.mock.calls[0][1] ).toMatchSnapshot(); }); @@ -129,7 +120,7 @@ describe('html-report-creator', () => { createHtmlReport(mockResult); expect( - prettyPrintHtml(fs.writeFileSync.mock.calls[0][1]) + fs.writeFileSync.mock.calls[0][1] ).toMatchSnapshot(); }); @@ -151,7 +142,7 @@ describe('html-report-creator', () => { createHtmlReport(mockResult); expect( - prettyPrintHtml(fs.writeFileSync.mock.calls[0][1]) + fs.writeFileSync.mock.calls[0][1] ).toMatchSnapshot(); }); @@ -173,7 +164,7 @@ describe('html-report-creator', () => { createHtmlReport(mockResult); expect( - prettyPrintHtml(fs.writeFileSync.mock.calls[0][1]) + fs.writeFileSync.mock.calls[0][1] ).toMatchSnapshot(); }); @@ -195,7 +186,7 @@ describe('html-report-creator', () => { createHtmlReport(mockResult); expect( - prettyPrintHtml(fs.writeFileSync.mock.calls[0][1]) + fs.writeFileSync.mock.calls[0][1] ).toMatchSnapshot(); }); diff --git a/html-report-creator.js b/html-report-creator.js index f1f9dfa..f7c1df4 100644 --- a/html-report-creator.js +++ b/html-report-creator.js @@ -92,7 +92,16 @@ module.exports = (result) => { }); } }); - writeFile(process.env.JEST_TEST_REPORT_PATH || path.join(process.cwd(), 'test-results/test-report.html'), htmlOutput); + writeFile( + process.env.JEST_TEST_REPORT_PATH || path.join(process.cwd(), + 'test-results/test-report.html'), + htmlOutput.end({ + pretty: true, + indent: ' ', + newline: '\n', + allowEmpty: false, + }) + ); return result; }; diff --git a/package.json b/package.json index 86c47b6..6f9c832 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ ], "contributors": [ "Andres Escobar", - "Jimmy King" + "Jamie King" ], "author": "Andres Escobar (https://github.com/anescobar1991)", "license": "Apache-2.0",