Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
sonnyp committed Dec 21, 2024
1 parent 7cb8a01 commit a732c5a
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ test:

ci:
npm install
npx jest
make unit
make lint
make restart
npx lerna run prepublish
node bundle.js
make e2e
make bundlesize

unit:
npx jest

e2e:
NODE_TLS_REJECT_UNAUTHORIZED=0 npx jest --runInBand --config e2e.config.js
NODE_TLS_REJECT_UNAUTHORIZED=0 npx jest --runInBand --config e2e.config.cjs

clean:
make stop
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
"uglify-js": "^3.19.3"
},
"scripts": {
"test": "npx jest",
"lint": "eslint --cache .",
"preversion": "make bundle"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ function component(options) {
});
}

export default { xml, jid, component };
export { xml, jid, component };
13 changes: 5 additions & 8 deletions packages/resolve/lib/http.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@

// FIXME
// const fetch = globalThis.fetch || import("node-fetch");

import parse from "@xmpp/xml/lib/parse.js";
import { compare as compareAltConnections } from "./alt-connections.js";

export function resolve(domain) {
// eslint-disable-next-line n/no-unsupported-features/node-builtins
return globalThis
.fetch(`https://${domain}/.well-known/host-meta`)
export async function resolve(domain) {
// eslint-disable-next-line n/no-unsupported-features/node-builtins, unicorn/no-await-expression-member
const fetch = globalThis.fetch || (await import("node-fetch")).default;

return fetch(`https://${domain}/.well-known/host-meta`)
.then((res) => res.text())
.then((res) => {
return parse(res)
Expand Down
4 changes: 3 additions & 1 deletion server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import net from "net";
import { promise, delay } from "@xmpp/events";
import selfsigned from "selfsigned";

// const __dirname = import.meta.dirname;

const readFile = promisify(fs.readFile);
const exec = promisify(child_process.exec);
const removeFile = promisify(fs.unlink);
Expand Down Expand Up @@ -116,7 +118,7 @@ async function restart(signal) {
return _start();
}

export {
export default {
isPortOpen,
waitPortClose,
waitPortOpen,
Expand Down
4 changes: 2 additions & 2 deletions test/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ const options = { password, service, domain };

let xmpp;

beforeEach(() => {
beforeEach(async () => {
xmpp = component(options);
debug(xmpp);
return server.restart();
await server.restart();
});

afterEach(async () => {
Expand Down

0 comments on commit a732c5a

Please sign in to comment.