en.javascript.info/1-js/03-code-quality/05-testing-mocha/beforeafter.view/test.js

18 lines
654 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

describe("test", function() {
// Mocha usually waits for the tests for 2 seconds before considering them wrong
this.timeout(200000); // With this code we increase this - in this case to 200,000 milliseconds
// This is because of the "alert" function, because if you delay pressing the "OK" button the tests will not pass!
before(() => alert("Testing started before all tests"));
after(() => alert("Testing finished after all tests"));
beforeEach(() => alert("Before a test enter a test"));
afterEach(() => alert("After a test exit a test"));
it('test 1', () => alert(1));
it('test 2', () => alert(2));
});