Browse Source

get testing and code coverage functional...

ignore extra files from the building...

also, restrict supported browsers to those in the last 2 years,
if you're running older browsers, you should update to a more
secure browser
main
John-Mark Gurney 4 years ago
parent
commit
3c1cb97b40
4 changed files with 48 additions and 5 deletions
  1. +6
    -0
      .gitignore
  2. +9
    -3
      package.json
  3. +20
    -2
      src/jamming.js
  4. +13
    -0
      src/jamming/jamming.spec.js

+ 6
- 0
.gitignore View File

@@ -0,0 +1,6 @@
.nyc_output
.yarn
lib/*
node_modules
yarn-error.log
yarn.lock

+ 9
- 3
package.json View File

@@ -8,11 +8,11 @@
"build": "yarn run build:lib && yarn run build:webpack",
"build:lib": "babel src/ -d lib/",
"build:webpack": "webpack lib/index.js -o dist/jamming.js",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "yarn run build:lib && nyc mocha lib/**/**.spec.js"
},
"author": "John-Mark Gurney <jmg@funkthat.com>",
"license": "BSD-3-Clause",
"browserslist": "> 0.25%, not dead",
"browserslist": "last 2 years",
"babel": {
"presets": [
"@babel/preset-env"
@@ -20,7 +20,8 @@
"plugins": [
[
"@babel/plugin-proposal-class-properties"
]
],
"istanbul"
]
},
"devDependencies": {
@@ -28,7 +29,12 @@
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/preset-env": "^7.9.5",
"@istanbuljs/nyc-config-babel": "^3.0.0",
"babel-plugin-istanbul": "^6.0.0",
"babelify": "^10.0.0",
"chai": "^4.2.0",
"mocha": "^7.1.1",
"nyc": "^15.0.1",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11"
},


+ 20
- 2
src/jamming.js View File

@@ -1,8 +1,26 @@
import InlineWorker from 'inline-worker';

export class Jamming {
otherattr = InlineWorker;
someattr = 5;
config = {
sampleRate: 48000,
frameSize: 100, /* in ms */
};

constructor(source, cfg) {
Object.assign(this.config, cfg)
/* ================ START THREAD ================ */
this.worker = new InlineWorker(function() {
let recBuffers = [];
this.onmessage = function(e) {
switch (e.data.command) {
}
}
});
/* ================ END THREAD ================ */
}

async start() {
}
};

export default Jamming;

+ 13
- 0
src/jamming/jamming.spec.js View File

@@ -0,0 +1,13 @@
'use strict'

/* import {Jamming} from '../index' */
const Jamming = require('../index')
const expect = require('chai').expect

describe('Jamming class', () => {
describe('"construct"', () => {
it('should be instantiable', () => {
expect(new Jamming()).to.be.an.instanceOf(Jamming);
})
})
})

Loading…
Cancel
Save