From f52e05dcb7e3737cb5779cfa9b03bfe07257b81c Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Thu, 1 Jun 2017 11:49:17 -0400 Subject: [PATCH 1/9] update to rollup generator 5 --- .gitignore | 1 - .travis.yml | 17 ++++--- CONTRIBUTING.md | 4 +- LICENSE | 2 +- bower.json | 10 ----- index.html | 7 +-- package.json | 77 ++++++++++++++++++++------------ scripts/modules.rollup.config.js | 36 +++++++++++++++ scripts/test.rollup.config.js | 56 +++++++++++++++++++++++ scripts/umd.rollup.config.js | 43 ++++++++++++++++++ scripts/version.js | 77 ++++---------------------------- test/index.html | 10 ++--- test/karma.conf.js | 48 +++++++------------- 13 files changed, 233 insertions(+), 155 deletions(-) delete mode 100644 bower.json create mode 100644 scripts/modules.rollup.config.js create mode 100644 scripts/test.rollup.config.js create mode 100644 scripts/umd.rollup.config.js diff --git a/.gitignore b/.gitignore index 1982e44..abd5381 100644 --- a/.gitignore +++ b/.gitignore @@ -31,7 +31,6 @@ node_modules/ # Build-related directories dist/ docs/api/ -es5/ test/dist/ test/test-expected.js test/test-manifests.js diff --git a/.travis.yml b/.travis.yml index 08d15d5..f5f9ad9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,18 @@ sudo: false +dist: trusty language: node_js node_js: - - 'node' - - '4.2' - + - '8' + - '6' + - '4' before_script: - - # Set up a virtual screen for Firefox. + - export CHROME_BIN=/usr/bin/google-chrome - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start +addons: + firefox: latest + apt: + sources: + - google-chrome + packages: + - google-chrome-stable diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 50bce10..a184176 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,7 +12,7 @@ Make sure you have NodeJS 0.10 or higher and npm installed. ### Making Changes -Refer to the [video.js plugin standards][standards] for more detail on best practices and tooling for video.js plugin authorship. +Refer to the [video.js plugin conventions][conventions] for more detail on best practices and tooling for video.js plugin authorship. When you've made your changes, push your commit(s) to your fork and issue a pull request against the original repository. @@ -27,4 +27,4 @@ Testing is a crucial part of any software project. For all but the most trivial [karma]: http://karma-runner.github.io/ [local]: http://localhost:9999/test/ -[standards]: https://github.com/videojs/generator-videojs-plugin/docs/standards.md +[conventions]: https://github.com/videojs/generator-videojs-plugin/blob/master/docs/conventions.md diff --git a/LICENSE b/LICENSE index c0cb935..23d0fbb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2016 brandonocasey <brandonocasey@gmail.com> +Copyright Brightcove, Inc Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/bower.json b/bower.json deleted file mode 100644 index 5b88f08..0000000 --- a/bower.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "m3u8-parser", - "author": "Brightcove, Inc", - "license": "Apache-2.0", - "main": [ - "dist/m3u8-parser.min.js" - ], - "keywords": [] -} - diff --git a/index.html b/index.html index 0d160c2..13e9627 100644 --- a/index.html +++ b/index.html @@ -5,10 +5,11 @@ m3u8-parser Demo +

Open dev tools to try it out

