Skip to content

Commit

Permalink
test: add playback-min as a unit test type (#1077)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonocasey authored Feb 22, 2021
1 parent aa5f0a1 commit 327a572
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
test-type: [unit, playback]
test-type: [unit, playback, playback-min]
env:
BROWSER_STACK_USERNAME: ${{secrets.BROWSER_STACK_USERNAME}}
BROWSER_STACK_ACCESS_KEY: ${{secrets.BROWSER_STACK_ACCESS_KEY}}
Expand Down
17 changes: 11 additions & 6 deletions scripts/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const {terser} = require('rollup-plugin-terser');
const createTestData = require('./create-test-data.js');
const replace = require('@rollup/plugin-replace');

const CI_TEST_TYPE = process.env.CI_TEST_TYPE || '';

let syncWorker;
// see https://github.com/videojs/videojs-generate-rollup-config
// for options
Expand Down Expand Up @@ -35,6 +37,10 @@ const options = {
defaults.test.unshift('worker');
defaults.test.unshift('createTestData');

if (CI_TEST_TYPE === 'playback-min') {
defaults.test.push('uglify');
}

// istanbul is only in the list for regular builds and not watch
if (defaults.test.indexOf('istanbul') !== -1) {
defaults.test.splice(defaults.test.indexOf('istanbul'), 1);
Expand Down Expand Up @@ -84,13 +90,12 @@ const options = {
}
};

if (process.env.CI_TEST_TYPE) {
if (process.env.CI_TEST_TYPE === 'playback') {
options.testInput = 'test/playback.test.js';
} else {
options.testInput = {include: ['test/**/*.test.js'], exclude: ['test/playback.test.js']};
}
if (CI_TEST_TYPE === 'playback' || CI_TEST_TYPE === 'playback-min') {
options.testInput = 'test/playback.test.js';
} else if (CI_TEST_TYPE === 'unit') {
options.testInput = {include: ['test/**/*.test.js'], exclude: ['test/playback.test.js']};
}

const config = generate(options);

if (config.builds.browser) {
Expand Down

0 comments on commit 327a572

Please sign in to comment.