vscode-plugin/config/webpack.tests.config.js
tonycheang 28f70f2d31
Line Decoration for Code Nav (#350)
* update: typescript to latest

* add: ts bundling with ts-loader

* add: KiteCodeLensProvider skeleton

* change: wip codelens -> prototype inline decoration

* update: rm vscode devDep in favor of @types/vscode and vscode-test

See https://code.visualstudio.com/updates/v1_36#_splitting-vscode-package-into-typesvscode-and-vscodetest

* improve: consolidate after block to avoid conflicting styles

Long standing vscode bug "Inline decorations can interfere with one another"
https://github.com/microsoft/vscode/issues/33852

* remove: post-install since now using @types/vscode

* update: webpack and webpack-cli to latest

* migrate: to using vscode-test via webpack transpiling

* improve: fix various tests and improve dev test experience

* improve: use link theme color for inline message

* improve: bump kite-api and use getLineDecoration

* add: source-map and typescript test support

* migrate: expect.js -> chai for assertion style testing

* remove: unused deps + update sinon

* test: codenav-decoration
2021-01-13 11:02:31 -08:00

73 lines
1.7 KiB
JavaScript

'use strict';
const glob = require('glob');
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const CopyPlugin = require('copy-webpack-plugin');
const OUT_TEST_DIR = path.resolve(__dirname, '..', 'out', 'test');
const TEST_DIR = path.resolve(__dirname, '..', 'test');
const TestNeedsUpdating = {
'autostart.test.js': true,
'json-runner.test.js': true,
};
const testEntries = glob
.sync('*.test.{js,ts}', { cwd: TEST_DIR })
.reduce((obj, filename) => {
if (!TestNeedsUpdating[filename]) {
const filenameWithoutExt = filename.replace(path.extname(filename), '');
obj[filenameWithoutExt] = path.resolve(TEST_DIR, filename);
}
return obj;
}, {});
module.exports = {
entry: {
['runTests']: path.resolve(__dirname, '..', 'test', 'runTests.js'),
['index']: path.resolve(__dirname, '..', 'test', 'index.ts'),
...testEntries
},
output: {
path: OUT_TEST_DIR,
filename: '[name].js',
libraryTarget: 'commonjs2',
devtoolModuleFilenameTemplate: '../[resource-path]'
},
devtool: 'source-map',
target: 'node',
externals: [
{
vscode: 'commonjs2 vscode',
fs: 'commonjs2 fs',
crypto: 'commonjs2 crypto',
child_process: 'commonjs2 child_process',
['editors-json-tests']: 'commonjs2 editors-json-tests',
},
nodeExternals()
],
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.ts', '.js'],
},
plugins: [
new CopyPlugin([
{
from: 'fixtures/',
to: path.resolve(OUT_TEST_DIR, 'fixtures/')
}
],
{ context: TEST_DIR }
)
],
};