From 644498eb5d0db369571ebcc97fac25d48f4edd7d Mon Sep 17 00:00:00 2001 From: uzlopak Date: Wed, 11 Oct 2023 13:34:39 +0200 Subject: [PATCH] fix: suppress warning in ci/cd pipeline --- package.json | 1 + test/util.test.js | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 469d4c42..42388b64 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "scripts": { "build": "ncc build src/index.js", "lint": "eslint .", + "lint:fix": "eslint . --fix", "test": "tap test/**.test.js", "prepare": "husky install" }, diff --git a/test/util.test.js b/test/util.test.js index 8ec6e3cb..f1ed3d80 100644 --- a/test/util.test.js +++ b/test/util.test.js @@ -1,9 +1,16 @@ 'use strict' const tap = require('tap') -const { - getInputs, - parseCommaOrSemicolonSeparatedValue, -} = require('../src/util') +const sinon = require('sinon') + +const logWarningStub = sinon.stub() +const { getInputs, parseCommaOrSemicolonSeparatedValue } = tap.mockRequire( + '../src/util', + { + '../src/log.js': { + logWarning: logWarningStub, + }, + } +) tap.test('parseCommaOrSemicolonSeparatedValue', async t => { t.test('should split semicolon separated values correctly', async t => { @@ -55,10 +62,16 @@ tap.test('getInputs', async t => { t.test('MERGE_METHOD', async t => { t.equal(getInputs({}).MERGE_METHOD, 'squash') t.equal(getInputs({ 'merge-method': 'merge' }).MERGE_METHOD, 'merge') + t.equal(logWarningStub.callCount, 0) t.equal( getInputs({ 'merge-method': 'invalid-merge-method' }).MERGE_METHOD, 'squash' ) + t.equal(logWarningStub.callCount, 1) + t.equal( + logWarningStub.firstCall.args[0], + 'merge-method input is ignored because it is malformed, defaulting to `squash`.' + ) }) t.test('EXCLUDE_PKGS', async t => { t.same(getInputs({ exclude: 'react,vue' }).EXCLUDE_PKGS, [