Skip to content

Commit

Permalink
feat: Jest Test Runner (#2170)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinr1234 authored Feb 3, 2023
1 parent 5a63f18 commit 5fe480e
Show file tree
Hide file tree
Showing 229 changed files with 14,254 additions and 17,790 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x, 16.x, 18.x]
node-version: [14.x, 16.x, 18.x]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x, 16.x, 18.x]
node-version: [14.x, 16.x, 18.x]

services:
rippled:
Expand Down
4 changes: 4 additions & 0 deletions .ncurc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"reject": [
]
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v12
v14
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,12 @@
"**/.git/subtree-cache/**": true,
"**/.hg/store/**": true
},
"search.exclude": {
"**/.git": true,
"**/node_modules": true,
"**/tmp": true,
"**/docs/**/*.html": true,
"**/fixtures/**/*.json": true,
"**/docs/assets": true
},
}
2 changes: 0 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ If your code connects to the ledger (ex. Adding a new transaction type) it's han

All integration tests should be written in the `test/integration` folder, with new `Requests` and `Transactions` tests being in their respective folders.

One last note for integration tests is that all imports from `xrpl.js` should be from `xrpl-local` instead of `../../src`. This is required for the integraiton tests to run in the browser.

For an example of how to write an integration test for `xrpl.js`, you can look at the [Payment integration test](./packages/xrpl/test/integration/transactions/payment.ts).

## Generate reference docs
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ All of which works in Node.js (tested for v14+) & web browsers (tested for Chrom

### Requirements

- **[Node.js v14](https://nodejs.org/)** is recommended. We also support v12 and v16. Other versions may work but are not frequently tested.
+ **[Node.js v14](https://nodejs.org/)** is recommended. We also support v16 and v18. Other versions may work but are not frequently tested.

### Installing xrpl.js

Expand Down
20 changes: 20 additions & 0 deletions jest.config.base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { TextDecoder, TextEncoder } = require("util");

module.exports = {
roots: ["<rootDir>/src"],
transform: {
"^.+\\.ts$": "ts-jest",
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
collectCoverage: true,
verbose: true,
testEnvironment: "node",
globals: {
TextDecoder: TextDecoder,
TextEncoder: TextEncoder,
error: console.error,
warn: console.warn,
info: console.info,
debug: console.debug,
},
};
8 changes: 8 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const path = require("path");
const base = require("./jest.config.base.js");

module.exports = {
...base,
projects: ["<rootDir>/packages/**/jest.config.js"],
coverageDirectory: "<rootDir>/coverage/",
};
Loading

0 comments on commit 5fe480e

Please sign in to comment.