- + diff --git a/package.json b/package.json index 50fd3fd..f67ea84 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,8 @@ "name": "m3u8-parser", "version": "2.1.0", "description": "m3u8 parser", - "jsnext:main": "src/index.js", - "main": "es5/index.js", + "main": "dist/m3u8-parser.cjs.js", + "module": "dist/m3u8-parser.es.js", "repository": { "type": "git", "url": "git@github.com:videojs/m3u8-parser.git" @@ -25,20 +25,25 @@ "scripts": { "prebuild": "npm run clean", "build": "npm-run-all -p build:*", - "build:js": "npm-run-all build:js:babel build:js:browserify build:js:bannerize build:js:uglify", + "build:js": "npm-run-all build:js:rollup-modules build:js:rollup-umd build:js:bannerize build:js:uglify", "build:js:babel": "babel src -d es5", "build:js:bannerize": "bannerize dist/m3u8-parser.js --banner=scripts/banner.ejs", "build:js:browserify": "browserify . -s m3u8-parser -o dist/m3u8-parser.js", - "build:js:uglify": "uglifyjs dist/m3u8-parser.js --comments --mangle --compress -o dist/m3u8-parser.min.js", - "build:test": "babel-node scripts/build-test.js", + "build:js:rollup-modules": "rollup -c scripts/modules.rollup.config.js", + "build:js:rollup-umd": "rollup -c scripts/umd.rollup.config.js", + "build:js:uglify": "uglifyjs dist/m3u8-parser.js --comments --mangle --compress -o dist/m3u8-parser.min.js", + "build:test": "rollup -c scripts/test.rollup.config.js", "change": "chg add", - "clean": "rimraf dist test/dist es5 && mkdirp dist test/dist es5", + "clean": "rimraf dist test/dist", + "postclean": "mkdirp dist test/dist", "docs": "npm-run-all docs:*", "docs:api": "jsdoc src -r -d docs/api", "docs:toc": "doctoc README.md", "lint": "vjsstandard", - "start": "npm-run-all -p watch start:*", + "prestart": "npm run build", + "start": "npm-run-all -p start:server watch", "start:serve": "babel-node scripts/server.js", + "start:server": "static -a 0.0.0.0 -p 9999 -H '{\"Cache-Control\": \"no-cache, must-revalidate\"}' .", "pretest": "npm-run-all lint build", "test": "karma start test/karma.conf.js", "test:chrome": "npm run pretest && karma start test/karma.conf.js --browsers Chrome", @@ -46,13 +51,16 @@ "test:ie": "npm run pretest && karma start test/karma.conf.js --browsers IE", "test:safari": "npm run pretest && karma start test/karma.conf.js --browsers Safari", "preversion": "npm test", - "version": "babel-node scripts/version.js", + "version": "node scripts/version.js", "postversion": "babel-node scripts/postversion.js", - "prepublish": "npm run build", "watch": "npm-run-all -p watch:*", "watch:js": "npm-run-all -p watch:js:babel watch:js:browserify", + "watch:js-modules": "rollup -c scripts/modules.rollup.config.js -w", + "watch:js-umd": "rollup -c scripts/umd.rollup.config.js -w", "watch:js:babel": "npm run build:js:babel -- --watch", - "watch:js:browserify": "watchify . -v -g browserify-shim -o dist/m3u8-parser.js" + "watch:js:browserify": "watchify . -v -g browserify-shim -o dist/m3u8-parser.js", + "watch:test": "rollup -c scripts/test.rollup.config.js -w", + "prepublish": "npm run build" }, "keywords": [], "author": "Brightcove, Inc", @@ -65,20 +73,16 @@ "ignore": [ "dist", "docs", - "es5", "test/dist", "test/karma.conf.js", - "test/test-expected.js", - "test/test-manifests.js", "test/fixtures/m3u8/**/*.js" + ] }, "files": [ "CONTRIBUTING.md", - "bower.json", "dist/", "docs/", - "es5/", "index.html", "scripts/", "src/", @@ -88,8 +92,9 @@ "devDependencies": { "babel": "^6.5.2", "babel-cli": "^6.11.4", + "babel-plugin-external-helpers": "^6.22.0", "babel-plugin-transform-object-assign": "^6.8.0", - "babel-preset-es2015": "^6.9.0", + "babel-preset-es2015": "^6.14.0", "babel-preset-es2015-loose": "^7.0.0", "babel-preset-es3": "^1.0.1", "babelify": "^7.3.0", @@ -99,24 +104,38 @@ "browserify-shim": "^3.8.12", "budo": "^8.0.4", "chg": "^0.3.2", + "conventional-changelog-cli": "^1.3.1", + "conventional-changelog-videojs": "^3.0.0", "doctoc": "^0.15.0", "glob": "^6.0.3", "global": "^4.3.0", "jsdoc": "^3.4.0", - "karma": "^0.13.19", - "karma-chrome-launcher": "^0.2.2", - "karma-detect-browsers": "^2.0.2", - "karma-firefox-launcher": "^0.1.7", - "karma-ie-launcher": "^0.2.0", - "karma-qunit": "^0.1.9", - "karma-safari-launcher": "^0.1.1", + "karma": "^1.7.0", + "karma-chrome-launcher": "^2.1.1", + "karma-detect-browsers": "^2.2.5", + "karma-firefox-launcher": "^1.0.1", + "karma-ie-launcher": "^1.0.0", + "karma-qunit": "^1.2.1", + "karma-safari-launcher": "^1.0.0", "mkdirp": "^0.5.1", - "npm-run-all": "^1.5.1", - "qunitjs": "^1.21.0", - "rimraf": "^2.5.1", - "sinon": "~1.14.0", - "uglify-js": "^2.6.1", - "videojs-standard": "5.2.0", + "node-static": "^0.7.9", + "npm-run-all": "^4.0.2", + "qunitjs": "^2.3.2", + "rimraf": "^2.6.1", + "rollup": "^0.41.6", + "rollup-plugin-babel": "^2.7.1", + "rollup-plugin-commonjs": "^8.0.2", + "rollup-plugin-json": "^2.1.1", + "rollup-plugin-multi-entry": "^2.0.1", + "rollup-plugin-node-resolve": "^3.0.0", + "rollup-watch": "^3.2.2", + "semver": "^5.3.0", + "sinon": "^2.2.0", + "uglify-js": "^3.0.7", + "videojs-standard": "^6.0.0", "watchify": "^3.7.0" + }, + "generator-videojs-plugin": { + "version": "5.0.0" } } diff --git a/scripts/modules.rollup.config.js b/scripts/modules.rollup.config.js new file mode 100644 index 0000000..05b2884 --- /dev/null +++ b/scripts/modules.rollup.config.js @@ -0,0 +1,36 @@ +/** + * Rollup configuration for packaging the plugin in a module that is consumable + * by either CommonJS (e.g. Node or Browserify) or ECMAScript (e.g. Rollup). + * + * These modules DO NOT include their dependencies as we expect those to be + * handled by the module system. + */ +import babel from 'rollup-plugin-babel'; +import json from 'rollup-plugin-json'; + +export default { + moduleName: 'm3u8-parser', + entry: 'src/index.js', + legacy: true, + plugins: [ + json(), + babel({ + babelrc: false, + exclude: 'node_modules/**', + presets: [ + ['es2015', { + loose: true, + modules: false + }] + ], + plugins: [ + 'external-helpers', + 'transform-object-assign' + ] + }) + ], + targets: [ + {dest: 'dist/m3u8-parser.cjs.js', format: 'cjs'}, + {dest: 'dist/m3u8-parser.es.js', format: 'es'} + ] +}; diff --git a/scripts/test.rollup.config.js b/scripts/test.rollup.config.js new file mode 100644 index 0000000..6b5f938 --- /dev/null +++ b/scripts/test.rollup.config.js @@ -0,0 +1,56 @@ +/** + * Rollup configuration for packaging the plugin in a test bundle. + * + * This includes all dependencies for both the plugin and its tests. + */ +import babel from 'rollup-plugin-babel'; +import commonjs from 'rollup-plugin-commonjs'; +import json from 'rollup-plugin-json'; +import multiEntry from 'rollup-plugin-multi-entry'; +import resolve from 'rollup-plugin-node-resolve'; + +export default { + moduleName: 'm3u8-parser-test', + entry: 'test/**/*.test.js', + dest: 'test/dist/bundle.js', + format: 'iife', + external: [ + 'qunit', + 'qunitjs', + 'sinon' + ], + globals: { + 'qunit': 'QUnit', + 'qunitjs': 'QUnit', + 'sinon': 'sinon' + }, + legacy: true, + plugins: [ + multiEntry({ + exports: false + }), + resolve({ + browser: true, + main: true, + jsnext: true + }), + json(), + commonjs({ + sourceMap: false + }), + babel({ + babelrc: false, + exclude: 'node_modules/**', + presets: [ + ['es2015', { + loose: true, + modules: false + }] + ], + plugins: [ + 'external-helpers', + 'transform-object-assign' + ] + }) + ] +}; diff --git a/scripts/umd.rollup.config.js b/scripts/umd.rollup.config.js new file mode 100644 index 0000000..4d19fe1 --- /dev/null +++ b/scripts/umd.rollup.config.js @@ -0,0 +1,43 @@ +/** + * Rollup configuration for packaging the plugin in a module that is consumable + * as the `src` of a `script` tag or via AMD or similar client-side loading. + * + * This module DOES include its dependencies. + */ +import babel from 'rollup-plugin-babel'; +import commonjs from 'rollup-plugin-commonjs'; +import json from 'rollup-plugin-json'; +import resolve from 'rollup-plugin-node-resolve'; + +export default { + moduleName: 'm3u8-parser', + entry: 'src/index.js', + dest: 'dist/m3u8-parser.js', + format: 'umd', + legacy: true, + plugins: [ + resolve({ + browser: true, + main: true, + jsnext: true + }), + json(), + commonjs({ + sourceMap: false + }), + babel({ + babelrc: false, + exclude: 'node_modules/**', + presets: [ + ['es2015', { + loose: true, + modules: false + }] + ], + plugins: [ + 'external-helpers', + 'transform-object-assign' + ] + }) + ] +}; diff --git a/scripts/version.js b/scripts/version.js index dfabfdd..d2e93ec 100644 --- a/scripts/version.js +++ b/scripts/version.js @@ -1,69 +1,10 @@ -import {exec} from 'child_process'; -import fs from 'fs'; -import path from 'path'; - -/* eslint no-console: 0 */ - -const pkg = require(path.join(__dirname, '../package.json')); - -/** - * Determines whether or not the project has the CHANGELOG setup by checking - * for the presence of a CHANGELOG.md file and the necessary dependency and - * npm script. - * - * @return {Boolean} - */ -const hasChangelog = () => { - try { - fs.statSync(path.join(__dirname, '../CHANGELOG.md')); - } catch (x) { - return false; - } - return pkg.devDependencies.hasOwnProperty('chg') && - pkg.scripts.hasOwnProperty('change'); -}; - -/** - * Determines whether or not the project has the Bower setup by checking for - * the presence of a bower.json file. - * - * @return {Boolean} - */ -const hasBower = () => { - try { - fs.statSync(path.join(__dirname, '../bower.json')); - return true; - } catch (x) { - return false; - } -}; - -const commands = []; - -// If the project has a CHANGELOG, update it for the new release. -if (hasChangelog()) { - commands.push(`chg release "${pkg.version}"`); - commands.push('git add CHANGELOG.md'); -} - -// If the project supports Bower, perform special extra versioning step. -if (hasBower()) { - commands.push('git add package.json'); - commands.push(`git commit -m "${pkg.version}"`); - - // We only need a build in the Bower-supported case because of the - // temporary addition of the dist/ directory. - commands.push('npm run build'); - commands.push('git add -f dist'); -} - -if (commands.length) { - exec(commands.join(' && '), (err, stdout, stderr) => { - if (err) { - process.stdout.write(err.stack); - process.exit(err.status || 1); - } else { - process.stdout.write(stdout); - } - }); +const execSync = require('child_process').execSync; +const path = require('path'); +const semver = require('semver'); +const pkg = require('../package.json'); + +if (!semver.prerelease(pkg.version)) { + process.chdir(path.resolve(__dirname, '..')); + execSync('conventional-changelog -p videojs -i CHANGELOG.md -s'); + execSync('git add CHANGELOG.md'); } diff --git a/test/index.html b/test/index.html index 1d30a9e..be745b3 100644 --- a/test/index.html +++ b/test/index.html @@ -3,14 +3,14 @@ m3u8-parser Unit Tests - +
- - - - + + + + diff --git a/test/karma.conf.js b/test/karma.conf.js index a70eca8..821754e 100644 --- a/test/karma.conf.js +++ b/test/karma.conf.js @@ -1,48 +1,34 @@ module.exports = function(config) { - var browsers = config.browsers; - var frameworks = ['qunit']; - var plugins = ['karma-qunit']; - - var addBrowserLauncher = function(browser) { - plugins.push('karma-' + browser.toLowerCase() + '-launcher'); + var detectBrowsers = { + enabled: false, + usePhantomJS: false }; - // On Travis CI, we can only run in Firefox. + // On Travis CI, we can only run in Firefox and Chrome; so, enforce that. if (process.env.TRAVIS) { - browsers = ['Firefox']; - browsers.forEach(addBrowserLauncher); - - // If specific browsers are requested on the command line, load their - // launchers. - } else if (browsers.length) { - browsers.forEach(addBrowserLauncher); + config.browsers = ['Firefox', 'travisChrome']; + } - // If no browsers are specified, we will do a `karma-detect-browsers` run, - // which means we need to set up that plugin and all the browser plugins - // we are supporting. - } else { - frameworks.push('detectBrowsers'); - plugins.push('karma-detect-browsers'); - ['chrome', 'firefox', 'ie', 'safari'].forEach(addBrowserLauncher); + // If no browsers are specified, we enable `karma-detect-browsers` + // this will detect all browsers that are available for testing + if (!config.browsers.length) { + detectBrowsers.enabled = true; } config.set({ basePath: '..', - frameworks: frameworks, - + frameworks: ['qunit', 'detectBrowsers'], files: [ 'node_modules/sinon/pkg/sinon.js', - 'node_modules/sinon/pkg/sinon-ie.js', 'test/dist/bundle.js' ], - - browsers: browsers, - plugins: plugins, - - detectBrowsers: { - usePhantomJS: false + customLaunchers: { + travisChrome: { + base: 'Chrome', + flags: ['--no-sandbox'] + } }, - + detectBrowsers: detectBrowsers, reporters: ['dots'], port: 9876, colors: true, From 4aad341b6843e1a9825bde3b3acdbc5dd591d8ed Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Thu, 1 Jun 2017 12:07:12 -0400 Subject: [PATCH 2/9] updates --- package.json | 5 ++++- scripts/export-m3u8s.js | 1 + scripts/m3u8.js | 21 +++++++++++++++++++++ src/index.js | 2 +- 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 scripts/m3u8.js diff --git a/package.json b/package.json index f67ea84..849d47e 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "build:js:rollup-modules": "rollup -c scripts/modules.rollup.config.js", "build:js:rollup-umd": "rollup -c scripts/umd.rollup.config.js", "build:js:uglify": "uglifyjs dist/m3u8-parser.js --comments --mangle --compress -o dist/m3u8-parser.min.js", + "prebuild:test": "node scripts/m3u8.js", "build:test": "rollup -c scripts/test.rollup.config.js", "change": "chg add", "clean": "rimraf dist test/dist", @@ -75,8 +76,9 @@ "docs", "test/dist", "test/karma.conf.js", + "test/test-expected.js", + "test/manifests.js", "test/fixtures/m3u8/**/*.js" - ] }, "files": [ @@ -117,6 +119,7 @@ "karma-ie-launcher": "^1.0.0", "karma-qunit": "^1.2.1", "karma-safari-launcher": "^1.0.0", + "minimist": "^1.2.0", "mkdirp": "^0.5.1", "node-static": "^0.7.9", "npm-run-all": "^4.0.2", diff --git a/scripts/export-m3u8s.js b/scripts/export-m3u8s.js index 8541671..026166b 100644 --- a/scripts/export-m3u8s.js +++ b/scripts/export-m3u8s.js @@ -1,3 +1,4 @@ +"use strict"; /* eslint no-console: 0 */ const fs = require('fs'); diff --git a/scripts/m3u8.js b/scripts/m3u8.js new file mode 100644 index 0000000..29dd67c --- /dev/null +++ b/scripts/m3u8.js @@ -0,0 +1,21 @@ +var m3u8 = require('./export-m3u8s.js'); + +var args = require('minimist')(process.argv.slice(2), { + boolean: ['watch', 'clean', 'build'], + default: { + 'build': true + }, + alias: { + 'b': 'build', + 'c': 'clean', + 'w': 'watch' + } +}); + +if (args.w) { + m3u8.watch(); +} else if (args.c) { + m3u8.clean(); +} else if (args.b) { + m3u8.build(); +} diff --git a/src/index.js b/src/index.js index 9292bff..2f03907 100644 --- a/src/index.js +++ b/src/index.js @@ -12,7 +12,7 @@ import LineStream from './line-stream'; import ParseStream from './parse-stream'; import Parser from './parser'; -module.exports = { +export { LineStream, ParseStream, Parser From 808de4ea45b5af36c5239b354a210e91528d1fdd Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Thu, 1 Jun 2017 12:17:10 -0400 Subject: [PATCH 3/9] update tests --- test/m3u8.test.js | 498 +++++++++++++++++++++++----------------------- 1 file changed, 249 insertions(+), 249 deletions(-) diff --git a/test/m3u8.test.js b/test/m3u8.test.js index 6fb18f8..55a5ab5 100644 --- a/test/m3u8.test.js +++ b/test/m3u8.test.js @@ -8,16 +8,16 @@ QUnit.module('LineStream', { this.lineStream = new LineStream(); } }); -QUnit.test('empty inputs produce no tokens', function() { +QUnit.test('empty inputs produce no tokens', function(assert) { let data = false; this.lineStream.on('data', function() { data = true; }); this.lineStream.push(''); - QUnit.ok(!data, 'no tokens were produced'); + assert.ok(!data, 'no tokens were produced'); }); -QUnit.test('splits on newlines', function() { +QUnit.test('splits on newlines', function(assert) { const lines = []; this.lineStream.on('data', function(line) { @@ -25,11 +25,11 @@ QUnit.test('splits on newlines', function() { }); this.lineStream.push('#EXTM3U\nmovie.ts\n'); - QUnit.strictEqual(2, lines.length, 'two lines are ready'); - QUnit.strictEqual('#EXTM3U', lines.shift(), 'the first line is the first token'); - QUnit.strictEqual('movie.ts', lines.shift(), 'the second line is the second token'); + assert.strictEqual(2, lines.length, 'two lines are ready'); + assert.strictEqual('#EXTM3U', lines.shift(), 'the first line is the first token'); + assert.strictEqual('movie.ts', lines.shift(), 'the second line is the second token'); }); -QUnit.test('empty lines become empty strings', function() { +QUnit.test('empty lines become empty strings', function(assert) { const lines = []; this.lineStream.on('data', function(line) { @@ -37,25 +37,25 @@ QUnit.test('empty lines become empty strings', function() { }); this.lineStream.push('\n\n'); - QUnit.strictEqual(2, lines.length, 'two lines are ready'); - QUnit.strictEqual('', lines.shift(), 'the first line is empty'); - QUnit.strictEqual('', lines.shift(), 'the second line is empty'); + assert.strictEqual(2, lines.length, 'two lines are ready'); + assert.strictEqual('', lines.shift(), 'the first line is empty'); + assert.strictEqual('', lines.shift(), 'the second line is empty'); }); -QUnit.test('handles lines broken across appends', function() { +QUnit.test('handles lines broken across appends', function(assert) { const lines = []; this.lineStream.on('data', function(line) { lines.push(line); }); this.lineStream.push('#EXTM'); - QUnit.strictEqual(0, lines.length, 'no lines are ready'); + assert.strictEqual(0, lines.length, 'no lines are ready'); this.lineStream.push('3U\nmovie.ts\n'); - QUnit.strictEqual(2, lines.length, 'two lines are ready'); - QUnit.strictEqual('#EXTM3U', lines.shift(), 'the first line is the first token'); - QUnit.strictEqual('movie.ts', lines.shift(), 'the second line is the second token'); + assert.strictEqual(2, lines.length, 'two lines are ready'); + assert.strictEqual('#EXTM3U', lines.shift(), 'the first line is the first token'); + assert.strictEqual('movie.ts', lines.shift(), 'the second line is the second token'); }); -QUnit.test('stops sending events after deregistering', function() { +QUnit.test('stops sending events after deregistering', function(assert) { const temporaryLines = []; const temporary = function(line) { temporaryLines.push(line); @@ -68,14 +68,14 @@ QUnit.test('stops sending events after deregistering', function() { this.lineStream.on('data', temporary); this.lineStream.on('data', permanent); this.lineStream.push('line one\n'); - QUnit.strictEqual(temporaryLines.length, + assert.strictEqual(temporaryLines.length, permanentLines.length, 'both callbacks receive the event'); - QUnit.ok(this.lineStream.off('data', temporary), 'a listener was removed'); + assert.ok(this.lineStream.off('data', temporary), 'a listener was removed'); this.lineStream.push('line two\n'); - QUnit.strictEqual(1, temporaryLines.length, 'no new events are received'); - QUnit.strictEqual(2, permanentLines.length, 'new events are still received'); + assert.strictEqual(1, temporaryLines.length, 'no new events are received'); + assert.strictEqual(2, permanentLines.length, 'new events are still received'); }); QUnit.module('ParseStream', { @@ -85,7 +85,7 @@ QUnit.module('ParseStream', { this.lineStream.pipe(this.parseStream); } }); -QUnit.test('parses comment lines', function() { +QUnit.test('parses comment lines', function(assert) { const manifest = '# a line that starts with a hash mark without "EXT" is a comment\n'; let element; @@ -94,13 +94,13 @@ QUnit.test('parses comment lines', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'comment', 'the type is comment'); - QUnit.strictEqual(element.text, + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'comment', 'the type is comment'); + assert.strictEqual(element.text, manifest.slice(1, manifest.length - 1), 'the comment text is parsed'); }); -QUnit.test('parses uri lines', function() { +QUnit.test('parses uri lines', function(assert) { const manifest = 'any non-blank line that does not start with a hash-mark is a URI\n'; let element; @@ -109,13 +109,13 @@ QUnit.test('parses uri lines', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'uri', 'the type is uri'); - QUnit.strictEqual(element.uri, + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'uri', 'the type is uri'); + assert.strictEqual(element.uri, manifest.substring(0, manifest.length - 1), 'the uri text is parsed'); }); -QUnit.test('parses unknown tag types', function() { +QUnit.test('parses unknown tag types', function(assert) { const manifest = '#EXT-X-EXAMPLE-TAG:some,additional,stuff\n'; let element; @@ -124,15 +124,15 @@ QUnit.test('parses unknown tag types', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the type is tag'); - QUnit.strictEqual(element.data, + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the type is tag'); + assert.strictEqual(element.data, manifest.slice(4, manifest.length - 1), 'unknown tag data is preserved'); }); // #EXTM3U -QUnit.test('parses #EXTM3U tags', function() { +QUnit.test('parses #EXTM3U tags', function(assert) { const manifest = '#EXTM3U\n'; let element; @@ -141,13 +141,13 @@ QUnit.test('parses #EXTM3U tags', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'm3u', 'the tag type is m3u'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'm3u', 'the tag type is m3u'); }); // #EXTINF -QUnit.test('parses minimal #EXTINF tags', function() { +QUnit.test('parses minimal #EXTINF tags', function(assert) { const manifest = '#EXTINF\n'; let element; @@ -156,11 +156,11 @@ QUnit.test('parses minimal #EXTINF tags', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'inf', 'the tag type is inf'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'inf', 'the tag type is inf'); }); -QUnit.test('parses #EXTINF tags with durations', function() { +QUnit.test('parses #EXTINF tags with durations', function(assert) { let manifest = '#EXTINF:15\n'; let element; @@ -169,22 +169,22 @@ QUnit.test('parses #EXTINF tags with durations', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'inf', 'the tag type is inf'); - QUnit.strictEqual(element.duration, 15, 'the duration is parsed'); - QUnit.ok(!('title' in element), 'no title is parsed'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'inf', 'the tag type is inf'); + assert.strictEqual(element.duration, 15, 'the duration is parsed'); + assert.ok(!('title' in element), 'no title is parsed'); manifest = '#EXTINF:21,\n'; this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'inf', 'the tag type is inf'); - QUnit.strictEqual(element.duration, 21, 'the duration is parsed'); - QUnit.ok(!('title' in element), 'no title is parsed'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'inf', 'the tag type is inf'); + assert.strictEqual(element.duration, 21, 'the duration is parsed'); + assert.ok(!('title' in element), 'no title is parsed'); }); -QUnit.test('parses #EXTINF tags with a duration and title', function() { +QUnit.test('parses #EXTINF tags with a duration and title', function(assert) { const manifest = '#EXTINF:13,Does anyone really use the title attribute?\n'; let element; @@ -193,15 +193,15 @@ QUnit.test('parses #EXTINF tags with a duration and title', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'inf', 'the tag type is inf'); - QUnit.strictEqual(element.duration, 13, 'the duration is parsed'); - QUnit.strictEqual(element.title, + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'inf', 'the tag type is inf'); + assert.strictEqual(element.duration, 13, 'the duration is parsed'); + assert.strictEqual(element.title, manifest.substring(manifest.indexOf(',') + 1, manifest.length - 1), 'the title is parsed'); }); -QUnit.test('parses #EXTINF tags with carriage returns', function() { +QUnit.test('parses #EXTINF tags with carriage returns', function(assert) { const manifest = '#EXTINF:13,Does anyone really use the title attribute?\r\n'; let element; @@ -210,17 +210,17 @@ QUnit.test('parses #EXTINF tags with carriage returns', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'inf', 'the tag type is inf'); - QUnit.strictEqual(element.duration, 13, 'the duration is parsed'); - QUnit.strictEqual(element.title, + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'inf', 'the tag type is inf'); + assert.strictEqual(element.duration, 13, 'the duration is parsed'); + assert.strictEqual(element.title, manifest.substring(manifest.indexOf(',') + 1, manifest.length - 2), 'the title is parsed'); }); // #EXT-X-TARGETDURATION -QUnit.test('parses minimal #EXT-X-TARGETDURATION tags', function() { +QUnit.test('parses minimal #EXT-X-TARGETDURATION tags', function(assert) { const manifest = '#EXT-X-TARGETDURATION\n'; let element; @@ -229,12 +229,12 @@ QUnit.test('parses minimal #EXT-X-TARGETDURATION tags', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'targetduration', 'the tag type is targetduration'); - QUnit.ok(!('duration' in element), 'no duration is parsed'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'targetduration', 'the tag type is targetduration'); + assert.ok(!('duration' in element), 'no duration is parsed'); }); -QUnit.test('parses #EXT-X-TARGETDURATION with duration', function() { +QUnit.test('parses #EXT-X-TARGETDURATION with duration', function(assert) { const manifest = '#EXT-X-TARGETDURATION:47\n'; let element; @@ -243,14 +243,14 @@ QUnit.test('parses #EXT-X-TARGETDURATION with duration', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'targetduration', 'the tag type is targetduration'); - QUnit.strictEqual(element.duration, 47, 'the duration is parsed'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'targetduration', 'the tag type is targetduration'); + assert.strictEqual(element.duration, 47, 'the duration is parsed'); }); // #EXT-X-VERSION -QUnit.test('parses minimal #EXT-X-VERSION tags', function() { +QUnit.test('parses minimal #EXT-X-VERSION tags', function(assert) { const manifest = '#EXT-X-VERSION:\n'; let element; @@ -259,12 +259,12 @@ QUnit.test('parses minimal #EXT-X-VERSION tags', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'version', 'the tag type is version'); - QUnit.ok(!('version' in element), 'no version is present'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'version', 'the tag type is version'); + assert.ok(!('version' in element), 'no version is present'); }); -QUnit.test('parses #EXT-X-VERSION with a version', function() { +QUnit.test('parses #EXT-X-VERSION with a version', function(assert) { const manifest = '#EXT-X-VERSION:99\n'; let element; @@ -273,14 +273,14 @@ QUnit.test('parses #EXT-X-VERSION with a version', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'version', 'the tag type is version'); - QUnit.strictEqual(element.version, 99, 'the version is parsed'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'version', 'the tag type is version'); + assert.strictEqual(element.version, 99, 'the version is parsed'); }); // #EXT-X-MEDIA-SEQUENCE -QUnit.test('parses minimal #EXT-X-MEDIA-SEQUENCE tags', function() { +QUnit.test('parses minimal #EXT-X-MEDIA-SEQUENCE tags', function(assert) { const manifest = '#EXT-X-MEDIA-SEQUENCE\n'; let element; @@ -289,12 +289,12 @@ QUnit.test('parses minimal #EXT-X-MEDIA-SEQUENCE tags', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'media-sequence', 'the tag type is media-sequence'); - QUnit.ok(!('number' in element), 'no number is present'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'media-sequence', 'the tag type is media-sequence'); + assert.ok(!('number' in element), 'no number is present'); }); -QUnit.test('parses #EXT-X-MEDIA-SEQUENCE with sequence numbers', function() { +QUnit.test('parses #EXT-X-MEDIA-SEQUENCE with sequence numbers', function(assert) { const manifest = '#EXT-X-MEDIA-SEQUENCE:109\n'; let element; @@ -303,14 +303,14 @@ QUnit.test('parses #EXT-X-MEDIA-SEQUENCE with sequence numbers', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'media-sequence', 'the tag type is media-sequence'); - QUnit.ok(element.number, 109, 'the number is parsed'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'media-sequence', 'the tag type is media-sequence'); + assert.ok(element.number, 109, 'the number is parsed'); }); // #EXT-X-PLAYLIST-TYPE -QUnit.test('parses minimal #EXT-X-PLAYLIST-TYPE tags', function() { +QUnit.test('parses minimal #EXT-X-PLAYLIST-TYPE tags', function(assert) { const manifest = '#EXT-X-PLAYLIST-TYPE:\n'; let element; @@ -319,12 +319,12 @@ QUnit.test('parses minimal #EXT-X-PLAYLIST-TYPE tags', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'playlist-type', 'the tag type is playlist-type'); - QUnit.ok(!('playlistType' in element), 'no playlist type is present'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'playlist-type', 'the tag type is playlist-type'); + assert.ok(!('playlistType' in element), 'no playlist type is present'); }); -QUnit.test('parses #EXT-X-PLAYLIST-TYPE with mutability info', function() { +QUnit.test('parses #EXT-X-PLAYLIST-TYPE with mutability info', function(assert) { let manifest = '#EXT-X-PLAYLIST-TYPE:EVENT\n'; let element; @@ -333,28 +333,28 @@ QUnit.test('parses #EXT-X-PLAYLIST-TYPE with mutability info', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'playlist-type', 'the tag type is playlist-type'); - QUnit.strictEqual(element.playlistType, 'EVENT', 'the playlist type is EVENT'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'playlist-type', 'the tag type is playlist-type'); + assert.strictEqual(element.playlistType, 'EVENT', 'the playlist type is EVENT'); manifest = '#EXT-X-PLAYLIST-TYPE:VOD\n'; this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'playlist-type', 'the tag type is playlist-type'); - QUnit.strictEqual(element.playlistType, 'VOD', 'the playlist type is VOD'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'playlist-type', 'the tag type is playlist-type'); + assert.strictEqual(element.playlistType, 'VOD', 'the playlist type is VOD'); manifest = '#EXT-X-PLAYLIST-TYPE:nonsense\n'; this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'playlist-type', 'the tag type is playlist-type'); - QUnit.strictEqual(element.playlistType, 'nonsense', 'the playlist type is parsed'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'playlist-type', 'the tag type is playlist-type'); + assert.strictEqual(element.playlistType, 'nonsense', 'the playlist type is parsed'); }); // #EXT-X-BYTERANGE -QUnit.test('parses minimal #EXT-X-BYTERANGE tags', function() { +QUnit.test('parses minimal #EXT-X-BYTERANGE tags', function(assert) { const manifest = '#EXT-X-BYTERANGE\n'; let element; @@ -363,13 +363,13 @@ QUnit.test('parses minimal #EXT-X-BYTERANGE tags', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'byterange', 'the tag type is byterange'); - QUnit.ok(!('length' in element), 'no length is present'); - QUnit.ok(!('offset' in element), 'no offset is present'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'byterange', 'the tag type is byterange'); + assert.ok(!('length' in element), 'no length is present'); + assert.ok(!('offset' in element), 'no offset is present'); }); -QUnit.test('parses #EXT-X-BYTERANGE with length and offset', function() { +QUnit.test('parses #EXT-X-BYTERANGE with length and offset', function(assert) { let manifest = '#EXT-X-BYTERANGE:45\n'; let element; @@ -378,23 +378,23 @@ QUnit.test('parses #EXT-X-BYTERANGE with length and offset', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'byterange', 'the tag type is byterange'); - QUnit.strictEqual(element.length, 45, 'length is parsed'); - QUnit.ok(!('offset' in element), 'no offset is present'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'byterange', 'the tag type is byterange'); + assert.strictEqual(element.length, 45, 'length is parsed'); + assert.ok(!('offset' in element), 'no offset is present'); manifest = '#EXT-X-BYTERANGE:108@16\n'; this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'byterange', 'the tag type is byterange'); - QUnit.strictEqual(element.length, 108, 'length is parsed'); - QUnit.strictEqual(element.offset, 16, 'offset is parsed'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'byterange', 'the tag type is byterange'); + assert.strictEqual(element.length, 108, 'length is parsed'); + assert.strictEqual(element.offset, 16, 'offset is parsed'); }); // #EXT-X-ALLOW-CACHE -QUnit.test('parses minimal #EXT-X-ALLOW-CACHE tags', function() { +QUnit.test('parses minimal #EXT-X-ALLOW-CACHE tags', function(assert) { const manifest = '#EXT-X-ALLOW-CACHE:\n'; let element; @@ -403,12 +403,12 @@ QUnit.test('parses minimal #EXT-X-ALLOW-CACHE tags', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'allow-cache', 'the tag type is allow-cache'); - QUnit.ok(!('allowed' in element), 'no allowed is present'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'allow-cache', 'the tag type is allow-cache'); + assert.ok(!('allowed' in element), 'no allowed is present'); }); -QUnit.test('parses valid #EXT-X-ALLOW-CACHE tags', function() { +QUnit.test('parses valid #EXT-X-ALLOW-CACHE tags', function(assert) { let manifest = '#EXT-X-ALLOW-CACHE:YES\n'; let element; @@ -417,21 +417,21 @@ QUnit.test('parses valid #EXT-X-ALLOW-CACHE tags', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'allow-cache', 'the tag type is allow-cache'); - QUnit.ok(element.allowed, 'allowed is parsed'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'allow-cache', 'the tag type is allow-cache'); + assert.ok(element.allowed, 'allowed is parsed'); manifest = '#EXT-X-ALLOW-CACHE:NO\n'; this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'allow-cache', 'the tag type is allow-cache'); - QUnit.ok(!element.allowed, 'allowed is parsed'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'allow-cache', 'the tag type is allow-cache'); + assert.ok(!element.allowed, 'allowed is parsed'); }); // #EXT-X-MAP -QUnit.test('parses minimal #EXT-X-MAP tags', function() { +QUnit.test('parses minimal #EXT-X-MAP tags', function(assert) { const manifest = '#EXT-X-MAP:URI="init.m4s"\n'; let element; @@ -440,12 +440,12 @@ QUnit.test('parses minimal #EXT-X-MAP tags', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'map', 'the tag type is map'); - QUnit.strictEqual(element.uri, 'init.m4s', 'parsed the uri'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'map', 'the tag type is map'); + assert.strictEqual(element.uri, 'init.m4s', 'parsed the uri'); }); -QUnit.test('parses #EXT-X-MAP tags with a byterange', function() { +QUnit.test('parses #EXT-X-MAP tags with a byterange', function(assert) { const manifest = '#EXT-X-MAP:URI="0.m4s", BYTERANGE="1000@23"\n'; let element; @@ -454,16 +454,16 @@ QUnit.test('parses #EXT-X-MAP tags with a byterange', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.uri, '0.m4s', 'parsed the uri'); - QUnit.strictEqual(element.byterange.length, + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.uri, '0.m4s', 'parsed the uri'); + assert.strictEqual(element.byterange.length, 1000, 'parsed the byterange length'); - QUnit.strictEqual(element.byterange.offset, + assert.strictEqual(element.byterange.offset, 23, 'parsed the byterange offset'); }); -QUnit.test('parses #EXT-X-MAP tags with arbitrary attributes', function() { +QUnit.test('parses #EXT-X-MAP tags with arbitrary attributes', function(assert) { const manifest = '#EXT-X-MAP:URI="init.mp4", SOMETHING=YES,BYTERANGE="720@0"\n'; let element; @@ -472,17 +472,17 @@ QUnit.test('parses #EXT-X-MAP tags with arbitrary attributes', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.uri, 'init.mp4', 'parsed the uri'); - QUnit.strictEqual(element.byterange.length, + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.uri, 'init.mp4', 'parsed the uri'); + assert.strictEqual(element.byterange.length, 720, 'parsed the byterange length'); - QUnit.strictEqual(element.byterange.offset, + assert.strictEqual(element.byterange.offset, 0, 'parsed the byterange offset'); }); // #EXT-X-STREAM-INF -QUnit.test('parses minimal #EXT-X-STREAM-INF tags', function() { +QUnit.test('parses minimal #EXT-X-STREAM-INF tags', function(assert) { const manifest = '#EXT-X-STREAM-INF\n'; let element; @@ -491,13 +491,13 @@ QUnit.test('parses minimal #EXT-X-STREAM-INF tags', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'stream-inf', 'the tag type is stream-inf'); - QUnit.ok(!('attributes' in element), 'no attributes are present'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'stream-inf', 'the tag type is stream-inf'); + assert.ok(!('attributes' in element), 'no attributes are present'); }); // #EXT-X-PROGRAM-DATE-TIME -QUnit.test('parses minimal EXT-X-PROGRAM-DATE-TIME tags', function() { +QUnit.test('parses minimal EXT-X-PROGRAM-DATE-TIME tags', function(assert) { const manifest = '#EXT-X-PROGRAM-DATE-TIME\n'; let element; @@ -506,13 +506,13 @@ QUnit.test('parses minimal EXT-X-PROGRAM-DATE-TIME tags', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'program-date-time', 'the tag type is date-time'); - QUnit.ok(!('dateTimeString' in element), 'no dateTime is present'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'program-date-time', 'the tag type is date-time'); + assert.ok(!('dateTimeString' in element), 'no dateTime is present'); }); QUnit.test('parses EXT-X-PROGRAM-DATE-TIME tags with valid date-time formats', - function() { + function(assert) { let manifest = '#EXT-X-PROGRAM-DATE-TIME:2016-06-22T09:20:16.166-04:00\n'; let element; @@ -521,26 +521,26 @@ QUnit.test('parses EXT-X-PROGRAM-DATE-TIME tags with valid date-time formats', }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'program-date-time', 'the tag type is date-time'); - QUnit.strictEqual(element.dateTimeString, '2016-06-22T09:20:16.166-04:00', + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'program-date-time', 'the tag type is date-time'); + assert.strictEqual(element.dateTimeString, '2016-06-22T09:20:16.166-04:00', 'dateTimeString is parsed'); - QUnit.deepEqual(element.dateTimeObject, new Date('2016-06-22T09:20:16.166-04:00'), + assert.deepEqual(element.dateTimeObject, new Date('2016-06-22T09:20:16.166-04:00'), 'dateTimeObject is parsed'); manifest = '#EXT-X-PROGRAM-DATE-TIME:2016-06-22T09:20:16.16389Z\n'; this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'program-date-time', 'the tag type is date-time'); - QUnit.strictEqual(element.dateTimeString, '2016-06-22T09:20:16.16389Z', + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'program-date-time', 'the tag type is date-time'); + assert.strictEqual(element.dateTimeString, '2016-06-22T09:20:16.16389Z', 'dateTimeString is parsed'); - QUnit.deepEqual(element.dateTimeObject, new Date('2016-06-22T09:20:16.16389Z'), + assert.deepEqual(element.dateTimeObject, new Date('2016-06-22T09:20:16.16389Z'), 'dateTimeObject is parsed'); }); -QUnit.test('parses #EXT-X-STREAM-INF with common attributes', function() { +QUnit.test('parses #EXT-X-STREAM-INF with common attributes', function(assert) { let manifest = '#EXT-X-STREAM-INF:BANDWIDTH=14400\n'; let element; @@ -549,39 +549,39 @@ QUnit.test('parses #EXT-X-STREAM-INF with common attributes', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'stream-inf', 'the tag type is stream-inf'); - QUnit.strictEqual(element.attributes.BANDWIDTH, 14400, 'bandwidth is parsed'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'stream-inf', 'the tag type is stream-inf'); + assert.strictEqual(element.attributes.BANDWIDTH, 14400, 'bandwidth is parsed'); manifest = '#EXT-X-STREAM-INF:PROGRAM-ID=7\n'; this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'stream-inf', 'the tag type is stream-inf'); - QUnit.strictEqual(element.attributes['PROGRAM-ID'], 7, 'program-id is parsed'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'stream-inf', 'the tag type is stream-inf'); + assert.strictEqual(element.attributes['PROGRAM-ID'], 7, 'program-id is parsed'); manifest = '#EXT-X-STREAM-INF:RESOLUTION=396x224\n'; this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'stream-inf', 'the tag type is stream-inf'); - QUnit.strictEqual(element.attributes.RESOLUTION.width, 396, 'width is parsed'); - QUnit.strictEqual(element.attributes.RESOLUTION.height, 224, 'heigth is parsed'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'stream-inf', 'the tag type is stream-inf'); + assert.strictEqual(element.attributes.RESOLUTION.width, 396, 'width is parsed'); + assert.strictEqual(element.attributes.RESOLUTION.height, 224, 'heigth is parsed'); manifest = '#EXT-X-STREAM-INF:CODECS="avc1.4d400d, mp4a.40.2"\n'; this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'stream-inf', 'the tag type is stream-inf'); - QUnit.strictEqual(element.attributes.CODECS, + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'stream-inf', 'the tag type is stream-inf'); + assert.strictEqual(element.attributes.CODECS, 'avc1.4d400d, mp4a.40.2', 'codecs are parsed'); }); -QUnit.test('parses #EXT-X-STREAM-INF with arbitrary attributes', function() { +QUnit.test('parses #EXT-X-STREAM-INF with arbitrary attributes', function(assert) { const manifest = '#EXT-X-STREAM-INF:NUMERIC=24,ALPHA=Value,MIXED=123abc\n'; let element; @@ -590,17 +590,17 @@ QUnit.test('parses #EXT-X-STREAM-INF with arbitrary attributes', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'stream-inf', 'the tag type is stream-inf'); - QUnit.strictEqual(element.attributes.NUMERIC, '24', 'numeric attributes are parsed'); - QUnit.strictEqual(element.attributes.ALPHA, + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'stream-inf', 'the tag type is stream-inf'); + assert.strictEqual(element.attributes.NUMERIC, '24', 'numeric attributes are parsed'); + assert.strictEqual(element.attributes.ALPHA, 'Value', 'alphabetic attributes are parsed'); - QUnit.strictEqual(element.attributes.MIXED, '123abc', 'mixed attributes are parsed'); + assert.strictEqual(element.attributes.MIXED, '123abc', 'mixed attributes are parsed'); }); // #EXT-X-ENDLIST -QUnit.test('parses #EXT-X-ENDLIST tags', function() { +QUnit.test('parses #EXT-X-ENDLIST tags', function(assert) { const manifest = '#EXT-X-ENDLIST\n'; let element; @@ -609,13 +609,13 @@ QUnit.test('parses #EXT-X-ENDLIST tags', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.strictEqual(element.type, 'tag', 'the line type is tag'); - QUnit.strictEqual(element.tagType, 'endlist', 'the tag type is stream-inf'); + assert.ok(element, 'an event was triggered'); + assert.strictEqual(element.type, 'tag', 'the line type is tag'); + assert.strictEqual(element.tagType, 'endlist', 'the tag type is stream-inf'); }); // #EXT-X-KEY -QUnit.test('parses valid #EXT-X-KEY tags', function() { +QUnit.test('parses valid #EXT-X-KEY tags', function(assert) { let manifest = '#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=52"\n'; let element; @@ -625,8 +625,8 @@ QUnit.test('parses valid #EXT-X-KEY tags', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.deepEqual(element, { + assert.ok(element, 'an event was triggered'); + assert.deepEqual(element, { type: 'tag', tagType: 'key', attributes: { @@ -637,8 +637,8 @@ QUnit.test('parses valid #EXT-X-KEY tags', function() { manifest = '#EXT-X-KEY:URI="https://example.com/key#1",METHOD=FutureType-1024\n'; this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.deepEqual(element, { + assert.ok(element, 'an event was triggered'); + assert.deepEqual(element, { type: 'tag', tagType: 'key', attributes: { @@ -649,8 +649,8 @@ QUnit.test('parses valid #EXT-X-KEY tags', function() { manifest = '#EXT-X-KEY:IV=1234567890abcdef1234567890abcdef\n'; this.lineStream.push(manifest); - QUnit.ok(element.attributes.IV, 'detected an IV attribute'); - QUnit.deepEqual(element.attributes.IV, new Uint32Array([ + assert.ok(element.attributes.IV, 'detected an IV attribute'); + assert.deepEqual(element.attributes.IV, new Uint32Array([ 0x12345678, 0x90abcdef, 0x12345678, @@ -658,7 +658,7 @@ QUnit.test('parses valid #EXT-X-KEY tags', function() { ]), 'parsed an IV value'); }); -QUnit.test('parses minimal #EXT-X-KEY tags', function() { +QUnit.test('parses minimal #EXT-X-KEY tags', function(assert) { const manifest = '#EXT-X-KEY:\n'; let element; @@ -667,14 +667,14 @@ QUnit.test('parses minimal #EXT-X-KEY tags', function() { }); this.lineStream.push(manifest); - QUnit.ok(element, 'an event was triggered'); - QUnit.deepEqual(element, { + assert.ok(element, 'an event was triggered'); + assert.deepEqual(element, { type: 'tag', tagType: 'key' }, 'parsed a minimal key tag'); }); -QUnit.test('parses lightly-broken #EXT-X-KEY tags', function() { +QUnit.test('parses lightly-broken #EXT-X-KEY tags', function(assert) { let manifest = '#EXT-X-KEY:URI=\'https://example.com/single-quote\',METHOD=AES-128\n'; let element; @@ -683,27 +683,27 @@ QUnit.test('parses lightly-broken #EXT-X-KEY tags', function() { }); this.lineStream.push(manifest); - QUnit.strictEqual(element.attributes.URI, + assert.strictEqual(element.attributes.URI, 'https://example.com/single-quote', 'parsed a single-quoted uri'); element = null; manifest = '#EXT-X-KEYURI="https://example.com/key",METHOD=AES-128\n'; this.lineStream.push(manifest); - QUnit.strictEqual(element.tagType, 'key', 'parsed the tag type'); - QUnit.strictEqual(element.attributes.URI, + assert.strictEqual(element.tagType, 'key', 'parsed the tag type'); + assert.strictEqual(element.attributes.URI, 'https://example.com/key', 'inferred a colon after the tag type'); element = null; manifest = '#EXT-X-KEY: URI = "https://example.com/key",METHOD=AES-128\n'; this.lineStream.push(manifest); - QUnit.strictEqual(element.attributes.URI, + assert.strictEqual(element.attributes.URI, 'https://example.com/key', 'trims and removes quotes around the URI'); }); -QUnit.test('parses prefixed with 0x or 0X #EXT-X-KEY:IV tags', function() { +QUnit.test('parses prefixed with 0x or 0X #EXT-X-KEY:IV tags', function(assert) { let manifest; let element; @@ -713,8 +713,8 @@ QUnit.test('parses prefixed with 0x or 0X #EXT-X-KEY:IV tags', function() { manifest = '#EXT-X-KEY:IV=0x1234567890abcdef1234567890abcdef\n'; this.lineStream.push(manifest); - QUnit.ok(element.attributes.IV, 'detected an IV attribute'); - QUnit.deepEqual(element.attributes.IV, new Uint32Array([ + assert.ok(element.attributes.IV, 'detected an IV attribute'); + assert.deepEqual(element.attributes.IV, new Uint32Array([ 0x12345678, 0x90abcdef, 0x12345678, @@ -723,8 +723,8 @@ QUnit.test('parses prefixed with 0x or 0X #EXT-X-KEY:IV tags', function() { manifest = '#EXT-X-KEY:IV=0X1234567890abcdef1234567890abcdef\n'; this.lineStream.push(manifest); - QUnit.ok(element.attributes.IV, 'detected an IV attribute'); - QUnit.deepEqual(element.attributes.IV, new Uint32Array([ + assert.ok(element.attributes.IV, 'detected an IV attribute'); + assert.deepEqual(element.attributes.IV, new Uint32Array([ 0x12345678, 0x90abcdef, 0x12345678, @@ -732,7 +732,7 @@ QUnit.test('parses prefixed with 0x or 0X #EXT-X-KEY:IV tags', function() { ]), 'parsed an IV value with 0X'); }); -QUnit.test('ignores empty lines', function() { +QUnit.test('ignores empty lines', function(assert) { const manifest = '\n'; let event = false; @@ -741,16 +741,16 @@ QUnit.test('ignores empty lines', function() { }); this.lineStream.push(manifest); - QUnit.ok(!event, 'no event is triggered'); + assert.ok(!event, 'no event is triggered'); }); QUnit.module('m3u8 parser'); -QUnit.test('can be constructed', function() { - QUnit.notStrictEqual(typeof new Parser(), 'undefined', 'parser is defined'); +QUnit.test('can be constructed', function(assert) { + assert.notStrictEqual(typeof new Parser(), 'undefined', 'parser is defined'); }); -QUnit.test('attaches cue-out data to segment', function() { +QUnit.test('attaches cue-out data to segment', function(assert) { const parser = new Parser(); const manifest = [ @@ -773,12 +773,12 @@ QUnit.test('attaches cue-out data to segment', function() { parser.push(manifest); - QUnit.equal(parser.manifest.segments[1].cueOut, '10', 'parser attached cue out tag'); - QUnit.equal(parser.manifest.segments[2].cueOut, '15', 'cue out without : seperator'); - QUnit.equal(parser.manifest.segments[3].cueOut, '', 'cue out without data'); + assert.equal(parser.manifest.segments[1].cueOut, '10', 'parser attached cue out tag'); + assert.equal(parser.manifest.segments[2].cueOut, '15', 'cue out without : seperator'); + assert.equal(parser.manifest.segments[3].cueOut, '', 'cue out without data'); }); -QUnit.test('attaches cue-out-cont data to segment', function() { +QUnit.test('attaches cue-out-cont data to segment', function(assert) { const parser = new Parser(); const manifest = [ @@ -801,14 +801,14 @@ QUnit.test('attaches cue-out-cont data to segment', function() { parser.push(manifest); - QUnit.equal(parser.manifest.segments[1].cueOutCont, '10/60', + assert.equal(parser.manifest.segments[1].cueOutCont, '10/60', 'parser attached cue out cont tag'); - QUnit.equal(parser.manifest.segments[2].cueOutCont, '15/30', + assert.equal(parser.manifest.segments[2].cueOutCont, '15/30', 'cue out cont without : seperator'); - QUnit.equal(parser.manifest.segments[3].cueOutCont, '', 'cue out cont without data'); + assert.equal(parser.manifest.segments[3].cueOutCont, '', 'cue out cont without data'); }); -QUnit.test('attaches cue-in data to segment', function() { +QUnit.test('attaches cue-in data to segment', function(assert) { const parser = new Parser(); const manifest = [ @@ -831,13 +831,13 @@ QUnit.test('attaches cue-in data to segment', function() { parser.push(manifest); - QUnit.equal(parser.manifest.segments[1].cueIn, '', 'parser attached cue in tag'); - QUnit.equal(parser.manifest.segments[2].cueIn, '15', 'cue in with data'); - QUnit.equal(parser.manifest.segments[3].cueIn, '=abc', + assert.equal(parser.manifest.segments[1].cueIn, '', 'parser attached cue in tag'); + assert.equal(parser.manifest.segments[2].cueIn, '15', 'cue in with data'); + assert.equal(parser.manifest.segments[3].cueIn, '=abc', 'cue in without colon seperator'); }); -QUnit.test('parses characteristics attribute', function() { +QUnit.test('parses characteristics attribute', function(assert) { const parser = new Parser(); const manifest = [ @@ -849,12 +849,12 @@ QUnit.test('parses characteristics attribute', function() { parser.push(manifest); - QUnit.equal(parser.manifest.mediaGroups.SUBTITLES.subs.test.characteristics, + assert.equal(parser.manifest.mediaGroups.SUBTITLES.subs.test.characteristics, 'char', 'parsed CHARACTERISTICS attribute'); }); -QUnit.test('parses FORCED attribute', function() { +QUnit.test('parses FORCED attribute', function(assert) { const parser = new Parser(); const manifest = [ @@ -866,13 +866,13 @@ QUnit.test('parses FORCED attribute', function() { parser.push(manifest); - QUnit.ok(parser.manifest.mediaGroups.SUBTITLES.subs.test.forced, + assert.ok(parser.manifest.mediaGroups.SUBTITLES.subs.test.forced, 'parsed FORCED attribute'); }); QUnit.module('m3u8s'); -QUnit.test('parses static manifests as expected', function() { +QUnit.test('parses static manifests as expected', function(assert) { let key; for (key in testDataManifests) { @@ -880,7 +880,7 @@ QUnit.test('parses static manifests as expected', function() { const parser = new Parser(); parser.push(testDataManifests[key]); - QUnit.deepEqual(parser.manifest, + assert.deepEqual(parser.manifest, testDataExpected[key], key + '.m3u8 was parsed correctly' ); From 1a601a01a19024f265792424f6f74c804b7f9e81 Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Thu, 1 Jun 2017 14:22:48 -0400 Subject: [PATCH 4/9] fix linting --- scripts/export-m3u8s.js | 2 +- scripts/m3u8.js | 13 +++++++------ scripts/test.rollup.config.js | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/export-m3u8s.js b/scripts/export-m3u8s.js index 026166b..7086360 100644 --- a/scripts/export-m3u8s.js +++ b/scripts/export-m3u8s.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; /* eslint no-console: 0 */ const fs = require('fs'); diff --git a/scripts/m3u8.js b/scripts/m3u8.js index 29dd67c..b7a0586 100644 --- a/scripts/m3u8.js +++ b/scripts/m3u8.js @@ -1,14 +1,15 @@ -var m3u8 = require('./export-m3u8s.js'); +'use strict'; +const m3u8 = require('./export-m3u8s.js'); -var args = require('minimist')(process.argv.slice(2), { +const args = require('minimist')(process.argv.slice(2), { boolean: ['watch', 'clean', 'build'], default: { - 'build': true + build: true }, alias: { - 'b': 'build', - 'c': 'clean', - 'w': 'watch' + b: 'build', + c: 'clean', + w: 'watch' } }); diff --git a/scripts/test.rollup.config.js b/scripts/test.rollup.config.js index 6b5f938..3f23a82 100644 --- a/scripts/test.rollup.config.js +++ b/scripts/test.rollup.config.js @@ -20,9 +20,9 @@ export default { 'sinon' ], globals: { - 'qunit': 'QUnit', - 'qunitjs': 'QUnit', - 'sinon': 'sinon' + qunit: 'QUnit', + qunitjs: 'QUnit', + sinon: 'sinon' }, legacy: true, plugins: [ From 242c46c7f0a06c1e4940df1f6d2b31194da9e23f Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Thu, 1 Jun 2017 14:37:37 -0400 Subject: [PATCH 5/9] remove old babel package --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 849d47e..f4a0909 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,6 @@ ], "dependencies": {}, "devDependencies": { - "babel": "^6.5.2", "babel-cli": "^6.11.4", "babel-plugin-external-helpers": "^6.22.0", "babel-plugin-transform-object-assign": "^6.8.0", From b96c75e14d6e4c5fe95136912998007eeabe5056 Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Thu, 1 Jun 2017 14:42:40 -0400 Subject: [PATCH 6/9] loose es2015 --- .babelrc | 2 +- package.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.babelrc b/.babelrc index 520b027..568e630 100644 --- a/.babelrc +++ b/.babelrc @@ -1,4 +1,4 @@ { - "presets": [ "es3", ["es2015"] ], + "presets": [ "es3", ["es2015", {"loose": true}] ], "plugins": ["transform-object-assign"] } diff --git a/package.json b/package.json index f4a0909..b79493d 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,6 @@ "babel-plugin-external-helpers": "^6.22.0", "babel-plugin-transform-object-assign": "^6.8.0", "babel-preset-es2015": "^6.14.0", - "babel-preset-es2015-loose": "^7.0.0", "babel-preset-es3": "^1.0.1", "babelify": "^7.3.0", "bannerize": "^1.0.2", From 40f0e392216b94866959400bea737d7586a72baf Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Mon, 5 Jun 2017 11:42:48 -0400 Subject: [PATCH 7/9] add es3 to rollup configs --- scripts/modules.rollup.config.js | 1 + scripts/test.rollup.config.js | 1 + scripts/umd.rollup.config.js | 1 + 3 files changed, 3 insertions(+) diff --git a/scripts/modules.rollup.config.js b/scripts/modules.rollup.config.js index 05b2884..5286af2 100644 --- a/scripts/modules.rollup.config.js +++ b/scripts/modules.rollup.config.js @@ -18,6 +18,7 @@ export default { babelrc: false, exclude: 'node_modules/**', presets: [ + 'es3', ['es2015', { loose: true, modules: false diff --git a/scripts/test.rollup.config.js b/scripts/test.rollup.config.js index 3f23a82..292bbc4 100644 --- a/scripts/test.rollup.config.js +++ b/scripts/test.rollup.config.js @@ -42,6 +42,7 @@ export default { babelrc: false, exclude: 'node_modules/**', presets: [ + 'es3', ['es2015', { loose: true, modules: false diff --git a/scripts/umd.rollup.config.js b/scripts/umd.rollup.config.js index 4d19fe1..e3d2eef 100644 --- a/scripts/umd.rollup.config.js +++ b/scripts/umd.rollup.config.js @@ -29,6 +29,7 @@ export default { babelrc: false, exclude: 'node_modules/**', presets: [ + 'es3', ['es2015', { loose: true, modules: false From 0cdc9c1c160f747111b1969d17bf4ba5eabb382e Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Mon, 5 Jun 2017 11:46:50 -0400 Subject: [PATCH 8/9] fix indent --- test/m3u8.test.js | 70 +++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/test/m3u8.test.js b/test/m3u8.test.js index 55a5ab5..cfe9039 100644 --- a/test/m3u8.test.js +++ b/test/m3u8.test.js @@ -69,8 +69,8 @@ QUnit.test('stops sending events after deregistering', function(assert) { this.lineStream.on('data', permanent); this.lineStream.push('line one\n'); assert.strictEqual(temporaryLines.length, - permanentLines.length, - 'both callbacks receive the event'); + permanentLines.length, + 'both callbacks receive the event'); assert.ok(this.lineStream.off('data', temporary), 'a listener was removed'); this.lineStream.push('line two\n'); @@ -97,8 +97,8 @@ QUnit.test('parses comment lines', function(assert) { assert.ok(element, 'an event was triggered'); assert.strictEqual(element.type, 'comment', 'the type is comment'); assert.strictEqual(element.text, - manifest.slice(1, manifest.length - 1), - 'the comment text is parsed'); + manifest.slice(1, manifest.length - 1), + 'the comment text is parsed'); }); QUnit.test('parses uri lines', function(assert) { const manifest = 'any non-blank line that does not start with a hash-mark is a URI\n'; @@ -112,8 +112,8 @@ QUnit.test('parses uri lines', function(assert) { assert.ok(element, 'an event was triggered'); assert.strictEqual(element.type, 'uri', 'the type is uri'); assert.strictEqual(element.uri, - manifest.substring(0, manifest.length - 1), - 'the uri text is parsed'); + manifest.substring(0, manifest.length - 1), + 'the uri text is parsed'); }); QUnit.test('parses unknown tag types', function(assert) { const manifest = '#EXT-X-EXAMPLE-TAG:some,additional,stuff\n'; @@ -127,8 +127,8 @@ QUnit.test('parses unknown tag types', function(assert) { assert.ok(element, 'an event was triggered'); assert.strictEqual(element.type, 'tag', 'the type is tag'); assert.strictEqual(element.data, - manifest.slice(4, manifest.length - 1), - 'unknown tag data is preserved'); + manifest.slice(4, manifest.length - 1), + 'unknown tag data is preserved'); }); // #EXTM3U @@ -198,8 +198,8 @@ QUnit.test('parses #EXTINF tags with a duration and title', function(assert) { assert.strictEqual(element.tagType, 'inf', 'the tag type is inf'); assert.strictEqual(element.duration, 13, 'the duration is parsed'); assert.strictEqual(element.title, - manifest.substring(manifest.indexOf(',') + 1, manifest.length - 1), - 'the title is parsed'); + manifest.substring(manifest.indexOf(',') + 1, manifest.length - 1), + 'the title is parsed'); }); QUnit.test('parses #EXTINF tags with carriage returns', function(assert) { const manifest = '#EXTINF:13,Does anyone really use the title attribute?\r\n'; @@ -215,8 +215,8 @@ QUnit.test('parses #EXTINF tags with carriage returns', function(assert) { assert.strictEqual(element.tagType, 'inf', 'the tag type is inf'); assert.strictEqual(element.duration, 13, 'the duration is parsed'); assert.strictEqual(element.title, - manifest.substring(manifest.indexOf(',') + 1, manifest.length - 2), - 'the title is parsed'); + manifest.substring(manifest.indexOf(',') + 1, manifest.length - 2), + 'the title is parsed'); }); // #EXT-X-TARGETDURATION @@ -457,11 +457,11 @@ QUnit.test('parses #EXT-X-MAP tags with a byterange', function(assert) { assert.ok(element, 'an event was triggered'); assert.strictEqual(element.uri, '0.m4s', 'parsed the uri'); assert.strictEqual(element.byterange.length, - 1000, - 'parsed the byterange length'); + 1000, + 'parsed the byterange length'); assert.strictEqual(element.byterange.offset, - 23, - 'parsed the byterange offset'); + 23, + 'parsed the byterange offset'); }); QUnit.test('parses #EXT-X-MAP tags with arbitrary attributes', function(assert) { const manifest = '#EXT-X-MAP:URI="init.mp4", SOMETHING=YES,BYTERANGE="720@0"\n'; @@ -475,11 +475,11 @@ QUnit.test('parses #EXT-X-MAP tags with arbitrary attributes', function(assert) assert.ok(element, 'an event was triggered'); assert.strictEqual(element.uri, 'init.mp4', 'parsed the uri'); assert.strictEqual(element.byterange.length, - 720, - 'parsed the byterange length'); + 720, + 'parsed the byterange length'); assert.strictEqual(element.byterange.offset, - 0, - 'parsed the byterange offset'); + 0, + 'parsed the byterange offset'); }); // #EXT-X-STREAM-INF QUnit.test('parses minimal #EXT-X-STREAM-INF tags', function(assert) { @@ -578,8 +578,8 @@ QUnit.test('parses #EXT-X-STREAM-INF with common attributes', function(assert) { assert.strictEqual(element.type, 'tag', 'the line type is tag'); assert.strictEqual(element.tagType, 'stream-inf', 'the tag type is stream-inf'); assert.strictEqual(element.attributes.CODECS, - 'avc1.4d400d, mp4a.40.2', - 'codecs are parsed'); + 'avc1.4d400d, mp4a.40.2', + 'codecs are parsed'); }); QUnit.test('parses #EXT-X-STREAM-INF with arbitrary attributes', function(assert) { const manifest = '#EXT-X-STREAM-INF:NUMERIC=24,ALPHA=Value,MIXED=123abc\n'; @@ -595,8 +595,8 @@ QUnit.test('parses #EXT-X-STREAM-INF with arbitrary attributes', function(assert assert.strictEqual(element.tagType, 'stream-inf', 'the tag type is stream-inf'); assert.strictEqual(element.attributes.NUMERIC, '24', 'numeric attributes are parsed'); assert.strictEqual(element.attributes.ALPHA, - 'Value', - 'alphabetic attributes are parsed'); + 'Value', + 'alphabetic attributes are parsed'); assert.strictEqual(element.attributes.MIXED, '123abc', 'mixed attributes are parsed'); }); // #EXT-X-ENDLIST @@ -684,23 +684,23 @@ QUnit.test('parses lightly-broken #EXT-X-KEY tags', function(assert) { this.lineStream.push(manifest); assert.strictEqual(element.attributes.URI, - 'https://example.com/single-quote', - 'parsed a single-quoted uri'); + 'https://example.com/single-quote', + 'parsed a single-quoted uri'); element = null; manifest = '#EXT-X-KEYURI="https://example.com/key",METHOD=AES-128\n'; this.lineStream.push(manifest); assert.strictEqual(element.tagType, 'key', 'parsed the tag type'); assert.strictEqual(element.attributes.URI, - 'https://example.com/key', - 'inferred a colon after the tag type'); + 'https://example.com/key', + 'inferred a colon after the tag type'); element = null; manifest = '#EXT-X-KEY: URI = "https://example.com/key",METHOD=AES-128\n'; this.lineStream.push(manifest); assert.strictEqual(element.attributes.URI, - 'https://example.com/key', - 'trims and removes quotes around the URI'); + 'https://example.com/key', + 'trims and removes quotes around the URI'); }); QUnit.test('parses prefixed with 0x or 0X #EXT-X-KEY:IV tags', function(assert) { @@ -850,8 +850,8 @@ QUnit.test('parses characteristics attribute', function(assert) { parser.push(manifest); assert.equal(parser.manifest.mediaGroups.SUBTITLES.subs.test.characteristics, - 'char', - 'parsed CHARACTERISTICS attribute'); + 'char', + 'parsed CHARACTERISTICS attribute'); }); QUnit.test('parses FORCED attribute', function(assert) { @@ -867,7 +867,7 @@ QUnit.test('parses FORCED attribute', function(assert) { parser.push(manifest); assert.ok(parser.manifest.mediaGroups.SUBTITLES.subs.test.forced, - 'parsed FORCED attribute'); + 'parsed FORCED attribute'); }); QUnit.module('m3u8s'); @@ -881,8 +881,8 @@ QUnit.test('parses static manifests as expected', function(assert) { parser.push(testDataManifests[key]); assert.deepEqual(parser.manifest, - testDataExpected[key], - key + '.m3u8 was parsed correctly' + testDataExpected[key], + key + '.m3u8 was parsed correctly' ); } } From 7928016cddf33e3bc03d24d3338ee6e930324f70 Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Fri, 9 Jun 2017 13:42:24 -0400 Subject: [PATCH 9/9] chore: prepare CHANGELOG for conventional changelog --- CHANGELOG.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dbceed..44776f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,3 @@ -CHANGELOG -========= - -## HEAD (Unreleased) -_(none)_ - --------------------- - ## 2.1.0 (2017-02-23) * parse FORCED attribute of media-groups [#15](https://github.com/videojs/m3u8-parser/pull/15) * Pass any CHARACTERISTICS value of a track with the track object [#14](https://github.com/videojs/m3u8-parser/pull/14)