How to use ignoreFor method in ava

Best JavaScript code snippet using ava

fp64-arithmetic-transform.spec.js

Source:fp64-arithmetic-transform.spec.js Github

copy

Full Screen

1// Copyright (c) 2015 - 2018 Uber Technologies, Inc.2//3// Permission is hereby granted, free of charge, to any person obtaining a copy4// of this software and associated documentation files (the 'Software'), to deal5// in the Software without restriction, including without limitation the rights6// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell7// copies of the Software, and to permit persons to whom the Software is8// furnished to do so, subject to the following conditions:9//10// The above copyright notice and this permission notice shall be included in11// all copies or substantial portions of the Software.12//13// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE16// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER17// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,18// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN19// THE SOFTWARE.20import test from 'tape-catch';21import {fixture} from 'test/setup';22import {glGetDebugInfo} from '@luma.gl/core';23import {runTests} from './fp64-test-utils-transform';24const gl = fixture.gl2;25// Failing test cases are ignored based on gpu and glslFunc, using ignoreFor field26// ignoreFor: [{gpu: ['glslFunc-1', 'glslFunc-2']}] => ignores for `'glslFunc-1' and 'glslFunc-2` when running on `gpu`27const commonTestCases = [28 {a: 3.0e-19, b: 3.3e13},29 {a: 9.9e-40, b: 1.7e3},30 {a: 1.5e-36, b: 1.7e-16},31 {a: 9.4e-26, b: 51},32 {a: 6.7e-20, b: 0.93},33 // mul_fp64: Large numbers once multipled, can't be represented by 32 bit precision and Math.fround() returns NAN34 // sqrt_fp64: Fail on INTEL with margin 3.906051071870294e-1235 {a: 2.4e3, b: 5.9e31, ignoreFor: {all: ['mul_fp64'], intel: ['sqrt_fp64']}},36 // div_fp64 fails on INTEL with margin 1.7318642528355118e-1237 // sqrt_fp64 fails on INTEL with margin 1.5518878351528786e-1238 {a: 1.4e9, b: 6.3e5, ignoreFor: {intel: ['div_fp64', 'sqrt_fp64']}},39 // div fails on INTEL with margin 1.7886288892678105e-1440 // sqrt fails on INTEL with margin 2.5362810256331708e-1241 {a: 3.0e9, b: 4.3e-23, ignoreFor: {intel: ['div_fp64', 'sqrt_fp64']}},42 // div fail on INTEL with margin 1.137354350370519e-1243 {a: 1.7e-19, b: 2.7e-27, ignoreFor: {intel: ['div_fp64']}},44 // div_fp64 fails on INTEL with margin 2.7291999999999997e-1245 // sqrt_fp64 fails on INTEL with margin 3.501857471494295e-1246 {a: 0.3, b: 3.2e-16, ignoreFor: {intel: ['div_fp64', 'sqrt_fp64']}},47 // mul_fp64 : fails since result can't be represented by 32 bit floats48 // div_fp64 : fails on INTEL with margin 1.9999999999999994e-1549 // sqrt_fp64 : fails on INTEL with margin 1.832115697751484e-1250 {a: 4.1e30, b: 8.2e15, ignoreFor: {all: ['mul_fp64'], intel: ['div_fp64', 'sqrt_fp64']}},51 // Fails on INTEL, margin 3.752606081210107e-1252 {a: 6.2e3, b: 6.3e10, ignoreFor: {intel: ['sqrt_fp64']}},53 // Fails on INTEL, margin 3.872578286363912e-1354 {a: 2.5e2, b: 5.1e-21, ignoreFor: {intel: ['sqrt_fp64']}},55 // Fails on INTEL, margin 1.5332142001740705e-1256 {a: 96, b: 1.7e4, ignoreFor: {intel: ['sqrt_fp64']}},57 // // Fail on INTEL, margin 1.593162047558726e-1258 {a: 0.27, b: 2.3e16, ignoreFor: {intel: ['sqrt_fp64']}},59 // Fails on INTEL, margin 1.014956357028767e-1260 {a: 18, b: 9.1e-9, ignoreFor: {intel: ['sqrt_fp64']}}61];62// Filter all tests cases based on current gpu and glsFunc63function getTestCasesFor(glslFunc) {64 // Under node gl2 is not available65 if (!gl) {66 return [];67 }68 const debugInfo = glGetDebugInfo(gl);69 const testCases = commonTestCases.filter(testCase => {70 if (testCase.ignoreFor) {71 for (const gpu in testCase.ignoreFor) {72 if (73 (gpu === 'all' || debugInfo.vendor.toLowerCase().indexOf(gpu) >= 0) &&74 testCase.ignoreFor[gpu].includes(glslFunc)75 ) {76 return false;77 }78 }79 }80 return true;81 });82 return testCases;83}84test('fp64#sum_fp64', t => {85 const glslFunc = 'sum_fp64';86 const testCases = getTestCasesFor(glslFunc);87 runTests(gl, {glslFunc, binary: true, op: (a, b) => a + b, testCases, t});88});89test('fp64#sub_fp64', t => {90 const glslFunc = 'sub_fp64';91 const testCases = getTestCasesFor(glslFunc);92 runTests(gl, {glslFunc, binary: true, op: (a, b) => a - b, testCases, t});93});94test('fp64#mul_fp64', t => {95 const glslFunc = 'mul_fp64';96 const testCases = getTestCasesFor(glslFunc);97 runTests(gl, {glslFunc, binary: true, op: (a, b) => a * b, limit: 128, testCases, t});98});99test('fp64#div_fp64', t => {100 const glslFunc = 'div_fp64';101 const testCases = getTestCasesFor(glslFunc);102 runTests(gl, {glslFunc, binary: true, op: (a, b) => a / b, limit: 128, testCases, t});103});104test('fp64#sqrt_fp64', t => {105 const glslFunc = 'sqrt_fp64';106 const testCases = getTestCasesFor(glslFunc);107 runTests(gl, {glslFunc, op: a => Math.sqrt(a), limit: 128, testCases, t});...

