1 Star 1 Fork 75

JackEasons/rsuite

forked from rsuite/rsuite 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
karma.conf.js 2.26 KB
一键复制 编辑 原始数据 按行查看 历史
/* eslint-disable @typescript-eslint/no-var-requires */
/**
* Run all tests: `npm run tdd`
* Run all styles tests: `M=styles npm run tdd`
* Run a component test: `M=Button npm run tdd`
* Run a test of a file: `src/Picker/test/PickerToggleSpec.js npm run tdd`
*/
const path = require('path');
const webpack = require('webpack');
const webpackConfig = {
output: {
pathinfo: true
},
mode: 'development',
resolve: {
extensions: ['.ts', '.tsx', '.js'],
alias: {
'@test': path.resolve(__dirname, './test')
}
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
RUN_ENV: JSON.stringify(process.env.RUN_ENV)
}
})
],
module: {
rules: [
{
test: [/\.tsx?$/, /\.jsx?$/],
use: ['babel-loader?babelrc'],
exclude: /node_modules/
},
{
test: /\.(less|css)$/,
use: [
{
loader: 'style-loader' // creates style nodes from JS strings
},
{
loader: 'css-loader' // translates CSS into CommonJS
},
{
loader: 'less-loader', // compiles Less to CSS,
options: {
javascriptEnabled: true
}
}
]
}
]
}
};
module.exports = config => {
const { env } = process;
const { M, F } = env;
let testFile = 'test/index.js';
if (M) {
testFile = `src/${M}/test/*.js`;
} else if (F) {
testFile = F;
}
config.set({
basePath: '',
files: [testFile],
frameworks: ['mocha', 'sinon-chai'],
colors: true,
reporters: ['mocha', 'coverage'],
logLevel: config.LOG_INFO,
preprocessors: {
'test/*.js': ['webpack'],
'src/**/*.js': ['webpack']
},
webpack: webpackConfig,
webpackMiddleware: {
noInfo: true
},
browsers: env.BROWSER ? env.BROWSER.split(',') : ['Chrome'],
customLaunchers: {
ChromeCi: {
base: 'Chrome',
flags: ['--no-sandbox']
},
FirefoxAutoAllowGUM: {
base: 'Firefox',
prefs: {
'media.navigator.permission.disabled': true
}
}
},
coverageReporter: {
dir: 'coverage',
reporters: [
{ type: 'html' },
{ type: 'lcov', subdir: 'lcov' } // lcov
]
}
});
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/JackEasons/rsuite.git
[email protected]:JackEasons/rsuite.git
JackEasons
rsuite
rsuite
master

搜索帮助