extends Spec #204
extends Spec
#204
-
Hi ! I need to add signature of request. The first one, in javascript, works const Spec = require("pactum/src/models/Spec");
class MySpec extends Spec {
withSignature(appSecret) {
this._request.queryParams.signature = md5((new Date()).getTime() + appSecret)
}
}
const myspec = new MySpec ()
await myspec
.withMethod(method)
.withPath(uri)
.withSignature("mySecret") So I tried to do same behavior in Typescript, but it do not work. const Spec = require("pactum/src/models/Spec");
class ApiSpec extends Spec
{
withSignature(appSecret) {
this._request.queryParams.signature = md5((new Date()).getTime() + this._request.url + appSecret)
}
} .\node_modules\.bin\cucumber-js -p default feature/**/*.feature
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './src/models/Spec' is not defined by "exports" in C:\Users\bfy\Documents\GitHub\pactum-ts\node_modules\pactum\package.json
at new NodeError (node:internal/errors:387:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:464:9)
at packageExportsResolve (node:internal/modules/esm/resolve:748:3)
at resolveExports (node:internal/modules/cjs/loader:493:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:533:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:942:27)
at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (C:\Users\bfy\Documents\GitHub\pactum-ts\node_modules\@cspotcode\source-map-support\source-map-support.js:811:30)
at Function.Module._load (node:internal/modules/cjs/loader:804:27)
at Module.require (node:internal/modules/cjs/loader:1028:19)
at require (node:internal/modules/cjs/helpers:102:18) Is it possible to extends Spec class ? Thanks |
Beta Was this translation helpful? Give feedback.
Answered by
ASaiAnudeep
Sep 11, 2022
Replies: 1 comment
-
This has been fixed. Please use the latest version - v3.2.2 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
fbruno93
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This has been fixed. Please use the latest version - v3.2.2