Skip to content

Commit

Permalink
fix(SFINT-2577): Add karma-webpack-die-hard (#42)
Browse files Browse the repository at this point in the history
* fix(SFINT-2577): Add karma-webpack-die-hard

* fix(SFINT-2577): Remove unused imports in some test files
  • Loading branch information
louis-bompart committed Oct 3, 2019
1 parent c85224e commit 73d9b8c
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 5 deletions.
10 changes: 9 additions & 1 deletion config/webpack.config.karma.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const webpackConfig = require('./webpack.config.js');
const path = require('path');
const WebpackKarmaDieHardPlugin = require('webpack-karma-die-hard');

const webpackConfig = require('./webpack.config.js');
// These modifications are required to have proper coverage with karma-coverage-istanbul-reporter.
webpackConfig.devtool = 'inline-source-map';
webpackConfig.module.rules = [
Expand Down Expand Up @@ -44,4 +45,11 @@ webpackConfig.externals.push({
'coveo-search-ui-tests': 'CoveoJsSearchTests'
});

/**
* Plugin for Webpack to ensure errors cause it to quit with a non-zero exit code
* when used as a Karma preprocessor with the karma-webpack plugin.
* This works around known issues in karma-webpack: https://github.com/webpack-contrib/karma-webpack/issues/66
*/
webpackConfig.plugins.push(new WebpackKarmaDieHardPlugin());

module.exports = webpackConfig;
51 changes: 51 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
"typescript": "^3.3.0",
"webpack": "^4.29.6",
"webpack-cli": "^3.2.3",
"webpack-dev-server": "^3.2.1"
"webpack-dev-server": "^3.2.1",
"webpack-karma-die-hard": "^1.0.4"
},
"dependencies": {
"snyk": "^1.203.0"
Expand Down
1 change: 0 additions & 1 deletion tests/components/ResultsFilter/ResultsFilter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ResultsFilter, IResultsFilterOptions } from '../../../src/components/Re
import { Mock, Simulate } from 'coveo-search-ui-tests';
import { QueryStateModel } from 'coveo-search-ui';
import { ResultsFilterEvents, IResultsFilterEventArgs } from '../../../src/components/ResultsFilter/Events';
import { Translation, Language } from '../../../src/utils/translation';

describe('ResultsFilter', () => {
let filter: Mock.IBasicComponentSetup<ResultsFilter>;
Expand Down
4 changes: 2 additions & 2 deletions tests/components/ViewedByCustomer/ViewedByCustomer.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ViewedByCustomer } from '../../../src/Index';
import { Mock, Fake } from 'coveo-search-ui-tests';
import { IViewedByCustomerOptions } from '../../../src/components/ViewedByCustomer/ViewedByCustomer';
import { IQueryResult, Component } from 'coveo-search-ui';
import { AdvancedComponentSetupOptions, MockEnvironmentBuilder } from 'coveo-search-ui-tests/MockEnvironment';
import { IQueryResult } from 'coveo-search-ui';
import { AdvancedComponentSetupOptions } from 'coveo-search-ui-tests/MockEnvironment';
import { createSandbox, SinonSandbox } from 'sinon';

describe('ViewedByCustomer', () => {
Expand Down

0 comments on commit 73d9b8c

Please sign in to comment.