Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 55 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
}
},
"dependencies": {
"browser-extension-url-match": "^0.3.3",
"browser-extension-url-match": "^1.0.0",
"lodash": "^4.17.21",
"mitt": "^3.0.1",
"webpack-merge": "^5.9.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// ==UserScript==
// @name Url with port
// @grant GM_addElement
// @include *://localhost/
// @version 1.0.0
// ==/UserScript==

;(() => {
GM_addElement(document.body, "div", { class: "index1" })
})()
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// ==UserScript==
// @name Url with port
// @grant GM_addElement
// @include *://localhost/
// @version 1.0.0
// ==/UserScript==
1 change: 1 addition & 0 deletions tests/cases/url-with-port/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const div = GM_addElement(document.body, "div", { class: "index1" })
5 changes: 5 additions & 0 deletions tests/cases/url-with-port/meta.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
name: "Url with port",
version: "1.0.0",
include: ["*://localhost/"],
}
27 changes: 27 additions & 0 deletions tests/cases/url-with-port/url.with.port.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import path from "path"
import { monkey } from "../../../src"
import { test } from "../../env"
import { testBuild, withCommonConfig} from "../../utils/webpack"
import { expect } from "@playwright/test"

const config = withCommonConfig({
entry: path.resolve(__dirname, "index.js"),
output: {
path: path.resolve(__dirname, "dist"),
},
devServer: {
host: "localhost" // force host to be localhost because 127.0.0.1 will not match
},
})

test("build", () => testBuild(monkey(config)))

test("Test url with port in the browser", async ({ page, devServerHot, installDevScript }) => {
const { origin } = await devServerHot(monkey(config))

await installDevScript(origin)

await page.goto(origin)

await expect(page.locator(".index1")).toBeAttached()
})