From 0865fda5ef9d9629700ccfee21e71af3f5eea1b7 Mon Sep 17 00:00:00 2001 From: calebboyd Date: Mon, 15 Apr 2019 23:01:50 -0500 Subject: [PATCH] fix: don't infer main module when not in tty --- test/options.spec.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/options.spec.ts b/test/options.spec.ts index d21e2fd..5b0832d 100644 --- a/test/options.spec.ts +++ b/test/options.spec.ts @@ -10,9 +10,13 @@ describe('options', () => { const options = normalizeOptions() expect(options.cwd).to.equal(process.cwd()) }) - it('should use the main module in a package directory', () => { + it('should use the main module in a package directory (if not in a TTY)', () => { const options = normalizeOptions() - expect(options.input).to.equal(path.resolve('./index.js')) + if (!process.stdin.isTTY) { + expect(options.input).to.equal('[stdin]') + } else { + expect(options.input).to.equal(path.resolve('./index.js')) + } }) it('should resolve relative paths for input', () => { const options = normalizeOptions({ input: 'test/fixture/entry.js' })