1/* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16const path = require('path'); 17const glob = require('glob'); 18 19const config = require('./webpack.config.common'); 20 21config['mode'] = 'development'; 22 23const allTestFiles = [...glob.sync('./src/**/*_test.js'), ...glob.sync('./src/**/*_test.ts')]; 24const unitTestFiles = allTestFiles 25 .filter((file) => !file.match('.*_component_test\\.(js|ts)$')) 26 .filter((file) => !file.match('.*e2e.*')); 27config['entry'] = { 28 tests: unitTestFiles, 29}; 30 31config['output'] = { 32 path: path.resolve(__dirname, 'dist/unit_test'), 33 filename: 'bundle.js', 34}; 35 36config['target'] = 'node'; 37config['node'] = { 38 __dirname: false, 39}; 40 41module.exports = config; 42