@wdio/jasmine-framework 9.16.2 → 9.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.d.ts +11 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +19 -9
- package/build/utils.d.ts.map +1 -1
- package/package.json +9 -8
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { EventEmitter } from 'node:events';
|
|
2
2
|
import type { Services, Capabilities } from '@wdio/types';
|
|
3
|
+
import type { expect as wdioExpectImport, matchers as wdioMatchersImport, getConfig as wdioGetConfig } from 'expect-webdriverio';
|
|
3
4
|
import type { JasmineOpts as jasmineNodeOpts, ResultHandlerPayload, FrameworkMessage, FormattedMessage } from './types.js';
|
|
4
5
|
type HooksArray = {
|
|
5
6
|
[K in keyof Required<Services.HookFunctions>]: Required<Services.HookFunctions>[K][];
|
|
@@ -25,6 +26,16 @@ declare class JasmineAdapter {
|
|
|
25
26
|
private _jrunner;
|
|
26
27
|
constructor(_cid: string, _config: WebdriverIOJasmineConfig, _specs: string[], _capabilities: Capabilities.ResolvedTestrunnerCapabilities, reporter: EventEmitter);
|
|
27
28
|
init(): Promise<this>;
|
|
29
|
+
/**
|
|
30
|
+
* We have to ensure that `@wdio/runner` and `@wdio/jasmine-framework` are using the same `expect` and `matchers` globals.
|
|
31
|
+
* This is why we have the `@wdio/runner` package pass on these primitives to the jasmine framework so that we can use them
|
|
32
|
+
* to setup the jasmine environment.
|
|
33
|
+
*
|
|
34
|
+
* @param wdioExpect - WebdriverIO expect
|
|
35
|
+
* @param wdioMatchers - WebdriverIO matchers
|
|
36
|
+
* @param getConfig - WebdriverIO getConfig
|
|
37
|
+
*/
|
|
38
|
+
setupExpect(wdioExpect: typeof wdioExpectImport, wdioMatchers: typeof wdioMatchersImport, getConfig: typeof wdioGetConfig): Promise<void>;
|
|
28
39
|
_loadFiles(): Promise<void>;
|
|
29
40
|
_grep(suite: jasmine.Suite): void;
|
|
30
41
|
hasTests(): boolean;
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAM/C,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,KAAK,EAAE,MAAM,IAAI,gBAAgB,EAAE,QAAQ,IAAI,kBAAkB,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAIhI,OAAO,KAAK,EACR,WAAW,IAAI,eAAe,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,gBAAgB,EAC3F,MAAM,YAAY,CAAA;AAsBnB,KAAK,UAAU,GAAG;KACb,CAAC,IAAI,MAAM,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE;CACvF,CAAA;AAED,UAAU,wBAAyB,SAAQ,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,UAAU,CAAC,EAAE,UAAU;IAC7F,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,CAAA;CACnD;AAED;;GAEG;AACH,cAAM,cAAc;;IAWZ,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,aAAa;IAbzB,OAAO,CAAC,YAAY,CAAiB;IACrC,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,WAAW,CAAI;IACvB,OAAO,CAAC,SAAS,CAAO;IACxB,OAAO,CAAC,S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 +3,6 @@ import url from "node:url";
|
|
|
3
3
|
import Jasmine from "jasmine";
|
|
4
4
|
import logger2 from "@wdio/logger";
|
|
5
5
|
import { wrapGlobalTestMethod, executeHooksWithArgs } from "@wdio/utils";
|
|
6
|
-
import { expect as expectImport, matchers, getConfig } from "expect-webdriverio";
|
|
7
6
|
import { _setGlobal } from "@wdio/globals";
|
|
8
7
|
|
|
9
8
|
// src/reporter.ts
|
|
@@ -320,10 +319,23 @@ var JasmineAdapter = class {
|
|
|
320
319
|
globalThis._jasmineTestResult = this.result;
|
|
321
320
|
executeMock.apply(this, args);
|
|
322
321
|
};
|
|
322
|
+
return this;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* We have to ensure that `@wdio/runner` and `@wdio/jasmine-framework` are using the same `expect` and `matchers` globals.
|
|
326
|
+
* This is why we have the `@wdio/runner` package pass on these primitives to the jasmine framework so that we can use them
|
|
327
|
+
* to setup the jasmine environment.
|
|
328
|
+
*
|
|
329
|
+
* @param wdioExpect - WebdriverIO expect
|
|
330
|
+
* @param wdioMatchers - WebdriverIO matchers
|
|
331
|
+
* @param getConfig - WebdriverIO getConfig
|
|
332
|
+
*/
|
|
333
|
+
async setupExpect(wdioExpect, wdioMatchers, getConfig) {
|
|
334
|
+
const { jasmine } = this._jrunner;
|
|
335
|
+
const jasmineEnv = jasmine.getEnv();
|
|
323
336
|
const expect = jasmineEnv.expectAsync;
|
|
324
|
-
const
|
|
325
|
-
jasmineEnv.beforeAll(() => jasmineEnv.addAsyncMatchers(
|
|
326
|
-
const wdioExpect = expectImport;
|
|
337
|
+
const matchers = this.#setupMatchers(jasmine, wdioMatchers, getConfig);
|
|
338
|
+
jasmineEnv.beforeAll(() => jasmineEnv.addAsyncMatchers(matchers));
|
|
327
339
|
for (const matcher of EXPECT_ASYMMETRIC_MATCHERS) {
|
|
328
340
|
expect[matcher] = wdioExpect[matcher];
|
|
329
341
|
}
|
|
@@ -331,7 +343,6 @@ var JasmineAdapter = class {
|
|
|
331
343
|
_setGlobal("expect", expect, this._config.injectGlobals);
|
|
332
344
|
await this._loadFiles();
|
|
333
345
|
_setGlobal("expect", expect, this._config.injectGlobals);
|
|
334
|
-
return this;
|
|
335
346
|
}
|
|
336
347
|
async _loadFiles() {
|
|
337
348
|
try {
|
|
@@ -418,7 +429,6 @@ Spec file(s): ${this._specs.join(",")}
|
|
|
418
429
|
}, this._lastTest);
|
|
419
430
|
break;
|
|
420
431
|
}
|
|
421
|
-
console.log("----F", params);
|
|
422
432
|
return this.formatMessage(params);
|
|
423
433
|
}
|
|
424
434
|
formatMessage(params) {
|
|
@@ -472,8 +482,8 @@ Spec file(s): ${this._specs.join(",")}
|
|
|
472
482
|
return origHandler.call(this, passed, data);
|
|
473
483
|
};
|
|
474
484
|
}
|
|
475
|
-
#transformMatchers(
|
|
476
|
-
return Object.entries(
|
|
485
|
+
#transformMatchers(matchers) {
|
|
486
|
+
return Object.entries(matchers).reduce((prev, [name, fn]) => {
|
|
477
487
|
prev[name] = (util) => ({
|
|
478
488
|
compare: async (actual, expected, ...args) => fn(util).compare(actual, expected, ...args),
|
|
479
489
|
negativeCompare: async (actual, expected, ...args) => {
|
|
@@ -487,7 +497,7 @@ Spec file(s): ${this._specs.join(",")}
|
|
|
487
497
|
return prev;
|
|
488
498
|
}, {});
|
|
489
499
|
}
|
|
490
|
-
#setupMatchers(jasmine) {
|
|
500
|
+
#setupMatchers(jasmine, matchers, getConfig) {
|
|
491
501
|
globalThis.jasmine.addMatchers = (matchers2) => globalThis.jasmine.addAsyncMatchers(this.#transformMatchers(matchers2));
|
|
492
502
|
const syncMatchers = this.#transformMatchers(jasmine.matchers);
|
|
493
503
|
const wdioMatchers = [...matchers.entries()].reduce((prev, [name, fn]) => {
|
package/build/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,UAAU,qBAAqB;IAC3B,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,MAAM,MAAM,CAAA;CACxB;AASD,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,UAAU,qBAAqB;IAC3B,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,MAAM,MAAM,CAAA;CACxB;AASD,eAAO,MAAM,mBAAmB,GAAI,QAAQ,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC,EAAE,OAAO,OAAO;;;;;;EAKjH,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/jasmine-framework",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.18.0",
|
|
4
4
|
"description": "A WebdriverIO plugin. Adapter for Jasmine testing framework.",
|
|
5
5
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-jasmine-framework",
|
|
@@ -35,21 +35,22 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@types/node": "^20.1.0",
|
|
38
|
-
"@wdio/globals": "9.
|
|
39
|
-
"@wdio/logger": "9.
|
|
38
|
+
"@wdio/globals": "9.17.0",
|
|
39
|
+
"@wdio/logger": "9.18.0",
|
|
40
40
|
"@wdio/types": "9.16.2",
|
|
41
|
-
"@wdio/utils": "9.
|
|
41
|
+
"@wdio/utils": "9.18.0",
|
|
42
42
|
"jasmine": "^5.0.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@types/jasmine": "5.1.
|
|
45
|
+
"@types/jasmine": "5.1.8",
|
|
46
|
+
"expect-webdriverio": "^5.3.4"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|
|
48
|
-
"
|
|
49
|
+
"@wdio/runner": "^9.16.2",
|
|
49
50
|
"webdriverio": "^9.0.0"
|
|
50
51
|
},
|
|
51
52
|
"peerDependenciesMeta": {
|
|
52
|
-
"
|
|
53
|
+
"@wdio/runner": {
|
|
53
54
|
"optional": false
|
|
54
55
|
},
|
|
55
56
|
"webdriverio": {
|
|
@@ -59,5 +60,5 @@
|
|
|
59
60
|
"publishConfig": {
|
|
60
61
|
"access": "public"
|
|
61
62
|
},
|
|
62
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "a515cdf9ce892da87708c290dd2b05b051bbe602"
|
|
63
64
|
}
|