File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* global: browser */
2
+ function inFirefox ( ) {
3
+ return browser . desiredCapabilities . browserName === 'firefox' ;
4
+ }
5
+
6
+ function inChrome ( ) {
7
+ return browser . desiredCapabilities . browserName === 'chrome' ;
8
+ }
9
+
10
+ /**
11
+ * Wrap the desired mochaMethod with `skipInFirefox` to prevent the
12
+ * corresponding test or group of tests from running in Firefox.
13
+ * example:
14
+ * `skipInFirefox(it)('does a thing that does not work in Firefox')`
15
+ * @param {Function } mochaMethod `it` or `describe`
16
+ * @returns {Function } mochaMethod or mochaMethod.skip
17
+ */
18
+ export function skipInFirefox ( mochaMethod ) {
19
+ // If mochaMethod doesn't have a skip method, assume that mochaMethod is
20
+ // already either a .skip or a .only
21
+ if ( ! mochaMethod . skip ) {
22
+ return mochaMethod ;
23
+ }
24
+
25
+ return inFirefox ( ) ? mochaMethod . skip : mochaMethod ;
26
+ }
27
+
28
+ /**
29
+ * Wrap the desired mochaMethod with `skipInChrome` to prevent the
30
+ * corresponding test or group of tests from running in Chrome.
31
+ * example:
32
+ * `skipInChrome(it)('does a thing that does not work in Chrome')`
33
+ * @param {Function } mochaMethod `it` or `describe`
34
+ * @returns {Function } mochaMethod or mochaMethod.skip
35
+ */
36
+ export function skipInChrome ( mochaMethod ) {
37
+ // If mochaMethod doesn't have a skip method, assume that mochaMethod is
38
+ // already either a .skip or a .only
39
+ if ( ! mochaMethod . skip ) {
40
+ return mochaMethod ;
41
+ }
42
+
43
+ return inChrome ( ) ? mochaMethod . skip : mochaMethod ;
44
+ }
You can’t perform that action at this time.
0 commit comments