-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Added minimal integration test as smoke test for importing poly…
…fill as es6 module
- Loading branch information
Showing
5 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html lang='en'> | ||
<head> | ||
<meta charset='utf-8'> | ||
</head> | ||
<body> | ||
<script type='module' src='browser-polyfill.js'></script> | ||
<script type='module' src='background.js'></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
browser.runtime.onMessage.addListener(async (msg, sender) => { | ||
return {bgReceived: msg}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
test("Test browser.runtime.onMessage on polyfill loaded as es6 module", async (t) => { | ||
const msg = "send-message-to-background-page"; | ||
const res = await browser.runtime.sendMessage(msg); | ||
t.deepEqual(res, {bgReceived: msg}, "Got the expected reply"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"manifest_version": 2, | ||
"name": "test-import-as-es6-module", | ||
"version": "0.1", | ||
"description": "test-import-as-es6-module", | ||
"content_scripts": [ | ||
{ | ||
"matches": [ | ||
"http://localhost/*" | ||
], | ||
"js": [ | ||
"browser-polyfill.js", | ||
"tape.js", | ||
"content.js" | ||
] | ||
} | ||
], | ||
"permissions": [], | ||
"background": { | ||
"page": "background.html" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters