Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
sonnyp committed Dec 20, 2024
1 parent cdf870d commit c124e14
Show file tree
Hide file tree
Showing 15 changed files with 158 additions and 1,796 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ At that point you can make changes to the xmpp.js code and run tests with
make test
```

If you want to iterate faster, you can watch a test file with `npx ava --watch packages/debug/test.js`.
If you want to iterate faster, you can watch a test file with `npx jest --watch packages/debug/test.js`.

See [ava CLI](https://github.com/avajs/ava/blob/main/docs/05-command-line.md).
See [Jest CLI](https://jestjs.io/docs/cli).

## Submitting

Expand Down
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: setup lint test ci clean start stop restart bundlesize bundle size cert ncu
.PHONY: setup lint test ci clean start stop restart bundlesize bundle size ncu

setup:
node packages/xmpp.js/script.js
Expand All @@ -7,7 +7,7 @@ setup:
node bundle.js

lint:
./node_modules/.bin/eslint --cache .
npx eslint --cache .

test:
cd packages/xmpp.js/ && npm run prepublish
Expand All @@ -22,19 +22,22 @@ ci:
npx jest
make lint
make restart
./node_modules/.bin/lerna run prepublish
npx lerna run prepublish
node bundle.js
./node_modules/.bin/ava --config e2e.config.js
make e2e
make bundlesize

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

clean:
make stop
rm -f server/localhost.key
rm -f server/localhost.crt
rm -f server/prosody.err
rm -f server/prosody.log
rm -f server/prosody.pid
./node_modules/.bin/lerna clean --yes
npx lerna clean --yes
rm -rf node_modules/
rm -f packages/*/dist/*.js
rm -f lerna-debug.log
Expand All @@ -49,7 +52,7 @@ restart:
./server/ctl.js restart

bundlesize:
./node_modules/.bin/bundlesize
npx bundlesize

bundle:
node bundle.js
Expand Down
30 changes: 0 additions & 30 deletions ava.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

module.exports = (api) => {
module.exports = function config(api) {
const isTest = api.env("test");

if (isTest) {
Expand Down
31 changes: 6 additions & 25 deletions e2e.config.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,7 @@
export default {
failFast: true,
serial: true,
babel: {
testOptions: {
babelrc: false,
plugins: [
[
"@babel/plugin-transform-react-jsx",
{
pragma: "xml",
},
],
[
"babel-plugin-jsx-pragmatic",
{
module: "@xmpp/xml",
import: "xml",
},
],
],
},
},
nodeArguments: ["--experimental-require-module"],
files: ["test/*.js"],
"use strict";

/** @type {import('jest').Config} */
module.exports = {
testMatch: ["<rootDir>/test/*.js"],
setupFilesAfterEnv: ["jest-extended/all"],
};
21 changes: 15 additions & 6 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ export default [
"**/dist/*.js",
"bundle.js",
"packages/xmpp.js/index.js",
"ava.config.js",
"e2e.config.js",
"eslint.config.mjs",
],
},
Expand Down Expand Up @@ -64,11 +62,11 @@ export default [
"n/no-unpublished-require": 0, // doesn't play nice with monorepo
"n/no-extraneous-require": [
"error",
{ allowModules: ["ava", "sinon", "@xmpp/test"] },
{ allowModules: ["sinon", "@xmpp/test"] },
],
"n/no-extraneous-import": [
"error",
{ allowModules: ["ava", "sinon", "@xmpp/test"] },
{ allowModules: ["sinon", "@xmpp/test"] },
],

// promise
Expand Down Expand Up @@ -108,8 +106,19 @@ export default [
"jest/no-disabled-tests": "warn",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/prefer-to-have-length": "warn",
"jest/valid-expect": "error",
"jest/prefer-to-have-length": "error",

// https://github.com/jest-community/eslint-plugin-jest/pull/1688
"jest/valid-expect": "off",
// "jest/valid-expect": [
// "error",
// {
// alwaysAwait: true,
// // For jest-extended expect().pass
// minArgs: 0,
// },
// ],
"promise/no-callback-in-promise": "off",
},
},
];
5 changes: 2 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
const { defaults } = require("jest-config");

/** @type {import('jest').Config} */
const config = {
module.exports = {
testMatch: [...defaults.testMatch, "**/test/*.js"],
testPathIgnorePatterns: [
...defaults.testPathIgnorePatterns,
"<rootDir>/test/",
"<rootDir>/packages/test/",
],
setupFilesAfterEnv: ["jest-extended/all"],
};

module.exports = config;
Loading

0 comments on commit c124e14

Please sign in to comment.