Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Ib Green committed Mar 14, 2019
1 parent 7bab9f4 commit 5c079fd
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 81 deletions.
6 changes: 5 additions & 1 deletion modules/core/test/data-uri-utils/decode-data-uri.spec.js
Expand Up @@ -53,7 +53,11 @@ test('decodeDataUri', t => {

arrayBuffer = result.arrayBuffer;
t.ok(isArrayBuffer(arrayBuffer));
t.equals(toString(arrayBuffer), 'important content!', 'should allow implicit text/plain with charset');
t.equals(
toString(arrayBuffer),
'important content!',
'should allow implicit text/plain with charset'
);

t.end();
});
115 changes: 58 additions & 57 deletions test/start.js
Expand Up @@ -17,70 +17,71 @@ const arg = process.argv.length >= 4 ? process.argv[3] : 'default';
console.log(`Running test suite in "${mode}" mode...`); // eslint-disable-line

switch (mode) {
case 'fast':
case 'test':
case 'ci':
require('./modules');
break;
case 'fast':
case 'test':
case 'ci':
require('./modules');
break;

case 'dist':
// TODO - all aliases need to be redefined
// Load deck.gl itself from the dist folder
const dist = arg === 'default' ? 'es6' : arg;
moduleAlias.addAlias('loaders.gl', path.resolve(`./dist/${dist}`));
require('./modules');
break;
case 'dist':
// TODO - all aliases need to be redefined
// Load deck.gl itself from the dist folder
const dist = arg === 'default' ? 'es6' : arg;
moduleAlias.addAlias('loaders.gl', path.resolve(`./dist/${dist}`));
require('./modules');
break;

case 'cover':
require('@babel/register');
require('./modules');
break;
case 'cover':
require('@babel/register');
require('./modules');
break;

case 'browser':
new BrowserTestDriver().run({
command: 'webpack-dev-server',
arguments: ['--config', 'test/webpack.config.js', '--env.testBrowser'],
headless: mode === 'browser-headless'
});
break;
case 'browser':
new BrowserTestDriver().run({
command: 'webpack-dev-server',
arguments: ['--config', 'test/webpack.config.js', '--env.testBrowser'],
headless: mode === 'browser-headless'
});
break;

case 'browser-headless':
new BrowserTestDriver().run({
command: 'webpack-dev-server',
arguments: ['--config', 'test/webpack.config.js', '--env.testBrowser'],
headless: mode === 'browser-headless'
});
break;
case 'browser-headless':
new BrowserTestDriver().run({
command: 'webpack-dev-server',
arguments: ['--config', 'test/webpack.config.js', '--env.testBrowser'],
headless: mode === 'browser-headless'
});
break;

case 'render':
new BrowserTestDriver().run({
command: 'webpack-dev-server',
arguments: ['--config', 'test/webpack.config.js', '--env.render'],
headless: false
});
break;
case 'render':
new BrowserTestDriver().run({
command: 'webpack-dev-server',
arguments: ['--config', 'test/webpack.config.js', '--env.render'],
headless: false
});
break;

case 'bench':
require('./bench/index'); // Run the benchmarks
break;
case 'bench':
require('./bench/index'); // Run the benchmarks
break;

case 'bench-browser':
new BrowserTestDriver().run({
command: 'webpack-dev-server',
arguments: ['--config', 'test/webpack.config.js', '--env.bench']
});
break;
case 'bench-browser':
new BrowserTestDriver().run({
command: 'webpack-dev-server',
arguments: ['--config', 'test/webpack.config.js', '--env.bench']
});
break;

case 'analyze':
case 'analyze-size':
const {exec} = require('child_process');
const childProcess = exec(
'webpack --config test/webpack.config.js --hide-modules --env.import-nothing --env.analyze --env.es6');
childProcess.stdout.pipe(process.stdout);
childProcess.stderr.pipe(process.stderr);
break;
case 'analyze':
case 'analyze-size':
const {exec} = require('child_process');
const childProcess = exec(
'webpack --config test/webpack.config.js --hide-modules --env.import-nothing --env.analyze --env.es6'
);
childProcess.stdout.pipe(process.stdout);
childProcess.stderr.pipe(process.stderr);
break;

default:
console.error(`Unknown test mode ${mode}`); // eslint-disable-line
require('./modules');
default:
console.error(`Unknown test mode ${mode}`); // eslint-disable-line
require('./modules');
}
45 changes: 22 additions & 23 deletions test/webpack.config.js
Expand Up @@ -27,8 +27,7 @@ const BABEL_CONFIG = require('../babel.config').config;
const ALIASES = require(resolve(__dirname, '../aliases'));

// The following files will be imported/required as array buffers via arraybuffer-loader
const BINARY_FILE_EXTENSIONS =
/\.drc$|\.ply$|\.pcd$|\.glb$|\.las$|\.laz$|\.png$|\.jpeg$|\.gif$|\.bmp$|\.tiff$|\.bin|\.arrow/;
const BINARY_FILE_EXTENSIONS = /\.drc$|\.ply$|\.pcd$|\.glb$|\.las$|\.laz$|\.png$|\.jpeg$|\.gif$|\.bmp$|\.tiff$|\.bin|\.arrow/;

const COMMON_CONFIG = {
mode: 'development',
Expand Down Expand Up @@ -104,9 +103,7 @@ const TEST_CONFIG = Object.assign({}, COMMON_CONFIG, {
alias: Object.assign({}, ALIASES)
},

plugins: [
new HtmlWebpackPlugin({title: 'loaders.gl tests'})
]
plugins: [new HtmlWebpackPlugin({title: 'loaders.gl tests'})]
});

// Get first key in an object
Expand Down Expand Up @@ -135,17 +132,19 @@ function getDist(env) {
const CONFIGS = {
test: env => TEST_CONFIG,

bench: env => Object.assign({}, TEST_CONFIG, {
entry: {
'test-browser': resolve(__dirname, './bench/browser.js')
}
}),
bench: env =>
Object.assign({}, TEST_CONFIG, {
entry: {
'test-browser': resolve(__dirname, './bench/browser.js')
}
}),

render: env => Object.assign({}, TEST_CONFIG, {
entry: {
'test-browser': resolve(__dirname, './render/index.js')
}
}),
render: env =>
Object.assign({}, TEST_CONFIG, {
entry: {
'test-browser': resolve(__dirname, './render/index.js')
}
}),

size: env => {
const dist = getDist(env);
Expand All @@ -159,14 +158,14 @@ const CONFIGS = {
});

switch (dist) {
case 'es6':
config.resolve.mainFields = ['esnext', 'browser', 'module', 'main'];
break;
case 'es5':
config.resolve.mainFields = ['browser', 'main'];
break;
case 'esm':
default:
case 'es6':
config.resolve.mainFields = ['esnext', 'browser', 'module', 'main'];
break;
case 'es5':
config.resolve.mainFields = ['browser', 'main'];
break;
case 'esm':
default:
}
return config;
},
Expand Down

0 comments on commit 5c079fd

Please sign in to comment.