Skip to content

Commit

Permalink
Updated test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
kroeder committed Sep 4, 2018
1 parent b7a103b commit 5801057
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
13 changes: 8 additions & 5 deletions app/angular/src/server/ts_config.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import loadTsConfig from './ts_config';
import getTsLoaderOptions from './ts_config';

// eslint-disable-next-line global-require
jest.mock('fs', () => require('../../../../__mocks__/fs'));
Expand All @@ -15,18 +15,21 @@ describe('ts_config', () => {
it('should return the config with the path to the tsconfig.json', () => {
setupFiles({ 'tsconfig.json': '{}' });

const config = loadTsConfig('.foo');
const config = getTsLoaderOptions('.foo');

expect(config).toEqual({
transpileOnly: true,
configFile: 'tsconfig.json',
});
});

it('should return empty object when there is no tsconfig.json', () => {
it('should return object with transpileOnly: true when there is no tsconfig.json', () => {
setupFiles({});

const config = loadTsConfig('.foo');
const config = getTsLoaderOptions('.foo');

expect(config).toEqual({});
expect(config).toEqual({
transpileOnly: true,
});
});
});
4 changes: 2 additions & 2 deletions app/angular/src/server/wrapInitialConfig.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import path from 'path';
import { ContextReplacementPlugin } from 'webpack';
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import loadTsLoaderOptions from './ts_config';
import getTsLoaderOptions from './ts_config';

export default (config, configDir) => {
const tsLoaderOptions = loadTsLoaderOptions(configDir);
const tsLoaderOptions = getTsLoaderOptions(configDir);
return {
...config,
module: {
Expand Down

0 comments on commit 5801057

Please sign in to comment.