| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import { test } from 'ava';
- import { Runner } from '../';
- import { spawnAsync } from '../dist/lib/util';
- const dir = './assets/project/';
- test.serial('commandline', async (t) => {
- const { code, signal } = await spawnAsync('node', `./dist/bin/run.js ${ dir } 233`.split(' '), {
- stdio: 'inherit',
- env: Object.assign({}, process.env, {
- NWJS_MIRROR: process.env.CI ? '' : 'https://npm.taobao.org/mirrors/nwjs/',
- }),
- });
- t.is(code, 233);
- });
- test.serial('commandline --detached', async (t) => {
- const mirror = process.env.CI ? '' : '--mirror https://npm.taobao.org/mirrors/nwjs/';
- const { code, signal } = await spawnAsync('node', `./dist/bin/run.js ${ mirror } --detached ${ dir } 233`.split(' '), {
- stdio: 'inherit',
- });
- t.is(code, 0);
- });
- test.serial('module', async (t) => {
- const mirror = process.env.CI ? undefined : 'https://npm.taobao.org/mirrors/nwjs/';
- const runner = new Runner({
- mirror,
- }, [ dir, '233' ]);
- const code = await runner.run();
- t.is(code, 233);
- });
|