Full Screen

Full Screen

playHelpers.js

Source:playHelpers.js Github

copy

Full Screen

1import {2 MAIN_WINDOW_WIDTH,3 TOP_OFFSET,4} from '../../../_shared/constants'5import { Rectangle } from './geometry'6export const drawRectangles = (areas, mat) => areas.forEach(area => area.rectangle.draw(mat))7export const normalizePoint = point => ({8 x: point.x + MAIN_WINDOW_WIDTH,9 y: point.y + TOP_OFFSET,10})11export function BlackList() {12 this.matchBlackList = []13 this.actionBlackList = []14 this.addMatchToBlackList = function addMatchToBlackList(item, size = 70, ignoreFor = 2500) {15 this.matchBlackList.push({16 item,17 added: Date.now(),18 size,19 ignoreFor,20 rectangle: new Rectangle(21 { x: item.x - size / 2, y: item.y - size / 2 },22 size, size,23 ),24 })25 }26 this.addActionToBlackList = function addActionToBlackList(action, ignoreFor = 180) {27 this.actionBlackList.push({28 action,29 added: Date.now(),30 ignoreFor,31 })32 }33 this.isMatchBlackListed = function isMatchBlackListed(item) {34 this.clearMatchBlackList()35 return this.matchBlackList.reduce((carry, blackListed) => carry36 || blackListed.rectangle.doesContain({37 x: item.x,38 y: item.y,39 }) && Date.now() - blackListed.added < blackListed.ignoreFor, false)40 }41 this.isActionBlackListed = function isActionBlackListed(item) {42 this.clearActionBlackList()43 return this.actionBlackList.reduce((carry, blackListed) => carry44 || blackListed.action.name === item.name && Date.now() - blackListed.added < blackListed.ignoreFor, false)45 }46 this.clearActionBlackList = function clearActionBlackList() {47 this.clearList('actionBlackList')48 }49 this.clearMatchBlackList = function clearMatchBlackList() {50 this.clearList('matchBlackList')51 }52 this.clearList = function clearList(listName) {53 this[listName] = this[listName].filter(blackListed => Date.now() - blackListed.added < blackListed.ignoreFor) // eslint-disable-line54 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import {test} from 'ava';2test('1 + 1 = 2', (t) => {3 t.is(1 + 1, 2);4});5test('2 + 2 = 4', (t) => {6 t.is(2 + 2, 4);7});8test('2 + 2 = 5', (t) => {9 t.is(2 + 2, 5);10});11test('2 + 2 = 6', (t) => {12 t.is(2 + 2, 6);13});14test('2 + 2 = 7', (t) => {15 t.is(2 + 2, 7);16});17test('2 + 2 = 8', (t) => {18 t.is(2 + 2, 8);19});20test('2 + 2 = 9', (t) => {21 t.is(2 + 2, 9);22});23test('2 + 2 = 10', (t) => {24 t.is(2 + 2, 10);25});26test('2 + 2 = 11', (t) => {27 t.is(2 + 2, 11);28});29test('2 + 2 = 12', (t) => {30 t.is(2 + 2, 12);31});32test('2 + 2 = 13', (t) => {33 t.is(2 + 2, 13);34});35test('2 + 2 = 14', (t) => {36 t.is(2 + 2, 14);37});38test('2 + 2 = 15', (t) => {39 t.is(2 + 2, 15);40});41test('2 + 2 = 16', (t) => {42 t.is(2 + 2, 16);43});44test('2 + 2 = 17', (t) => {45 t.is(2 + 2, 17);46});47test('2 + 2 = 18', (t) => {48 t.is(2 + 2, 18);49});50test('2 + 2 = 19', (t) => {51 t.is(2 + 2, 19);52});53test('2 + 2 = 20', (t) =>

Full Screen

Using AI Code Generation

copy

Full Screen

1import test from 'ava';2import {ignoreFor} from 'ava/ignore-for';3test('test 1', t => {4 t.pass();5});6test('test 2', ignoreFor({node: '>= 6'}), t => {7 t.pass();8});9test('test 3', ignoreFor({node: '>= 8'}), t => {10 t.pass();11});12test('test 4', ignoreFor({node: '>= 10'}), t => {13 t.pass();14});15test('test 5', ignoreFor({node: '>= 12'}), t => {16 t.pass();17});18test('test 6', ignoreFor({node: '>= 14'}), t => {19 t.pass();20});21test('test 7', ignoreFor({node: '>= 16'}), t => {22 t.pass();23});24test('test 8', ignoreFor({node: '>= 18'}), t => {25 t.pass();26});27test('test 9', ignoreFor({node: '>= 20'}), t => {28 t.pass();29});30test('test 10', ignoreFor({node: '>= 22'}), t => {31 t.pass();32});33test('test 11', ignoreFor({node: '>= 24'}), t => {34 t.pass();35});36test('test 12', ignoreFor({node: '>= 26'}), t => {37 t.pass();38});39test('test 13', ignoreFor({node: '>= 28'}), t => {40 t.pass();41});42test('test 14', ignoreFor({node: '>= 30'}), t => {43 t.pass();44});45test('test 15', ignoreFor({node: '>= 32'}), t => {46 t.pass();47});48test('test 16', ignoreFor({node: '>= 34'}), t => {49 t.pass();50});51test('test 17', ignoreFor({node: '>= 36'}), t => {52 t.pass();53});54test('test 18', ignoreFor({node: '>= 38'}), t => {55 t.pass();56});57test('test 19', ignoreFor({node: '>= 40'}), t => {58 t.pass();59});60test('test 20', ignoreFor({node: '>= 42'}

Full Screen

Using AI Code Generation

copy

Full Screen

1import test from 'ava';2import { ignoreFor } from 'ava-ignore-for';3test('test', t => {4 t.pass();5});6ignoreFor('test', 'chrome', t => {7 t.pass();8});9ignoreFor('test', 'firefox', t => {10 t.pass();11});12ignoreFor('test', 'edge', t => {13 t.pass();14});15ignoreFor('test', 'safari', t => {16 t.pass();17});18ignoreFor('test', 'ie', t => {19 t.pass();20});21import test from 'ava';22import { ignoreFor } from 'ava-ignore-for';23test('test', t => {24 t.pass();25});26ignoreFor('test', 'chrome', t => {27 t.pass();28});29import test from 'ava';30import { ignoreFor } from 'ava-ignore-for';31test('test', t => {32 t.pass();33});34ignoreFor('test', 'firefox', t => {35 t.pass();36});37import test from 'ava';38import { ignoreFor } from 'ava-ignore-for';39test('test', t => {40 t.pass();41});42ignoreFor('test', 'edge', t => {43 t.pass();44});45import test from 'ava';46import { ignoreFor } from 'ava-ignore-for';47test('test', t => {48 t.pass();49});50ignoreFor('test', 'safari', t => {51 t.pass();52});53import test from 'ava';54import { ignoreFor } from 'ava-ignore-for';55test('test', t => {56 t.pass();57});58ignoreFor('test', 'ie', t => {59 t.pass();60});61import test from 'ava';62import { ignoreFor } from 'ava-ignore-for';63test('test', t => {64 t.pass();65});66ignoreFor('test', 'chrome', t => {67 t.pass();68});69ignoreFor('test', 'firefox', t => {

Full Screen

Using AI Code Generation

copy

Full Screen

1import test from 'ava';2import {ignoreFor} from 'ava-ignore-for';3import {foo} from './foo';4test('foo', t => {5 t.is(foo(), 5);6});7export function foo() {8 return 5;9}10import test from 'ava';11import {ignoreFor} from 'ava-ignore-for';12import {foo} from './foo';13test('foo', t => {14 t.is(foo(), 5);15});16export function bar() {17 return 5;18}19import test from 'ava';20import {ignoreFor} from 'ava-ignore-for';21import {bar} from './bar';22test('bar', t => {23 t.is(bar(), 5);24});25export function baz() {26 return 5;27}28import test from 'ava';29import {ignoreFor} from 'ava-ignore-for';30import {baz} from './baz';31test('baz', t => {32 t.is(baz(), 5);33});34export function qux() {35 return 5;36}37import test from 'ava';38import {ignoreFor} from 'ava-ignore-for';39import {qux} from './qux';40test('qux', t => {41 t.is(qux(), 5);42});43export function quux() {44 return 5;45}46import test from 'ava';47import {ignoreFor} from 'ava-ignore-for';48import {quux} from './quux';49test('quux', t => {50 t.is(quux(), 5);51});

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var driver = new webdriver.Builder().forBrowser('chrome').build();3driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');4driver.findElement(webdriver.By.name('btnG')).click();5driver.wait(function() {6 return driver.getTitle().then(function(title) {7 return title === 'webdriver - Google Search';8 });9}, 1000);10driver.quit();11var webdriver = require('selenium-webdriver');12var driver = new webdriver.Builder().forBrowser('firefox').build();13driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');14driver.findElement(webdriver.By.name('btnG')).click();15driver.wait(function() {16 return driver.getTitle().then(function(title) {17 return title === 'webdriver - Google Search';18 });19}, 1000);20driver.quit();21var webdriver = require('selenium-webdriver');22var driver = new webdriver.Builder().forBrowser('internet explorer').build();23driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');24driver.findElement(webdriver.By.name('btnG')).click();25driver.wait(function() {26 return driver.getTitle().then(function(title) {27 return title === 'webdriver - Google Search';28 });29}, 1000);30driver.quit();31var webdriver = require('selenium-webdriver');32var driver = new webdriver.Builder().forBrowser('safari').build();33driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');34driver.findElement(webdriver.By.name('btnG')).click();35driver.wait(function() {36 return driver.getTitle().then(function(title) {37 return title === 'webdriver - Google Search';38 });39}, 1000);40driver.quit();

Full Screen

Using AI Code Generation

copy

Full Screen

1var EventEmitter = require('events').EventEmitter;2var emitter = new EventEmitter();3var data = {4};5emitter.on('data', function (data) {6 console.log('data event received: ', data);7}).ignoreFor('data', 1000);8emitter.emit('data', data);9var EventEmitter = require('events').EventEmitter;10var emitter = new EventEmitter();11var data = {12};13emitter.once('data', function (data) {14 console.log('data event received: ', data);15}).ignoreFor('data', 1000);16emitter.emit('data', data);17var EventEmitter = require('events').EventEmitter;18var emitter = new EventEmitter();19var data = {20};21var listener = function (data) {22 console.log('data event received: ', data);23};24emitter.on('data', listener);25emitter.removeListener('data', listener).ignoreFor('data', 1000);26emitter.emit('data', data);27var EventEmitter = require('events').EventEmitter;28var emitter = new EventEmitter();29var data = {30};31var listener = function (data) {32 console.log('data event received: ', data);33};34emitter.on('data', listener);35emitter.removeAllListeners('data').ignoreFor('data', 1000);36emitter.emit('data', data);37var EventEmitter = require('events').EventEmitter;

Full Screen

Using AI Code Generation

copy

Full Screen

1it('should be able to ignore the element', function() {2 var actual = browser.ignoreFor(2000, function() {3 return browser.getUrl();4 });5 expect(actual).to.equal(expected);6});7it('should be able to ignore the element', function() {8 var actual = browser.ignoreFor(2000, function() {9 return browser.getUrl();10 });11 expect(actual).to.equal(expected);12});13it('should be able to ignore the element', function() {14 var actual = browser.ignoreFor(2000, function() {15 return browser.getUrl();16 });17 expect(actual).to.equal(expected);18});19it('should be able to ignore the element', function() {20 var actual = browser.ignoreFor(2000, function() {21 return browser.getUrl();22 });23 expect(actual).to.equal(expected);24});25it('should be able to ignore the element', function() {26 var actual = browser.ignoreFor(2000, function() {27 return browser.getUrl();28 });29 expect(actual).to.equal(expected);30});31it('should be able to ignore the element', function() {32 var actual = browser.ignoreFor(2000, function() {33 return browser.getUrl();34 });35 expect(actual).to.equal(expected);36});37it('should be able to ignore the element', function() {38 var actual = browser.ignoreFor(2000,

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ava automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful