Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BeforeAll is not defined (old jasmine)

I just installed Protractor v2.0.0. I tried to add beforeAll to a test and got error

ReferenceError: beforeAll is not defined

Looking at the the stacktrace I see jasmine 1.3.1 is a submodule of protractor:

C:\Users\bmackey\AppData\Roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:913:21

beforeAll is introduced in jasmine 2.1. I tried npm i -g jasmine-before-all to no avail. How can I get this functionality to work?

like image 851
P.Brian.Mackey Avatar asked Apr 09 '15 14:04

P.Brian.Mackey


People also ask

What is beforeall and beforeeach in a Jasmine spec?

The purpose of this article is to describe the behavior of the beforeAll and beforeEach functions in a Jasmine spec. beforeAll and beforeEach , along with afterAll and afterEach, are Jasmine global functions that can be used manage expensive setup and teardown in test suites.

What is the difference between the beforeall and beforeeach functions?

The beforeAll function executes once and only once for the describe block containing it, before any of the beforeEach functions or any of the specs. The beforeEach function executes before any spec in the describe block containing it, as well as before any spec contained inside any inner describe. You'll see this in A More Complex Example below.

When to use @beforeall and @Afterall in unit testing?

2. @BeforeAll and @AfterAll in Non-Static Methods While unit testing, we may occasionally want to use @BeforeAll and @AfterAll in non-static setup and tear-down methods — for instance, in a @ Nested test class or as interface default methods. Let's create a test class with the @BeforeAll and @AfterAll methods as non-static:

What is @beforeeach and @beforeall In JUnit 5?

@BeforeEach and @BeforeAll are the JUnit 5 equivalents of @Before and @BeforeClass. These annotations were renamed with clearer names to avoid confusion. Let's duplicate our previous classes using these new annotations, starting with the @BeforeEach and @AfterEach annotations:


1 Answers

Protractor is still using jasmine1 by default. You have to set jasmine version in your config

framework: 'jasmine2',

You can find more information in the reference configuration file

like image 119
Sulthan Avatar answered Nov 22 '22 08:11

Sulthan