test: it.skip skips and it.fail expects to fail now (#1178)

This commit is contained in:
Pavel Feldman 2020-03-02 13:47:08 -08:00 committed by GitHub
parent 08fbc92752
commit 5bd6e4970b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 62 additions and 58 deletions

View File

@ -85,7 +85,7 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT,
};
expect(await page.accessibility.snapshot()).toEqual(golden);
});
it.skip(WEBKIT && !MAC)('should work with regular text', async({page}) => {
it.fail(WEBKIT && !MAC)('should work with regular text', async({page}) => {
await page.setContent(`<div>Hello World</div>`);
const snapshot = await page.accessibility.snapshot();
expect(snapshot.children[0]).toEqual({

View File

@ -26,7 +26,7 @@ module.exports.describe = function({testRunner, expect, WIN, WEBKIT}) {
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Capabilities', function() {
it.skip(WEBKIT && WIN)('Web Assembly should work', async function({page, server}) {
it.fail(WEBKIT && WIN)('Web Assembly should work', async function({page, server}) {
await page.goto(server.PREFIX + '/wasm/table2.html');
expect(await page.evaluate(() => loadTable())).toBe('42, 83');
});

View File

@ -26,7 +26,7 @@ module.exports.describe = function({testRunner, expect, headless, ASSETS_DIR}) {
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
// Printing to pdf is currently only supported in headless
describe.skip(!headless)('Page.pdf', function() {
describe.fail(!headless)('Page.pdf', function() {
it('should be able to save file', async({page, server}) => {
const outputFile = path.join(ASSETS_DIR, 'output.pdf');
await page.pdf({path: outputFile});

View File

@ -326,7 +326,7 @@ module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROMI
expect(await page.evaluate(() => offsetX)).toBe(WEBKIT ? 12 * 2 + 20 : 20);
expect(await page.evaluate(() => offsetY)).toBe(WEBKIT ? 12 * 2 + 10 : 10);
});
it.skip(FFOX)('should click a very large button with offset', async({page, server}) => {
it.fail(FFOX)('should click a very large button with offset', async({page, server}) => {
await page.goto(server.PREFIX + '/input/button.html');
await page.$eval('button', button => button.style.borderWidth = '8px');
await page.$eval('button', button => button.style.height = button.style.width = '2000px');
@ -336,7 +336,7 @@ module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROMI
expect(await page.evaluate(() => offsetX)).toBe(WEBKIT ? 1900 + 8 : 1900);
expect(await page.evaluate(() => offsetY)).toBe(WEBKIT ? 1910 + 8 : 1910);
});
it.skip(FFOX)('should click a button in scrolling container with offset', async({page, server}) => {
it.fail(FFOX)('should click a button in scrolling container with offset', async({page, server}) => {
await page.goto(server.PREFIX + '/input/button.html');
await page.$eval('button', button => {
const container = document.createElement('div');

View File

@ -54,7 +54,7 @@ module.exports.describe = function({testRunner, expect, playwright, defaultBrows
expect(cookies.length).toBe(1);
expect(cookies[0].httpOnly).toBe(true);
});
it.skip(WEBKIT && !MAC)('should properly report "Strict" sameSite cookie', async({context, page, server}) => {
it.fail(WEBKIT && !MAC)('should properly report "Strict" sameSite cookie', async({context, page, server}) => {
server.setRoute('/empty.html', (req, res) => {
res.setHeader('Set-Cookie', 'name=value;SameSite=Strict');
res.end();
@ -64,7 +64,7 @@ module.exports.describe = function({testRunner, expect, playwright, defaultBrows
expect(cookies.length).toBe(1);
expect(cookies[0].sameSite).toBe('Strict');
});
it.skip(WEBKIT && !MAC)('should properly report "Lax" sameSite cookie', async({context, page, server}) => {
it.fail(WEBKIT && !MAC)('should properly report "Lax" sameSite cookie', async({context, page, server}) => {
server.setRoute('/empty.html', (req, res) => {
res.setHeader('Set-Cookie', 'name=value;SameSite=Lax');
res.end();

View File

@ -299,7 +299,7 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT})
});
describe('ElementHandle.scrollIntoViewIfNeeded', function() {
it.skip(FFOX)('should work', async({page, server}) => {
it.fail(FFOX)('should work', async({page, server}) => {
await page.goto(server.PREFIX + '/offscreenbuttons.html');
for (let i = 0; i < 11; ++i) {
const button = await page.$('#btn' + i);

View File

@ -89,7 +89,7 @@ module.exports.describe = function({testRunner, expect, playwright, headless, FF
expect(await page.evaluate(() => Modernizr.touchevents)).toBe(true);
await context.close();
});
it.skip(FFOX)('should support landscape emulation', async({browser, server}) => {
it.fail(FFOX)('should support landscape emulation', async({browser, server}) => {
const context1 = await browser.newContext({ viewport: iPhone.viewport });
const page1 = await context1.newPage();
await page1.goto(server.PREFIX + '/mobile.html');
@ -100,7 +100,7 @@ module.exports.describe = function({testRunner, expect, playwright, headless, FF
await context1.close();
await context2.close();
});
it.skip(FFOX || WEBKIT)('should fire orientationchange event', async({browser, server}) => {
it.fail(FFOX || WEBKIT)('should fire orientationchange event', async({browser, server}) => {
const context = await browser.newContext({ viewport: { width: 300, height: 400, isMobile: true } });
const page = await context.newPage();
await page.goto(server.PREFIX + '/mobile.html');
@ -118,14 +118,14 @@ module.exports.describe = function({testRunner, expect, playwright, headless, FF
expect((await event2).text()).toBe('2');
await context.close();
});
it.skip(FFOX)('default mobile viewports to 980 width', async({browser, server}) => {
it.fail(FFOX)('default mobile viewports to 980 width', async({browser, server}) => {
const context = await browser.newContext({ viewport: {width: 320, height: 480, isMobile: true} });
const page = await context.newPage();
await page.goto(server.PREFIX + '/empty.html');
expect(await page.evaluate(() => window.innerWidth)).toBe(980);
await context.close();
});
it.skip(FFOX)('respect meta viewport tag', async({browser, server}) => {
it.fail(FFOX)('respect meta viewport tag', async({browser, server}) => {
const context = await browser.newContext({ viewport: {width: 320, height: 480, isMobile: true} });
const page = await context.newPage();
await page.goto(server.PREFIX + '/mobile.html');
@ -199,7 +199,7 @@ module.exports.describe = function({testRunner, expect, playwright, headless, FF
await page.emulateMedia({ colorScheme: 'bad' }).catch(e => error = e);
expect(error.message).toBe('Unsupported color scheme: bad');
});
it.skip(FFOX)('should work during navigation', async({page, server}) => {
it.fail(FFOX)('should work during navigation', async({page, server}) => {
await page.emulateMedia({ colorScheme: 'light' });
const navigated = page.goto(server.EMPTY_PAGE);
for (let i = 0; i < 9; i++) {
@ -213,7 +213,7 @@ module.exports.describe = function({testRunner, expect, playwright, headless, FF
});
});
describe.skip(FFOX)('BrowserContext({timezoneId})', function() {
describe.fail(FFOX)('BrowserContext({timezoneId})', function() {
it('should work', async ({ browser }) => {
const func = () => new Date(1479579154987).toString();
{
@ -253,7 +253,7 @@ module.exports.describe = function({testRunner, expect, playwright, headless, FF
});
});
describe.skip(FFOX)('BrowserContext({locale})', function() {
describe.fail(FFOX)('BrowserContext({locale})', function() {
it('should affect accept-language header', async({browser, server}) => {
const context = await browser.newContext({ locale: 'fr-CH' });
const page = await context.newPage();
@ -307,7 +307,7 @@ module.exports.describe = function({testRunner, expect, playwright, headless, FF
});
describe('focus', function() {
it.skip(!headless)('should think that it is focused by default', async({page}) => {
it.fail(!headless)('should think that it is focused by default', async({page}) => {
expect(await page.evaluate('document.hasFocus()')).toBe(true);
});
});

View File

@ -259,7 +259,7 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT})
expect(result).toEqual([42]);
});
// Works in WebKit, but slow
it.skip(FFOX)('should transfer 100Mb of data from page to node.js', async({page, server}) => {
it.fail(FFOX)('should transfer 100Mb of data from page to node.js', async({page, server}) => {
const a = await page.evaluate(() => Array(100 * 1024 * 1024 + 1).join('a'));
expect(a.length).toBe(100 * 1024 * 1024);
});
@ -425,7 +425,7 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT})
const error = await page.evaluate(body => body.innerHTML, bodyHandle).catch(e => e);
expect(error.message).toContain('Unable to adopt element handle from a different document');
});
it.skip(FFOX)('should return non-empty Node.constructor.name in utility context', async({page,server}) => {
it.fail(FFOX)('should return non-empty Node.constructor.name in utility context', async({page,server}) => {
await page.goto(server.EMPTY_PAGE);
await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE);
const frame = page.frames()[1];

View File

@ -27,7 +27,7 @@ module.exports.describe = function({testRunner, expect, WEBKIT}) {
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
// Permissions API is not implemented in WebKit (see https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API)
describe.skip(WEBKIT)('Permissions', function() {
describe.fail(WEBKIT)('Permissions', function() {
function getPermission(page, name) {
return page.evaluate(name => navigator.permissions.query({name}).then(result => result.state), name);
}

View File

@ -23,7 +23,7 @@ module.exports.describe = function ({ testRunner, expect, FFOX, WEBKIT }) {
const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe.skip(FFOX)('Overrides.setGeolocation', function() {
describe.fail(FFOX)('Overrides.setGeolocation', function() {
it('should work', async({page, server, context}) => {
await context.setPermissions(server.PREFIX, ['geolocation']);
await page.goto(server.EMPTY_PAGE);

View File

@ -41,7 +41,7 @@ module.exports.describe = function({testRunner, expect, playwright, defaultBrows
await removeUserDataDir(userDataDir);
});
// see https://github.com/microsoft/playwright/issues/717
it.skip((WIN && CHROMIUM) || FFOX)('headless should be able to read cookies written by headful', async({server}) => {
it.fail((WIN && CHROMIUM) || FFOX)('headless should be able to read cookies written by headful', async({server}) => {
const userDataDir = await makeUserDataDir();
// Write a cookie in headful chrome
const headfulContext = await playwright.launchPersistent(userDataDir, headfulOptions);
@ -59,7 +59,7 @@ module.exports.describe = function({testRunner, expect, playwright, defaultBrows
await removeUserDataDir(userDataDir);
expect(cookie).toBe('foo=true');
});
it.skip(FFOX)('should close browser with beforeunload page', async({server}) => {
it.fail(FFOX)('should close browser with beforeunload page', async({server}) => {
const userDataDir = await makeUserDataDir();
const browserContext = await playwright.launchPersistent(userDataDir, headfulOptions);
const page = await browserContext.newPage();

View File

@ -524,7 +524,7 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, p
});
});
describe.skip(FFOX)('Interception.setOfflineMode', function() {
describe.fail(FFOX)('Interception.setOfflineMode', function() {
it('should work', async({page, server}) => {
await page.setOfflineMode(true);
let error = null;

View File

@ -78,7 +78,7 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT,
await page.keyboard.sendCharacters('a');
expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('嗨a');
});
it.skip(FFOX)('should report shiftKey', async({page, server}) => {
it.fail(FFOX)('should report shiftKey', async({page, server}) => {
await page.goto(server.PREFIX + '/input/keyboard.html');
const keyboard = page.keyboard;
const codeForKey = {'Shift': 16, 'Alt': 18, 'Control': 17};
@ -241,7 +241,7 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT,
await textarea.type('👹 Tokyo street Japan 🇯🇵');
expect(await frame.$eval('textarea', textarea => textarea.value)).toBe('👹 Tokyo street Japan 🇯🇵');
});
it.skip(CHROMIUM && MAC)('should handle selectAll', async({page, server}) => {
it.fail(CHROMIUM && MAC)('should handle selectAll', async({page, server}) => {
await page.goto(server.PREFIX + '/input/textarea.html');
const textarea = await page.$('textarea');
await textarea.type('some text');
@ -252,7 +252,7 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT,
await page.keyboard.press('Backspace');
expect(await page.$eval('textarea', textarea => textarea.value)).toBe('');
});
it.skip(CHROMIUM && MAC)('should be able to prevent selectAll', async({page, server}) => {
it.fail(CHROMIUM && MAC)('should be able to prevent selectAll', async({page, server}) => {
await page.goto(server.PREFIX + '/input/textarea.html');
const textarea = await page.$('textarea');
await textarea.type('some text');

View File

@ -283,7 +283,7 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, p
// This might throw. See https://github.com/GoogleChrome/puppeteer/issues/2778
await removeUserDataDir(userDataDir);
});
it.skip(FFOX)('userDataDir option should restore state', async({server}) => {
it.fail(FFOX)('userDataDir option should restore state', async({server}) => {
const userDataDir = await makeUserDataDir();
const browserContext = await playwright.launchPersistent(userDataDir, defaultBrowserOptions);
const page = await browserContext.newPage();
@ -309,7 +309,7 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, p
await removeUserDataDir(userDataDir2);
});
// See https://github.com/microsoft/playwright/issues/717
it.skip(FFOX || (WIN && CHROMIUM))('userDataDir option should restore cookies', async({server}) => {
it.fail(FFOX || (WIN && CHROMIUM))('userDataDir option should restore cookies', async({server}) => {
const userDataDir = await makeUserDataDir();
const browserContext = await playwright.launchPersistent(userDataDir, defaultBrowserOptions);
const page = await browserContext.newPage();

View File

@ -231,7 +231,7 @@ module.exports.describe = function({testRunner, expect, MAC, WIN, FFOX, CHROMIUM
expect(responses[0].request()).toBeTruthy();
});
it.skip(FFOX)('Page.Events.RequestFailed', async({page, server}) => {
it.fail(FFOX)('Page.Events.RequestFailed', async({page, server}) => {
server.setRoute('/one-style.css', (req, res) => {
req.socket.write('deadbeef');
req.socket.end();

View File

@ -667,7 +667,7 @@ module.exports.describe = function({testRunner, expect, headless, playwright, FF
});
// Firefox fires onload for blocked script before it issues the CSP console error.
it.skip(FFOX)('should throw when added with content to the CSP page', async({page, server}) => {
it.fail(FFOX)('should throw when added with content to the CSP page', async({page, server}) => {
await page.goto(server.PREFIX + '/csp.html');
let error = null;
await page.addScriptTag({ content: 'window.__injected = 35;' }).catch(e => error = e);

View File

@ -20,7 +20,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('window.open', function() {
it.skip(CHROMIUM)('should inherit user agent from browser context', async function({browser, server}) {
it.fail(CHROMIUM)('should inherit user agent from browser context', async function({browser, server}) {
const context = await browser.newContext({
userAgent: 'hey'
});
@ -36,7 +36,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
expect(userAgent).toBe('hey');
expect(request.headers['user-agent']).toBe('hey');
});
it.skip(CHROMIUM)('should inherit extra headers from browser context', async function({browser, server}) {
it.fail(CHROMIUM)('should inherit extra headers from browser context', async function({browser, server}) {
const context = await browser.newContext({
extraHTTPHeaders: { 'foo': 'bar' },
});
@ -48,7 +48,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
await context.close();
expect(request.headers['foo']).toBe('bar');
});
it.skip(CHROMIUM)('should inherit touch support from browser context', async function({browser, server}) {
it.fail(CHROMIUM)('should inherit touch support from browser context', async function({browser, server}) {
const context = await browser.newContext({
viewport: { width: 400, height: 500, isMobile: true }
});
@ -61,7 +61,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
await context.close();
expect(hasTouch).toBe(true);
});
it.skip(CHROMIUM)('should inherit viewport size from browser context', async function({browser, server}) {
it.fail(CHROMIUM)('should inherit viewport size from browser context', async function({browser, server}) {
const context = await browser.newContext({
viewport: { width: 400, height: 500 }
});
@ -74,7 +74,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
await context.close();
expect(size).toEqual({width: 400, height: 500});
});
it.skip(CHROMIUM)('should apply addInitScript from browser context', async function({browser, server}) {
it.fail(CHROMIUM)('should apply addInitScript from browser context', async function({browser, server}) {
const context = await browser.newContext();
await context.addInitScript(() => window.injected = 123);
const page = await context.newPage();
@ -100,7 +100,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
expect(await popup.evaluate(() => !!window.opener)).toBe(true);
await context.close();
});
it.skip(CHROMIUM)('should work with empty url', async({browser}) => {
it.fail(CHROMIUM)('should work with empty url', async({browser}) => {
const context = await browser.newContext();
const page = await context.newPage();
const [popup] = await Promise.all([

View File

@ -117,7 +117,7 @@ module.exports.describe = function({testRunner, expect, product, FFOX, CHROMIUM,
expect(screenshots[i]).toBeGolden(`grid-cell-${i}.png`);
await Promise.all(pages.map(page => page.close()));
});
it.skip(FFOX)('should allow transparency', async({page, server}) => {
it.fail(FFOX)('should allow transparency', async({page, server}) => {
await page.setViewportSize({ width: 50, height: 150 });
await page.setContent(`
<style>
@ -156,7 +156,7 @@ module.exports.describe = function({testRunner, expect, product, FFOX, CHROMIUM,
});
expect(Buffer.from(screenshot, 'base64')).toBeGolden('screenshot-sanity.png');
});
it.skip(FFOX)('should work with a mobile viewport', async({browser, server}) => {
it.fail(FFOX)('should work with a mobile viewport', async({browser, server}) => {
const context = await browser.newContext({viewport: { width: 320, height: 480, isMobile: true }});
const page = await context.newPage();
await page.goto(server.PREFIX + '/overflow.html');
@ -176,7 +176,7 @@ module.exports.describe = function({testRunner, expect, product, FFOX, CHROMIUM,
const screenshot = await page.screenshot();
expect(screenshot).toBeGolden('screenshot-translateZ.png');
});
it.skip(FFOX || WEBKIT)('should work for webgl', async({page, server}) => {
it.fail(FFOX || WEBKIT)('should work for webgl', async({page, server}) => {
await page.setViewportSize({width: 640, height: 480});
await page.goto(server.PREFIX + '/screenshots/webgl.html');
const screenshot = await page.screenshot();

4
test/types.d.ts vendored
View File

@ -22,9 +22,9 @@ interface Expect<T> {
not: Expect<T>;
}
type DescribeFunction = ((name: string, inner: () => void) => void) & {skip(condition: boolean): DescribeFunction};
type DescribeFunction = ((name: string, inner: () => void) => void) & {fail(condition: boolean): DescribeFunction};
type ItFunction<STATE> = ((name: string, inner: (state: STATE) => Promise<void>) => void) & {skip(condition: boolean): ItFunction<STATE>; repeat(n: number): ItFunction<STATE>};
type ItFunction<STATE> = ((name: string, inner: (state: STATE) => Promise<void>) => void) & {fail(condition: boolean): ItFunction<STATE>; repeat(n: number): ItFunction<STATE>};
type TestRunner<STATE> = {
describe: DescribeFunction;

View File

@ -117,7 +117,7 @@ module.exports.describe = function({testRunner, expect, product, playwright, FFO
await page.evaluate(() => window.__FOO = 'hit');
await watchdog;
});
it.skip(FFOX)('should work with strict CSP policy', async({page, server}) => {
it.fail(FFOX)('should work with strict CSP policy', async({page, server}) => {
server.setCSP('/empty.html', 'script-src ' + server.PREFIX);
await page.goto(server.EMPTY_PAGE);
let error = null;

View File

@ -131,7 +131,7 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT})
expect(response.request()).toBe(request);
expect(response.ok()).toBe(true);
});
false && it.skip(FFOX)('should report web socket activity', async function({page, server}) {
false && it.fail(FFOX)('should report web socket activity', async function({page, server}) {
const [worker] = await Promise.all([
page.waitForEvent('worker'),
page.goto(server.PREFIX + '/worker/worker.html'),

View File

@ -72,13 +72,13 @@ const TestMode = {
Run: 'run',
Skip: 'skip',
Focus: 'focus',
Fail: 'fail',
ExpectToFail: 'fail',
Flake: 'flake'
};
const TestResult = {
Ok: 'ok',
Skipped: 'skipped', // User skipped the test
ExpectToFail: 'skipped', // User marked as failed
Failed: 'failed', // Exception happened during running
TimedOut: 'timedout', // Timeout Exceeded while running
Terminated: 'terminated', // Execution terminated
@ -138,7 +138,7 @@ class TestPass {
for (let suite = test.suite; suite; suite = suite.parentSuite)
this._workerDistribution.set(suite, workerId);
// Do not shard skipped tests across workers.
if (test.declaredMode !== TestMode.Skip)
if (test.declaredMode !== TestMode.ExpectToFail)
workerId = (workerId + 1) % parallel;
}
@ -200,8 +200,8 @@ class TestPass {
if (this._termination)
return;
this._runner._willStartTest(test, workerId);
if (test.declaredMode === TestMode.Skip) {
test.result = TestResult.Skipped;
if (test.declaredMode === TestMode.ExpectToFail) {
test.result = TestResult.ExpectToFail;
this._runner._didFinishTest(test, workerId);
return;
}
@ -296,7 +296,7 @@ function specBuilder(action) {
};
func.fail = condition => {
if (condition)
mode = TestMode.Fail;
mode = TestMode.ExpectToFail;
return func;
};
func.flake = condition => {
@ -344,15 +344,13 @@ class TestRunner extends EventEmitter {
this.it = specBuilder((mode, name, callback) => this._addTest(name, callback, mode, this._timeout));
this.fit = specBuilder((mode, name, callback) => this._addTest(name, callback, TestMode.Focus, this._timeout));
this.xit = specBuilder((mode, name, callback) => this._addTest(name, callback, TestMode.Skip, this._timeout));
this._debuggerLogBreakpointLines = new Multimap();
this.dit = (name, callback) => {
this.dit = specBuilder((mode, name, callback) => {
const test = this._addTest(name, callback, TestMode.Focus, INFINITE_TIMEOUT);
const N = callback.toString().split('\n').length;
for (let i = 0; i < N; ++i)
this._debuggerLogBreakpointLines.set(test.location.filePath, i + test.location.lineNumber);
};
this.dit.skip = () => this.dit; // no-op;
});
this._debuggerLogBreakpointLines = new Multimap();
this.beforeAll = this._addHook.bind(this, 'beforeAll');
this.beforeEach = this._addHook.bind(this, 'beforeEach');
@ -370,11 +368,15 @@ class TestRunner extends EventEmitter {
}
_addTest(name, callback, mode, timeout) {
if (mode === TestMode.Skip)
return;
let suite = this._currentSuite;
let isSkipped = suite.declaredMode === TestMode.Skip;
let expectToFail = suite.declaredMode === TestMode.ExpectToFail;
while ((suite = suite.parentSuite))
isSkipped |= suite.declaredMode === TestMode.Skip;
const test = new Test(this._currentSuite, name, callback, isSkipped ? TestMode.Skip : mode, timeout);
expectToFail |= suite.declaredMode === TestMode.ExpectToFail;
if (expectToFail)
mode = TestMode.ExpectToFail;
const test = new Test(this._currentSuite, name, callback, mode, timeout);
this._currentSuite.children.push(test);
this._tests.push(test);
this._hasFocusedTestsOrSuites = this._hasFocusedTestsOrSuites || mode === TestMode.Focus;
@ -382,11 +384,13 @@ class TestRunner extends EventEmitter {
}
_addSuite(mode, name, callback, ...args) {
if (mode === TestMode.Skip)
return;
const oldSuite = this._currentSuite;
const suite = new Suite(this._currentSuite, name, mode);
this._currentSuite.children.push(suite);
this._currentSuite = suite;
const result = callback(...args);
callback(...args);
this._currentSuite = oldSuite;
this._hasFocusedTestsOrSuites = this._hasFocusedTestsOrSuites || mode === TestMode.Focus;
}