Skip to content
This repository has been archived by the owner on Oct 6, 2019. It is now read-only.

Commit

Permalink
Fix: karma test
Browse files Browse the repository at this point in the history
  • Loading branch information
Bacra committed Oct 1, 2018
1 parent 2669556 commit cf6e983
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 40 deletions.
4 changes: 2 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ module.exports = function(config)
config.set(
{
basePath: 'test/',
files: ['test_*.js'],
preprocessors: {'test_*.js': ['browserify']},
files: ['test_browser_*.js'],
preprocessors: {'test_browser_*.js': ['browserify']},
browserify:
{
debug: true,
Expand Down
39 changes: 1 addition & 38 deletions test/test_base.js → test/check_result.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,7 @@ var testReq = require('../');

testReq.ROOT_PATH = __dirname;

describe('#base', function()
{
it('#require', function()
{
var requireAfterWrite = testReq('base');
expect(requireAfterWrite('base.json')).to.eql({data: 1});
});

describe('#check result', function()
{
beforeEach(function()
{
testReq.BUILD = false;
});
afterEach(function()
{
testReq.BUILD = false;
});

checkResult('base');
});

describe('#build', function()
{
beforeEach(function()
{
testReq.BUILD = true;
});
afterEach(function()
{
testReq.BUILD = false;
});

checkResult('tmp');
});
});


module.exports = checkResult;
function checkResult(type)
{
var requireAfterWrite = testReq(type);
Expand Down
29 changes: 29 additions & 0 deletions test/test_browser_base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict';

var expect = require('expect.js');
var testReq = require('../');
var checkResult = require('./check_result');
testReq.ROOT_PATH = __dirname;

describe('#base', function()
{
it('#require', function()
{
var requireAfterWrite = testReq('base');
expect(requireAfterWrite('base.json')).to.eql({data: 1});
});

describe('#check', function()
{
beforeEach(function()
{
testReq.BUILD = false;
});
afterEach(function()
{
testReq.BUILD = false;
});

checkResult('base');
});
});
19 changes: 19 additions & 0 deletions test/test_build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

var testReq = require('../');
var checkResult = require('./check_result');
testReq.ROOT_PATH = __dirname;

describe('#build', function()
{
beforeEach(function()
{
testReq.BUILD = true;
});
afterEach(function()
{
testReq.BUILD = false;
});

checkResult('tmp');
});

0 comments on commit cf6e983

Please sign in to comment.