Skip to content
Merged
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
16 changes: 16 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"prettier"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"prettier/prettier": "error"
}
}
41 changes: 18 additions & 23 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
name: Node CI

on:
push:
branches:
- $default-branch
pull_request:
branches:
- "*"

on: [push]
env:
FORCE_COLOR: 2
jobs:
build:

runs-on: ubuntu-latest

test:
name: v${{ matrix.node }} @ ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]

node: [14, 16, 18]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test
node-version: ${{ matrix.node }}
- run: npm install
- name: Build and run tests
run: |
npm run build --if-present
npm test
- name: Run browser tests and lint
run: |
npm install
npm run test
npm run browser-tests
npm run lint
env:
CI: true
8 changes: 8 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"require" : [
"ts-node/register"
],
"spec": "./test/test-vectors/*.ts",
"package": "./package.json",
"ui": "bdd"
}
54 changes: 27 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
],
"dependencies": {
"@noble/hashes": "1.1.2",
"@noble/secp256k1": "1.6.2",
"@noble/secp256k1": "1.6.3",
"@scure/bip32": "1.1.0",
"@scure/bip39": "1.1.0"
},
Expand All @@ -40,8 +40,8 @@
"test": "npm-run-all test:node",
"test:node": "mocha",
"clean": "rimraf test-builds bip39 '*.js' '*.js.map' '*.d.ts' '*.d.ts.map' 'src/**/*.js'",
"lint": "tslint --project tsconfig.json",
"lint:fix": "tslint --fix --project tsconfig.json",
"lint": "eslint",
"lint:fix": "eslint --fix",
"browser-tests": "npm-run-all browser-tests:build browser-tests:test",
"browser-tests:build": "bash -x ./scripts/build-browser-tests.sh",
"browser-tests:test": "npm-run-all browser-tests:test-parcel browser-tests:test-browserify browser-tests:test-webpack browser-tests:test-rollup",
Expand All @@ -51,30 +51,30 @@
"browser-tests:test-rollup": "karma start --single-run --browsers ChromeHeadless test/karma.rollup.conf.js"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-node-resolve": "^13.0.4",
"@types/mocha": "^5.2.7",
"@types/node": "^16.9.2",
"browserify": "^16.5.0",
"karma": "^4.3.0",
"karma-chrome-launcher": "^3.1.0",
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.5",
"mocha": "^6.2.0",
"npm-run-all": "^4.1.5",
"parcel": "^2.0.0-rc.0",
"prettier": "1.18.2",
"rimraf": "^3.0.0",
"rollup": "^2.53.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"ts-node": "^8.3.0",
"tslint": "^5.19.0",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.0.1",
"typescript": "4.5.4",
"webpack": "^4.39.3",
"webpack-cli": "^3.3.8"
"@rollup/plugin-commonjs": "22.0.1",
"@rollup/plugin-node-resolve": "13.3.0",
"@types/estree": "0.0.47",
"@types/mocha": "9.1.1",
"@types/node": "18.0.4",
"@typescript-eslint/eslint-plugin": "5.30.6",
"@typescript-eslint/parser": "5.30.6",
"browserify": "17.0.0",
"eslint": "8.19.0",
"eslint-plugin-prettier": "4.2.1",
"karma": "6.4.0",
"karma-chrome-launcher": "3.1.1",
"karma-mocha": "2.0.1",
"karma-mocha-reporter": "2.2.5",
"mocha": "10.0.0",
"npm-run-all": "4.1.5",
"parcel": "2.6.2",
"prettier": "2.7.1",
"rimraf": "~3.0.2",
"rollup": "2.76.0",
"ts-node": "10.9.1",
"typescript": "4.7.3",
"webpack": "5.73.0",
"webpack-cli": "4.10"
},
"keywords": [
"ethereum",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-browser-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ echo "Building tests with Browserify"
npx browserify test-builds/tsc/test/test-vectors/*.js > test-builds/browserify-build.js

echo "Building tests with webpack"
npx webpack --mode development test-builds/tsc/test/test-vectors/*.js --output test-builds/webpack-build.js
npx webpack --mode development ./test-builds/tsc/test/test-vectors/*.js --output-path ./test-builds

echo "Building tests with Rollup"
rollup -c test/rollup.config.js
2 changes: 1 addition & 1 deletion test/karma.webpack.conf.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = function(config) {
config.set({
frameworks: ["mocha"],
files: ["../test-builds/webpack-build.js"],
files: ["../test-builds/main.js"],
colors: true,
logLevel: config.LOG_INFO,
browsers: ["ChromeHeadless"],
Expand Down
2 changes: 0 additions & 2 deletions test/mocha.opts

This file was deleted.

4 changes: 2 additions & 2 deletions test/test-vectors/scrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe("scrypt", function() {
describe("scrypt sync", function() {
for (let i = 0; i < TEST_VECTORS.length; i++) {
it(`Should process the test ${i} correctly`, function() {
this.enableTimeouts(false);
this.timeout(10000)

const vector = TEST_VECTORS[i];

Expand All @@ -60,7 +60,7 @@ describe("scrypt", function() {
describe("scrypt async", function() {
for (let i = 0; i < TEST_VECTORS.length; i++) {
it(`Should process the test ${i} correctly`, async function() {
this.enableTimeouts(false);
this.timeout(10000);

const vector = TEST_VECTORS[i];

Expand Down