How to use the tape.onFinish function in tape

To help you get started, we’ve selected a few tape examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uber / streetscape.gl / test / browser.js View on Github external
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
const test = require('tape');
const {_enableDOMLogging: enableDOMLogging} = require('@probe.gl/test-utils');

/* global window */
let failed = false;
test.onFinish(window.browserTestDriver_finish);
test.onFailure(() => {
  failed = true;
  window.browserTestDriver_fail();
});

// tap-browser-color alternative
enableDOMLogging({
  getStyle: message => ({
    background: failed ? '#F28E82' : '#8ECA6C',
    position: 'absolute',
    top: '450px',
    width: '100%'
  })
});

require('./modules/core');
github uber / react-map-gl / test / browser.js View on Github external
/* global window */
require('@babel/register');

const test = require('tape');
const {_enableDOMLogging: enableDOMLogging} = require('@probe.gl/test-utils');

let failed = false;
test.onFinish(window.browserTestDriver_finish);
test.onFailure(() => {
  failed = true;
  window.browserTestDriver_fail();
});

// tap-browser-color alternative
enableDOMLogging({
  getStyle: message => ({
    background: failed ? '#F28E82' : '#8ECA6C',
    position: 'absolute',
    top: '500px',
    width: '100%'
  })
});

require('./src/utils');
github tipsi / tipsi-appium-helper / src / runners / tape.js View on Github external
return new Promise((resolve) => {
      // Specify tap-diff reporter
    tape.createStream()
      .pipe(tapDiff({
        bail: true,
      }))
      .pipe(process.stdout)

    const cwd = process.cwd()

    globPlatformFiles(paths, platform).forEach(
      file => require(path.resolve(cwd, file))
    )

    tape.onFinish(resolve)
  })
}
github datproject / sdk / test-promise.js View on Github external
const isBrowser = process.title === 'browser'
const storageLocation = isBrowser ? '/' : require('tmp').dirSync({
  prefix: 'universal-dat-storage-'
}).name

const { DatArchive, destroy } = SDK({
  storageOpts: {
    storageLocation
  }
})

const DATPROJECT_KEY = 'dat://60c525b5589a5099aa3610a8ee550dcd454c3e118f7ac93b7d41b6b850272330'
const DATPROJECT_URL = 'dat://dat.foundation'
const TEST_TIMEOUT = 10 * 1000

test.onFinish(destroy)

test('DatArchive - load drive', async (t) => {
  t.timeoutAfter(TEST_TIMEOUT)

  try {
    const drive = await DatArchive.load(DATPROJECT_KEY)

    t.pass('loaded archive')

    const data = await drive.readFile('/dat.json', 'utf8')

    t.ok(data, 'loaded data from archive')

    t.end()
  } catch (e) {
    t.error(e)
github violentmonkey / violentmonkey / test / background / tester.js View on Github external
import test from 'tape';
import { testScript, testBlacklist, resetBlacklist } from 'src/background/utils/tester';
import cache from 'src/background/utils/cache';

test.onFinish(cache.destroy);

function buildScript(props) {
  return Object.assign({
    custom: {
      origInclude: true,
      origExclude: true,
      origMatch: true,
      origExcludeMatch: true,
    },
    meta: {},
  }, props);
}

test('scheme', t => {
  t.test('should match all', q => {
    const script = buildScript({
github 4strid / nekodb / test / cleanup.js View on Github external
cb()
			}
		}).catch(err => {
			console.error(err)
			if (cb) {
				cb()
			}
		})
	})
}

module.exports = {
	deleteTestFiles,
}

test.onFinish(deleteTestFiles)
github psiphi75 / web-remote-control / tests / testWRC-RemoteProxy.js View on Github external
test('Test toy-1 can send status updates to controller-1 (text)', function(t) {

        t.plan(1);

        var statusTxt = 'Hi, I am here';

        controller.once('status', function fn (respStatusTxt) {
            t.equal(respStatusTxt, statusTxt, 'command was correct');
            t.end();
        });

        toy.status(statusTxt);

    });

    test.onFinish(function () {

        setTimeout(function () {

            toy.close();
            controller.close();

        }, 250);

    });

}
github DylanPiercey / auto-sni / test / index.js View on Github external
var path = require('path')
var tape = require('tape')

tape
  .createStream()
  .pipe(require('tap-spec')())
  .pipe(process.stdout)

tape.onFinish(process.exit)

process.argv.slice(2).forEach(function (file) {
  require(path.resolve(__dirname, file))
})
github commonform / commonform.org / test / webdriver.js View on Github external
var spawn = require('child_process').spawn
var path = require('path')
var tape = require('tape')

tape.onFinish(cleanup)

var chromedriver = spawn(
  path.join(
    __dirname, '..', 'node_modules', '.bin', 'chromedriver'
  ),
  ['--url-base=/wd/hub']
)

var webdriver = module.exports = require('webdriverio')
  .remote({
    host: 'localhost',
    port: 9515,
    desiredCapabilities: {
      browserName: 'chrome',
      chromeOptions: process.env.DISABLE_HEADLESS
        ? undefined
github Gozala / events / tests / remove-all-listeners.js View on Github external
function expect(expected) {
  var actual = [];
  test.onFinish(function() {
    var sortedActual = actual.sort();
    var sortedExpected = expected.sort();
    assert.strictEqual(sortedActual.length, sortedExpected.length);
    for (var index = 0; index < sortedActual.length; index++) {
      var value = sortedActual[index];
      assert.strictEqual(value, sortedExpected[index]);
    }
  });
  function listener(name) {
    actual.push(name);
  }
  return common.mustCall(listener, expected.length);
}