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

Refactor test suite #231

Merged
merged 1 commit into from
Jan 30, 2020
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
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]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record: this PR removes support for Node 11 and adds support for Node 13.


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
62 changes: 17 additions & 45 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,23 @@
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$/,
},
},
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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some notes on the config you changed here together with some reasoning along?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I grabbed some of the sensible defaults that were being used in ethereumjs-vm/karma.conf.js. I was going to bring over the comments indicating what each line does but decided not to for brevity, next time I will. Thanks!

})
}
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 --reporter=lcov mocha 'test/*.spec.ts' -- --require ts-node/register",
"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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record: switched from istanbul to nyc, dropped various babel and karma related dev dependencies.

"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
Copy link
Contributor Author

@ryanio ryanio Jan 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed to include this for the source to compile correctly for browsers in the karma test runner.


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