From a8dbcfb3cc1b193b851c1ddce2b15ecf1ecc8dfe Mon Sep 17 00:00:00 2001 From: Jeff Mealo Date: Sat, 30 Dec 2023 17:07:52 -0500 Subject: [PATCH] Chore: Fix tests --- package-lock.json | 2 +- package.json | 4 ++-- test/exit-early.test.js | 3 ++- test/success.test.js | 3 ++- test/timeout.test.js | 3 ++- test/truncate.test.js | 3 ++- test/working-directory.test.js | 3 ++- 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4c4e81d8..fcbd8fbb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@actions/core": "^1.10.0", "parse-duration": "^0.4.4", - "tail": "^2.0.4", + "tail": "2.0.4", "wait-on": "^7.2.0" }, "devDependencies": { diff --git a/package.json b/package.json index 3f7d8073..a7f5360a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "background-action", "version": "1.0.4", "description": "Background processes: tail std(out|err), dedupe post-run lines. Monitor exit-code and file/port/socket/http(s) (un)readiness.", - "main": "dist/index.js", + "main": "index.js", "scripts": { "lint": "eslint .", "build": "ncc build index.js -o dist --source-map", @@ -32,7 +32,7 @@ "dependencies": { "@actions/core": "^1.10.0", "parse-duration": "^0.4.4", - "tail": "^2.0.4", + "tail": "2.0.4", "wait-on": "^7.2.0" }, "devDependencies": { diff --git a/test/exit-early.test.js b/test/exit-early.test.js index 491e9f14..0c4eac07 100644 --- a/test/exit-early.test.js +++ b/test/exit-early.test.js @@ -1,13 +1,14 @@ const process = require('process') const cp = require('child_process') const core = require('@actions/core') +const pkg = require('../package.json') // shows how the runner will run a javascript action with env / stdout protocol test('exit-early', (done) => { jest.setTimeout(30000) Object.assign(process.env, require('./exit-early-env')) - const main = cp.spawn('bash', ['--noprofile', '--norc', '-eo', 'pipefail', '-c', 'node index.js'], { detached: false, env: process.env }) + const main = cp.spawn('bash', ['--noprofile', '--norc', '-eo', 'pipefail', '-c', `node ${pkg.main}`], { detached: false, env: process.env }) main.stdout.on('data', (data) => { if (data.toString().startsWith('::save-state name=')) { diff --git a/test/success.test.js b/test/success.test.js index 5010773f..a61a39da 100644 --- a/test/success.test.js +++ b/test/success.test.js @@ -1,6 +1,7 @@ const process = require('process') const cp = require('child_process') const core = require('@actions/core') +const pkg = require('../package.json') jest.setTimeout(30000) @@ -19,7 +20,7 @@ test('success', async () => { 'INPUT_LOG-OUTPUT-IF': 'success' }) - const main = cp.spawnSync('bash', ['--noprofile', '--norc', '-eo', 'pipefail', '-c', 'node index.js'], { env: process.env, encoding: 'utf-8' }) + const main = cp.spawnSync('bash', ['--noprofile', '--norc', '-eo', 'pipefail', '-c', `node ${pkg.main}`], { env: process.env, encoding: 'utf-8' }) const pids = {} diff --git a/test/timeout.test.js b/test/timeout.test.js index 903aa6a4..3e0396d4 100644 --- a/test/timeout.test.js +++ b/test/timeout.test.js @@ -1,6 +1,7 @@ const process = require('process') const cp = require('child_process') const core = require('@actions/core') +const pkg = require('../package.json'); jest.setTimeout(30000) @@ -8,7 +9,7 @@ jest.setTimeout(30000) test('timeout', (done) => { Object.assign(process.env, require('./timeout-env')) - const main = cp.spawn('bash', ['--noprofile', '--norc', '-eo', 'pipefail', '-c', 'node index.js'], { detached: false, env: process.env }) + const main = cp.spawn('bash', ['--noprofile', '--norc', '-eo', 'pipefail', '-c', `node ${pkg.main}`], { detached: false, env: process.env }) main.stdout.on('data', (data) => { if (data.toString().startsWith('::save-state name=')) { diff --git a/test/truncate.test.js b/test/truncate.test.js index ccc2ea9f..cc2ace63 100644 --- a/test/truncate.test.js +++ b/test/truncate.test.js @@ -1,6 +1,7 @@ const process = require('process') const cp = require('child_process') const core = require('@actions/core') +const pkg = require('../package.json'); jest.setTimeout(30000) @@ -8,7 +9,7 @@ jest.setTimeout(30000) test('truncate', (done) => { Object.assign(process.env, require('./truncate-env')) - const main = cp.spawnSync('bash', ['--noprofile', '--norc', '-eo', 'pipefail', '-c', 'node index.js'], { env: process.env, encoding: 'utf-8' }) + const main = cp.spawnSync('bash', ['--noprofile', '--norc', '-eo', 'pipefail', '-c', `node ${pkg.main}`], { env: process.env, encoding: 'utf-8' }) main.stdout.split('\n').forEach(line => { if (line.startsWith('::save-state name=')) { diff --git a/test/working-directory.test.js b/test/working-directory.test.js index 3abf2a57..76e98d6e 100644 --- a/test/working-directory.test.js +++ b/test/working-directory.test.js @@ -1,6 +1,7 @@ const process = require('process') const cp = require('child_process') const core = require('@actions/core') +const pkg = require('../package.json'); jest.setTimeout(30000) @@ -9,7 +10,7 @@ test('working-directory', (done) => { Object.assign(process.env, require('./working-directory-env')) - const main = cp.spawnSync('bash', ['--noprofile', '--norc', '-eo', 'pipefail', '-c', 'node index.js'], { env: process.env, encoding: 'utf-8' }) + const main = cp.spawnSync('bash', ['--noprofile', '--norc', '-eo', 'pipefail', '-c', `node ${pkg.main}`], { env: process.env, encoding: 'utf-8' }) main.stdout.split('\n').forEach(line => { if (line.startsWith('::save-state name=')) {