Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
t('Caching resource', t => {
let a = Audio('./chopin.mp3').on('load', (audio) => {
})
let b = Audio('./chopin.mp3').on('load', (audio) => {
})
assert.equal(Object.keys(Audio.cache).length === 1)
});
t.only('save', t => {
let a = Audio(lena, (err, a) => {
a.save('lena.wav', (err, a) => {
if (!isBrowser) {
let p = __dirname + path.sep + 'lena.wav'
assert.ok(fs.existsSync(p))
fs.unlinkSync(p);
}
t.end()
})
})
})
// t('create from buffer', t => {
// Audio(lena).volume(.5).play(() => {
// console.log('end');
test.only = function (name, n, cb) {
tape.only(moduleName + ': ' + name, function (t) {
if (opts.setup) opts.setup();
if (n) t.plan(n);
cb(t);
if (opts.teardown) opts.teardown();
if (!n) t.end();
});
};
}
}, function() {
if (only === true) tape.only(label, fn.bind(ctx))
else tape(label, fn.bind(ctx))
})
}
distinct.only = function distinctOnly(name:string, roundCounts:number[][], expected:any) {
test.only(`Distinct: ${name}`, (assert) => {
distinctTest(assert, roundCounts, expected);
assert.end();
});
}
try {
await runAll([
cb => writeFiles(drive, files, cb),
cb => validateReaddir(t, drive, 'a', ['a', 'b', 'c', 'e'], cb),
cb => validateReaddir(t, drive, 'a/c', ['d', 'e'], cb),
cb => validateReaddir(t, drive, 'b', ['e', 'f', 'd'], cb),
cb => validateReaddir(t, drive, '', ['a', 'b', 'e'], cb)
])
} catch (err) {
t.fail(err)
}
t.end()
})
test.only('readdir can include stats/mounts', async t => {
const drive = create()
const files = createFiles([
'a/a',
'a/b',
'a/c/d',
'a/c/e',
'a/e',
'b/e',
'b/f',
'b/d',
'e'
])
try {
await runAll([
.catch(t.fail)
.then(() => {
line2d.update([
{ thickness: 4, points: [0,0, 1,1, 1,0], close: true, color: 'red' },
null,
{ thickness: 4, points: [0,1, 1,1, 0,0], close: true, color: 'blue' }
])
line2d.draw(0)
line2d.draw(2)
return imageEqual('./test/35a.png', line2d)
})
.then(t.end, t.fail)
})
t.only('sin dash pattern', t => {
let line = createLine(regl)
var i, steps = 100
var data = []
for (i = 0; i < steps; i++) {
data.push(i, Math.sin(i * 10 / steps))
}
line.update([{
type: 'join',
overlay: true,
data: data,
thickness: 4,
dash: [8,8],
range: [0,-2,steps * 2,2]
}, {
function testOnly(
msg: string,
cb: (
t: any,
client: Client,
end: () => void,
fail: (err: any) => void,
) => void,
): void {
const client = new Client(clientConfig)
tape.only(msg, t => {
t.timeoutAfter(10 * 1000)
cb(
t,
client,
() =>
deleteResources(client)
.then(() => t.end())
.catch(err => t.end(err)),
err =>
deleteResources(client)
.then(() => t.end(err))
.catch(() => t.end(err)),
)
})
}
}
}
}
`
const validScss = `
.button {
@each $key, $value in $colors {
&-#{$key} {
background-color: $value;
}
}
}
`
test.only("Nesting depth scss", t => {
t.plan(6)
postcss()
.use(stylelint({ code: invalidScss, config: config }))
.process(invalidScss, { syntax: scssSyntax })
.then(checkResult)
.catch(logError)
function checkResult(result) {
t.equal(result.warnings().length, 3, "flags 3 warning")
t.is(
result.warnings()[0].text,
"Expected nesting depth to be no more than 1 (max-nesting-depth)",
"correct warning text"
)
test.only = (name, fn) => tape.only(name, t => runner(t, fn))
test.skip = (name, fn) => {}