playwright-msw
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -1,2 +0,2 @@ | ||
export * from './fixture'; | ||
export { MockServiceWorker } from './worker'; | ||
export { createWorkerFixture } from './fixture'; | ||
export { MockServiceWorker, createWorker } from './worker'; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./fixture"), exports); | ||
exports.createWorker = exports.createWorkerFixture = void 0; | ||
var fixture_1 = require("./fixture"); | ||
Object.defineProperty(exports, "createWorkerFixture", { enumerable: true, get: function () { return fixture_1.createWorkerFixture; } }); | ||
var worker_1 = require("./worker"); | ||
Object.defineProperty(exports, "createWorker", { enumerable: true, get: function () { return worker_1.createWorker; } }); |
@@ -9,2 +9,2 @@ import { Path, RequestHandler } from 'msw'; | ||
export declare const getHandlerPath: (handler: RequestHandler, config: Config) => Path; | ||
export declare const convertMswPathToPlaywrightUrl: (path: Path) => string | RegExp; | ||
export declare const convertMswPathToPlaywrightUrl: (path: Path) => RegExp; |
@@ -32,7 +32,14 @@ "use strict"; | ||
} | ||
const transformedPath = path.replace(/\/:[^/]+/g, '/*').replace(/\?.+/, ''); | ||
return transformedPath.endsWith('*') | ||
? transformedPath | ||
: `${transformedPath}*`; | ||
const originRegex = /(\w+:\/\/[^/]+)/u; | ||
return new RegExp([ | ||
'^', | ||
originRegex.test(path) ? '' : `${originRegex.source}?`, | ||
path | ||
.replace(/\?.*$/, '') | ||
.replace(/:[^/]+(\/|\?)?/g, '[^/]+$1'), | ||
'\\/?', | ||
'(\\?.*)?', | ||
'$', | ||
].join('')); | ||
}; | ||
exports.convertMswPathToPlaywrightUrl = convertMswPathToPlaywrightUrl; |
{ | ||
"name": "playwright-msw", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "A Mock Service Worker API for Playwright.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33764
17
355