When we define mochaOpts
in Protractor, we define one parameter as slow. I do not understand what is the use of that parameter. I tried changing it's value but I can't see any change in test execution time.
mochaOpts: {
reporter: 'spec',
slow: 1000,
}
The beforeEach method is a feature (hook) in test libraries that you can use to set preconditions for each test. Just like the name suggests, it runs before each test in your test suite. For example, the beforeEach method will run four times in a suite with four tests.
Whenever you run Mocha at the command line, it will read this file and set a timeout of 5 seconds by default. Another way which may be better depending on your situation is to set it like this in a top level describe call in your test file: describe("something", function () { this. timeout(5000); // tests... });
Mocha does not run individual tests in parallel. That means if you hand Mocha a single, lonely test file, it will spawn a single worker process, and that worker process will run the file. If you only have one test file, you'll be penalized for using parallel mode. Don't do that.
ctx is the context in effect where the describe call appears, which happens to be the same context as this in the afterEach call. I would actually recommend not traversing Mocha's internal structures and instead doing something like: describe('main describe', function() { var prop; afterEach(function() { console.
According to the documentation its used for testing
-s, --slow
Specify the "slow" test threshold, defaulting to 75ms. Mocha uses this to highlight test-cases that are taking too long.
To tweak what's considered "slow", you can use the slow() method:
describe('something slow', function() { this.slow(10000); it('should take long enough for me to go make a sandwich', function() { // ... }); });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With