Skip to content

Commit

Permalink
Add tests for web pack hot loader
Browse files Browse the repository at this point in the history
  • Loading branch information
artfuldev committed Jun 12, 2017
1 parent 984312d commit ea6be53
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions tests/ts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test('preset development has given entry if available', t => {
const api = Neutrino(options);
api.use(require('..'));
const config = api.config.toConfig();
t.is(config.entry.index[0], join(api.options.source, 'index.xyz'));
t.true(config.entry.index.indexOf(join(api.options.source, 'index.xyz')) !== -1);
});

test('preset production has given entry if available', t => {
Expand All @@ -47,15 +47,31 @@ test('preset production has given entry if available', t => {
const api = Neutrino(options);
api.use(require('..'));
const config = api.config.toConfig();
t.is(config.entry.index[0], join(api.options.source, 'index.xyz'));
t.true(config.entry.index.indexOf(join(api.options.source, 'index.xyz')) !== -1);
});

test('preset development entry defaults to index.ts', t => {
process.env.NODE_ENV = 'development';
const api = Neutrino();
api.use(require('..'));
const config = api.config.toConfig();
t.is(config.entry.index[0], join(api.options.source, 'index.ts'));
t.is(config.entry.index[2], join(api.options.source, 'index.ts'));
});

test('preset development entry starts with webpack-dev-server', t => {
process.env.NODE_ENV = 'development';
const api = Neutrino();
api.use(require('..'));
const config = api.config.toConfig();
t.true(config.entry.index[0].indexOf(`webpack-dev-server/client?`) === 0);
});

test('preset development entry index has webpack/hot/dev-server', t => {
process.env.NODE_ENV = 'development';
const api = Neutrino();
api.use(require('..'));
const config = api.config.toConfig();
t.is(config.entry.index[1], `webpack/hot/dev-server`);
});

test('preset production entry defaults to index.ts', t => {
Expand Down

0 comments on commit ea6be53

Please sign in to comment.