spaceshow

1.2.1 • Public • Published

spaceshow Build Status

Wrapper for easily testing meteor apps with puppeteer

Installation

  $ npm install --save spaceshow

Usage

  import spaceshow from 'spaceshow';

  const app = await spaceshow({
    appDir: `${__dirname}/meteor-test-app`, // path to your meteor app (required)
    port: 3000, // port to run your app. default to 3000
    settings: '…' // settings JSON string or file relative to app directory
    args: [], // custom args to pass to meteor command
    meteorPath: '…', // custom path for running meteor command
    puppeteerOptions: {} // custom puppeteer options. see https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions
    initialGotoOptions: {  } // options for initial goto call (setting a different timeout for example)
  });

  // for more commands see https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-page
  await page.waitForSelector('h1');
  const html = await page.evaluate(() => document.querySelector('h1').innerHTML);

  console.log(html);

  await page.close();

If you want more control over the whole process, you can also instantiate spaceshow by yourself

  import { Spaceshow } from 'spaceshow';

  const show = new Spaceshow({
    // options like in the example above
  });

  // log meteor output
  show.on('stdout', (data) => {
    console.log(data);
  });
  show.on('stderr', (data) => {
    console.error(data);
  });

  const app = await show.start();

  // …

License

Licensed under MIT license. Copyright (c) 2018 Max Nowack

Contributions

Contributions are welcome. Please open issues and/or file Pull Requests.

Maintainers

Package Sidebar

Install

npm i spaceshow

Weekly Downloads

0

Version

1.2.1

License

MIT

Unpacked Size

22.3 kB

Total Files

8

Last publish

Collaborators

  • maxnowack