Skip to content

Commit ebf40a0

Browse files
authored
Merge pull request #294 from ethereumjs/use-tape
Convert mocha to tape
2 parents b100d13 + 33dd73a commit ebf40a0

17 files changed

+1147
-1068
lines changed

.eslintrc.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
module.exports = {
2-
extends: '@ethereumjs/eslint-config-defaults',
3-
env: {
4-
mocha: true
5-
}
2+
extends: '@ethereumjs/eslint-config-defaults'
63
}

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- run: npm install
2525

2626
- run: npm run lint
27-
- run: npm run test
27+
- run: npm run coverage
2828

2929
- uses: codecov/codecov-action@v1
3030
if: matrix.node-version == '12.x'

karma.conf.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
module.exports = function(config) {
22
config.set({
3-
frameworks: ['mocha', 'karma-typescript'],
3+
frameworks: ['tap', 'karma-typescript'],
44
files: ['src/**/*.ts', 'test/**/*.ts'],
55
preprocessors: {
66
'**/*.ts': ['karma-typescript']
77
},
8-
plugins: ['karma-mocha', 'karma-typescript', 'karma-chrome-launcher', 'karma-firefox-launcher'],
98
karmaTypescriptConfig: {
109
bundlerOptions: {
1110
entrypoints: /\.spec\.ts$/
@@ -16,7 +15,7 @@ module.exports = function(config) {
1615
reporters: ['progress', 'karma-typescript'],
1716
browsers: ['FirefoxHeadless', 'ChromeHeadless'],
1817
singleRun: true,
19-
concurrency: Infinity,
18+
concurrency: 1,
2019
// Fail after timeout
2120
browserDisconnectTimeout: 100000,
2221
browserNoActivityTimeout: 100000

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
"scripts": {
1414
"build": "ethereumjs-config-ts-build",
1515
"prepublishOnly": "npm run test && npm run build",
16+
"coverage": "ethereumjs-config-coverage",
1617
"docs:build": "npx typedoc --options typedoc.js",
1718
"lint": "ethereumjs-config-lint",
1819
"lint:fix": "ethereumjs-config-lint-fix",
1920
"test": "npm run test:node && npm run test:browser",
2021
"test:browser": "karma start karma.conf.js",
21-
"test:node": "nyc --reporter=lcov mocha --require ts-node/register 'test/*.spec.ts'",
22+
"test:node": "tape -r ts-node/register test/*.spec.ts",
2223
"tsc": "ethereumjs-config-tsc"
2324
},
2425
"husky": {
@@ -97,18 +98,18 @@
9798
"@ethereumjs/config-typescript": "^2.0.0",
9899
"@ethereumjs/eslint-config-defaults": "^2.0.0",
99100
"@types/assert": "^1.5.4",
100-
"@types/mocha": "^8.2.0",
101101
"@types/node": "^11.9.0",
102102
"@types/secp256k1": "^4.0.1",
103+
"@types/tape": "^4.13.0",
103104
"husky": "^2.1.0",
104105
"karma": "^5.0.2",
105106
"karma-chrome-launcher": "^2.0.0",
106107
"karma-firefox-launcher": "^1.0.0",
107-
"karma-mocha": "^2.0.0",
108+
"karma-tap": "^4.2.0",
108109
"karma-typescript": "^4.1.1",
109-
"mocha": "^8.2.1",
110110
"nyc": "^15.0.0",
111111
"prettier": "^1.15.3",
112+
"tape": "^5.2.2",
112113
"ts-node": "^8.6.2",
113114
"typedoc": "next",
114115
"typedoc-plugin-markdown": "^2.2.16",

src/account.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
import assert from 'assert'
22
import BN from 'bn.js'
33
import * as rlp from 'rlp'
4+
import {
5+
privateKeyVerify,
6+
publicKeyCreate,
7+
publicKeyVerify,
8+
publicKeyConvert
9+
} from 'ethereum-cryptography/secp256k1'
410
import { stripHexPrefix } from 'ethjs-util'
511
import { KECCAK256_RLP, KECCAK256_NULL } from './constants'
612
import { zeros, bufferToHex, toBuffer } from './bytes'
713
import { keccak, keccak256, keccakFromString, rlphash } from './hash'
814
import { assertIsHexString, assertIsBuffer } from './helpers'
915
import { BNLike, BufferLike, bnToRlp, toType, TypeOutput } from './types'
1016

11-
const {
12-
privateKeyVerify,
13-
publicKeyCreate,
14-
publicKeyVerify,
15-
publicKeyConvert
16-
} = require('ethereum-cryptography/secp256k1')
17-
1817
export interface AccountData {
1918
nonce?: BNLike
2019
balance?: BNLike

src/address.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const assert = require('assert')
2-
import BN = require('bn.js')
1+
import assert from 'assert'
2+
import BN from 'bn.js'
33
import { toBuffer, zeros } from './bytes'
44
import {
55
isValidAddress,

src/externals.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44
* @packageDocumentation
55
*/
66

7-
// TODO: This can be replaced with a normal ESM import once
8-
// the new major version of the typescript config package
9-
// is released and adopted here.
10-
import BN = require('bn.js')
11-
import rlp = require('rlp')
7+
import BN from 'bn.js'
8+
import * as rlp from 'rlp'
129

1310
/**
1411
* [`BN`](https://github.com/indutny/bn.js)

src/hash.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { keccak224, keccak384, keccak256: k256, keccak512 } = require('ethereum-cryptography/keccak')
1+
import { keccak224, keccak384, keccak256 as k256, keccak512 } from 'ethereum-cryptography/keccak'
22
const createHash = require('create-hash')
33
import * as rlp from 'rlp'
44
import { toBuffer, setLengthLeft } from './bytes'

0 commit comments

Comments
 (0)