Skip to content

Commit

Permalink
Added new testAPI:browser command, karma dependencies, initial test s…
Browse files Browse the repository at this point in the history
…etup and CI job
  • Loading branch information
holgerd77 committed Mar 5, 2019
1 parent 0162d47 commit 67d5d0b
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 6 deletions.
14 changes: 13 additions & 1 deletion .circleci/config.yml
Expand Up @@ -3,7 +3,7 @@ version: 2
defaults: &defaults
working_directory: ~/project/ethereumjs-vm
docker:
- image: circleci/node:8
- image: circleci/node:8-browsers
restore_node_modules: &restore_node_modules
restore_cache:
name: Restore node_modules cache
Expand Down Expand Up @@ -46,6 +46,15 @@ jobs:
- run:
name: testAPI
command: npm run testAPI
test_api_browser:
<<: *defaults
steps:
- attach_workspace:
at: ~/project
- *restore_node_modules
- run:
name: testAPI:browser
command: npm run testAPI:browser
test_state_byzantium:
<<: *defaults
steps:
Expand Down Expand Up @@ -102,6 +111,9 @@ workflows:
- test_api:
requires:
- install
- test_api_browser:
requires:
- install
- test_state_byzantium:
requires:
- install
Expand Down
74 changes: 74 additions & 0 deletions karma.conf.js
@@ -0,0 +1,74 @@
// Karma configuration
// Generated on Fri Mar 01 2019 22:02:29 GMT+0100 (CET)

module.exports = function (config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['browserify', 'detectBrowsers', 'tap'],

// list of files / patterns to load in the browser
files: [
'./tests/api/**/*.js'
],

// list of files / patterns to exclude
// currently failing tests, open separate PRs to fix
exclude: [
'./tests/api/state/stateManager.js', // 4, "# should clear the cache when the state root is set"
'./tests/api/state/storageReader.js', // 1, "# should get value from stateManager"
'./tests/api/index.js', // 11, "# should run blockchain with mocked runBlock" not working"
'./tests/api/runBlock.js', // 3, "# should fail when runTx fails"
'./tests/api/runBlockchain.js' // 2, "# should run with valid and invalid blocks"
],

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'./tests/api/**/*.js': [ 'browserify' ]
},

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],

// web server port
port: 9876,

// enable / disable colors in the output (reporters and logs)
colors: true,

// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,

// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Firefox'],

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,

// karma-detect-browsers plugin config
detectBrowsers: {
enabled: true,
usePhantomJS: false,
postDetection: function (availableBrowsers) {
return [ 'Firefox' ]
}
},

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
})
}
11 changes: 10 additions & 1 deletion package.json
Expand Up @@ -18,6 +18,7 @@
"testBlockchain": "npm run build:dist && node --stack-size=1500 ./tests/tester -b --fork='Petersburg' --dist --excludeDir='GeneralStateTests'",
"testBlockchainGeneralStateTests": "npm run build:dist && node --stack-size=1500 ./tests/tester -b --dist --dir='GeneralStateTests'",
"testAPI": "tape './tests/api/**/*.js'",
"testAPI:browser": "karma start karma.conf.js",
"test": "echo \"[INFO] Generic test cmd not used. See package.json for more specific test run cmds.\"",
"lint": "standard",
"prepublishOnly": "npm run lint && npm run build:dist && npm run testBuildIntegrity",
Expand Down Expand Up @@ -49,18 +50,26 @@
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.6.1",
"browserify": "^16.2.3",
"coveralls": "^3.0.0",
"documentation": "^8.1.2",
"ethereumjs-blockchain": "^3.4.0",
"ethereumjs-testing": "git+https://github.com/ethereumjs/ethereumjs-testing.git#v1.2.7",
"ethereumjs-tx": "1.3.7",
"karma": "^4.0.1",
"karma-browserify": "^6.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-detect-browsers": "^2.3.3",
"karma-firefox-launcher": "^1.1.0",
"karma-tap": "^4.1.4",
"level": "^4.0.0",
"level-mem": "^3.0.1",
"minimist": "^1.1.1",
"nyc": "^12.0.2",
"standard": "^10.0.0",
"tap-spec": "^5.0.0",
"tape": "4.6.3"
"tape": "4.6.3",
"util.promisify": "^1.0.0"
},
"author": "mjbecze <mjbecze@gmail.com>",
"contributors": [
Expand Down
2 changes: 1 addition & 1 deletion tests/api/index.js
@@ -1,4 +1,4 @@
const { promisify } = require('util')
const promisify = require('util.promisify')
const tape = require('tape')
const util = require('ethereumjs-util')
const Block = require('ethereumjs-block')
Expand Down
2 changes: 1 addition & 1 deletion tests/api/runBlock.js
@@ -1,4 +1,4 @@
const { promisify } = require('util')
const promisify = require('util.promisify')
const tape = require('tape')
const Block = require('ethereumjs-block')
const Transaction = require('ethereumjs-tx')
Expand Down
2 changes: 1 addition & 1 deletion tests/api/runTx.js
@@ -1,4 +1,4 @@
const { promisify } = require('util')
const promisify = require('util.promisify')
const tape = require('tape')
const Transaction = require('ethereumjs-tx')
const runTx = require('../../lib/runTx')
Expand Down
2 changes: 1 addition & 1 deletion tests/api/state/cache.js
@@ -1,4 +1,4 @@
const { promisify } = require('util')
const promisify = require('util.promisify')
const tape = require('tape')
const Trie = require('merkle-patricia-tree/secure.js')
const Account = require('ethereumjs-account')
Expand Down

0 comments on commit 67d5d0b

Please sign in to comment.