Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Commit

Permalink
refactor test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanio committed Jan 30, 2020
1 parent 8396154 commit 8959273
Show file tree
Hide file tree
Showing 16 changed files with 1,300 additions and 1,030 deletions.
7 changes: 0 additions & 7 deletions .babelrc

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build
on:
push:
branches:
- master
tags:
- '*'
pull_request:
types: [opened, reopened, synchronize]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [8.x, 10.x, 12.x, 13.x]

steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- uses: actions/checkout@v1
- run: npm install
- run: npm run test

- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ lib-cov

# Coverage directory used by tools like istanbul
coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
Expand Down
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SYNOPSIS

[![NPM Package](https://img.shields.io/npm/v/ethereumjs-util.svg?style=flat-square)](https://www.npmjs.org/package/ethereumjs-util)
[![Build Status](https://img.shields.io/travis/ethereumjs/ethereumjs-util.svg?branch=master&style=flat-square)](https://travis-ci.org/ethereumjs/ethereumjs-util)
[![Actions Status](https://github.com/ethereumjs/ethereumjs-util/workflows/Build/badge.svg)](https://github.com/ethereumjs/ethereumjs-util/actions
[![Coverage Status](https://img.shields.io/coveralls/ethereumjs/ethereumjs-util.svg?style=flat-square)](https://coveralls.io/r/ethereumjs/ethereumjs-util)
[![Gitter](https://img.shields.io/gitter/room/ethereum/ethereumjs-lib.svg?style=flat-square)](https://gitter.im/ethereum/ethereumjs-lib) or #ethereumjs on freenode

Expand Down
67 changes: 22 additions & 45 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,28 @@
module.exports = function (config) {
module.exports = function(config) {
config.set({
frameworks: ['browserify', 'detectBrowsers', 'mocha'],
files: [
'test/*.js'
],
frameworks: ['mocha', 'karma-typescript'],
files: ['src/**/*.ts', 'test/**/*.ts'],
preprocessors: {
'test/*.js': ['browserify', 'env']
'**/*.ts': ['karma-typescript'],
},
singleRun: true,
plugins: [
'karma-browserify',
'karma-chrome-launcher',
'karma-env-preprocessor',
'karma-firefox-launcher',
'karma-detect-browsers',
'karma-mocha'
],
browserify: {
'transform': [
[
'babelify',
{
'presets': [
'env'
]
}
]
],
debug: true
plugins: ['karma-mocha', 'karma-typescript', 'karma-chrome-launcher', 'karma-firefox-launcher'],
karmaTypescriptConfig: {
bundlerOptions: {
entrypoints: /\.spec\.ts$/,
resolve: {
alias: {
'safe-buffer': 'node_modules/buffer/index.js',
},
},
},
},
envPreprocessor: [
'RANDOM_TESTS_REPEAT',
'TRAVIS'
],
detectBrowsers: {
enabled: true,
usePhantomJS: false,
postDetection: function (availableBrowser) {
if (availableBrowser.includes('Chrome')) {
return ['ChromeHeadless']
}

var browsers = ['Chrome', 'Firefox']
return browsers.filter(function (browser) {
return availableBrowser.indexOf(browser) !== -1
})
}
}
colors: true,
reporters: ['progress', 'karma-typescript'],
browsers: ['FirefoxHeadless', 'ChromeHeadless'],
singleRun: true,
concurrency: Infinity,
// Fail after timeout
browserDisconnectTimeout: 100000,
browserNoActivityTimeout: 100000,
})
}
19 changes: 6 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@
"scripts": {
"build": "ethereumjs-config-build",
"prepublishOnly": "npm run test && npm run build",
"coverage": "npm run build && istanbul cover _mocha",
"coveralls": "npm run coverage && coveralls <coverage/lcov.info",
"docs:build": "typedoc --out docs --mode file --readme none --theme markdown --mdEngine github --gitRevision master --excludeNotExported src",
"format": "ethereumjs-config-format",
"format:fix": "ethereumjs-config-format-fix",
"lint": "ethereumjs-config-lint",
"lint:fix": "ethereumjs-config-lint-fix",
"test": "npm run lint && npm run test:node && npm run test:browser",
"test:browser": "npm run build && karma start karma.conf.js",
"test:node": "npm run build && istanbul test mocha -- --reporter spec",
"test:browser": "karma start karma.conf.js",
"test:node": "nyc mocha 'test/*.spec.ts' -- --require ts-node/register --reporter spec",
"tsc": "ethereumjs-config-tsc",
"tslint": "ethereumjs-config-tslint",
"tslint:fix": "ethereumjs-config-tslint-fix"
Expand Down Expand Up @@ -100,24 +98,19 @@
"@ethereumjs/config-prettier": "^1.1.0",
"@ethereumjs/config-tsc": "^1.1.0",
"@ethereumjs/config-tslint": "^1.1.0",
"@types/mocha": "^5.2.7",
"@types/node": "^11.9.0",
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babelify": "^8.0.0",
"browserify": "^14.0.0",
"contributor": "^0.1.25",
"coveralls": "^3.0.0",
"husky": "^2.1.0",
"istanbul": "^0.4.1",
"karma": "^4.0.0",
"karma-browserify": "^5.0.0",
"karma-chrome-launcher": "^2.0.0",
"karma-detect-browsers": "2.2.6",
"karma-env-preprocessor": "^0.1.1",
"karma-firefox-launcher": "^1.0.0",
"karma-mocha": "^1.3.0",
"karma-typescript": "^4.1.1",
"mocha": "^6.0.0",
"nyc": "^15.0.0",
"prettier": "^1.15.3",
"ts-node": "^8.6.2",
"tslint": "^5.12.0",
"typedoc": "^0.14.0",
"typedoc-plugin-markdown": "^1.1.21",
Expand Down
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import BN = require('bn.js')
const Buffer = require('buffer').Buffer

/**
* The max integer that this VM can handle
Expand Down
Loading

0 comments on commit 8959273

Please sign in to comment.