0x/test/read-stdin.test.js
Matteo Collina ffa74601f4
Update to latest Node.js (#289)
* moved to node:test

Signed-off-by: Matteo Collina <hello@matteocollina.com>

* updated linting

Signed-off-by: Matteo Collina <hello@matteocollina.com>

* updated readme

Signed-off-by: Matteo Collina <hello@matteocollina.com>

---------

Signed-off-by: Matteo Collina <hello@matteocollina.com>
2025-07-07 02:16:06 -07:00

15 lines
511 B
JavaScript

const { exec } = require('child_process')
const { test } = require('node:test')
const assert = require('node:assert')
const fs = require('fs')
test('should be able to profile commands that expect stdin', async () => {
return new Promise((resolve, reject) => {
exec('./cmd.js test/fixture/stdin.js < test/fixture/stdin.js', (error, stdout, stderr) => {
if (error) return reject(error)
assert.strictEqual(stdout, fs.readFileSync('test/fixture/stdin.js', 'utf8'))
resolve()
})
})
})