Skip to content

Commit

Permalink
Chore: Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jmealo committed Dec 30, 2023
1 parent e3fe214 commit a8dbcfb
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion test/exit-early.test.js
Original file line number Diff line number Diff line change
@@ -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=')) {
Expand Down
3 changes: 2 additions & 1 deletion test/success.test.js
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -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 = {}

Expand Down
3 changes: 2 additions & 1 deletion test/timeout.test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
const process = require('process')
const cp = require('child_process')
const core = require('@actions/core')
const pkg = require('../package.json');

jest.setTimeout(30000)

// shows how the runner will run a javascript action with env / stdout protocol
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=')) {
Expand Down
3 changes: 2 additions & 1 deletion test/truncate.test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
const process = require('process')
const cp = require('child_process')
const core = require('@actions/core')
const pkg = require('../package.json');

jest.setTimeout(30000)

// shows how the runner will run a javascript action with env / stdout protocol
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=')) {
Expand Down
3 changes: 2 additions & 1 deletion test/working-directory.test.js
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -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=')) {
Expand Down

0 comments on commit a8dbcfb

Please sign in to comment.