Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoiver committed Apr 10, 2018
2 parents a9a7fd0 + 752f3c1 commit 85090b3
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 341 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"ava": {
"serial": false,
"failFast": true,
"concurrency": 10,
"concurrency": 5,
"files": [
"packages/lavas-core-vue/test/unit/**/*.test.js",
"packages/lavas-core-vue/test/integration/*.js"
Expand Down Expand Up @@ -123,7 +123,7 @@
"webpack-hot-middleware": "^2.19.0",
"webpack-merge": "^4.1.0",
"webpack-node-externals": "^1.6.0",
"workbox-webpack-plugin": "3.0.0-alpha.6"
"workbox-webpack-plugin": "^3.0.1"
},
"devDependencies": {
"ava": "^0.18.2",
Expand Down
33 changes: 29 additions & 4 deletions packages/tb-lavas-core/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "tb-lavas-core",
"version": "1.0.0",
"version": "2.0.0",
"description": "Lavas core implemented by Vue",
"main": "dist/index.js",
"files": [
"dist"
],
"scripts": {
"prepublish": "babel core --out-dir dist --copy-files"
"test": "ava --verbose",
"prepublish": "npm run test && babel core --out-dir dist --copy-files"
},
"repository": {
"type": "git",
Expand All @@ -29,6 +30,22 @@
"last 2 versions",
"not ie <= 8"
],
"ava": {
"serial": false,
"failFast": true,
"concurrency": 10,
"files": [
"test/unit/**/*.test.js",
"test/integration/*.js"
],
"backupFiles": [
"test/unit/**/*.test.js",
"test/integration/*.js"
],
"require": [
"babel-register"
]
},
"dependencies": {
"babel-loader": "^7.1.1",
"babel-runtime": "^6.26.0",
Expand Down Expand Up @@ -74,7 +91,7 @@
"vue-meta": "^1.0.5",
"vue-router": "^2.7.0",
"vue-server-renderer": "^2.5.2",
"vue-skeleton-webpack-plugin": "^1.1.10",
"vue-skeleton-webpack-plugin": "^1.1.11",
"vue-template-compiler": "^2.5.2",
"vuex": "^2.3.1",
"webpack": "^3.6.0",
Expand All @@ -83,7 +100,15 @@
"webpack-hot-middleware": "^2.19.0",
"webpack-merge": "^4.1.0",
"webpack-node-externals": "^1.6.0",
"workbox-webpack-plugin": "3.0.0-alpha.6"
"workbox-webpack-plugin": "^3.0.1"
},
"devDependencies": {
"ava": "^0.18.2",
"babel-register": "^6.23.0",
"fs-extra": "^4.0.1",
"koa": "^2.3.0",
"nyc": "^10.3.2",
"superkoa": "^1.0.3"
},
"peerDependencies": {
"webpack": "^3.0.0"
Expand Down
26 changes: 2 additions & 24 deletions packages/tb-lavas-core/test/integration/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,8 @@
*/

import {join} from 'path';
import test from 'ava';
import {readFile, writeFile, copy, remove} from 'fs-extra';
import LavasCore from '../../core';
import {syncConfig, isKoaSupport, request, createApp, makeTempDir} from '../utils';

test.beforeEach('init lavas-core & server', async t => {
// copy fixture to temp dir
let tempDir = await makeTempDir();
await copy(join(__dirname, '../fixtures/simple'), tempDir);

t.context.tempDir = tempDir;
t.context.core = new LavasCore(tempDir);
t.context.app = createApp();
});

test.afterEach.always('clean', async t => {
let {core, server, tempDir} = t.context;

await core.close();
server && server.close();

// clean temp dir
await remove(tempDir);
});
import {readFile, writeFile} from 'fs-extra';
import {syncConfig, isKoaSupport, request, createApp, makeTempDir, test} from '../utils';

test('it should show 404 page correctly.', async t => {
let {core, app} = t.context;
Expand Down
26 changes: 2 additions & 24 deletions packages/tb-lavas-core/test/integration/spa.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,9 @@
*/

import {join} from 'path';
import test from 'ava';
import {readFile, writeFile, copy, remove} from 'fs-extra';
import LavasCore from '../../core';
import {readFile, writeFile} from 'fs-extra';

import {syncConfig, isKoaSupport, request, createApp, makeTempDir} from '../utils';

test.beforeEach('init lavas-core & server', async t => {
// copy fixture to temp dir
let tempDir = await makeTempDir();
await copy(join(__dirname, '../fixtures/simple'), tempDir);

t.context.tempDir = tempDir;
t.context.core = new LavasCore(tempDir);
t.context.app = createApp();
});

test.afterEach.always('clean', async t => {
let {core, server, tempDir} = t.context;

await core.close();
server && server.close();

// clean temp dir
await remove(tempDir);
});
import {syncConfig, isKoaSupport, request, createApp, makeTempDir, test} from '../utils';

test('it should run in development mode correctly', async t => {
let {core, app} = t.context;
Expand Down
98 changes: 0 additions & 98 deletions packages/tb-lavas-core/test/integration/ssr.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,9 @@
/* eslint-disable fecs-use-standard-promise */

import {join} from 'path';
import test from 'ava';
import {copy, remove} from 'fs-extra';
import LavasCore from '../../../core';

import {syncConfig, makeTempDir} from '../../utils';
import {syncConfig, makeTempDir, test} from '../../utils';

test.beforeEach('init lavas-core & server', async t => {
// copy fixture to temp dir
let tempDir = await makeTempDir();
await copy(join(__dirname, '../../fixtures/simple'), tempDir);

t.context.tempDir = tempDir;
t.context.core = new LavasCore(tempDir);
});

test.afterEach.always('clean', async t => {
let {core, tempDir} = t.context;
await core.close();
// clean temp dir
await remove(tempDir);
});

test('it should use another config when user has explictly set', async t => {
let {core, tempDir} = t.context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,10 @@
/* eslint-disable fecs-use-standard-promise */

import {join} from 'path';
import test from 'ava';
import {copy, remove, rename} from 'fs-extra';
import LavasCore from '../../../core';
import {rename} from 'fs-extra';

import {syncConfig, makeTempDir} from '../../utils';
import {syncConfig, makeTempDir, test} from '../../utils';

test.beforeEach('init lavas-core & server', async t => {
// copy fixture to temp dir
let tempDir = await makeTempDir();
await copy(join(__dirname, '../../fixtures/simple'), tempDir);

t.context.tempDir = tempDir;
t.context.core = new LavasCore(tempDir);
});

test.afterEach.always('clean', async t => {
let {core, tempDir} = t.context;

await core.close();
// clean temp dir
await remove(tempDir);
});

test('it should read from config directory when lavas.config.js does not exist', async t => {
let {core, tempDir} = t.context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,8 @@

import merge from 'webpack-merge';
import {join} from 'path';
import test from 'ava';
import {copy, remove} from 'fs-extra';
import LavasCore from '../../../core';
import {syncConfig, makeTempDir} from '../../utils';
import {syncConfig, makeTempDir, test} from '../../utils';

test.beforeEach('init lavas-core & server', async t => {
// copy fixture to temp dir
let tempDir = await makeTempDir();
await copy(join(__dirname, '../../fixtures/simple'), tempDir);

t.context.tempDir = tempDir;
t.context.core = new LavasCore(tempDir);
});

test.afterEach.always('clean', async t => {
let {core, tempDir} = t.context;

await core.close();
// clean temp dir
await remove(tempDir);
});

test('it should merge middlewares defined in lavas.config.js and defaults correctly', async t => {
let core = t.context.core;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,8 @@
/* eslint-disable fecs-use-standard-promise */

import {join} from 'path';
import test from 'ava';
import {copy, remove} from 'fs-extra';
import LavasCore from '../../../core';

import {syncConfig, makeTempDir} from '../../utils';

test.beforeEach('init lavas-core & server', async t => {
// copy fixture to temp dir
let tempDir = await makeTempDir();
await copy(join(__dirname, '../../fixtures/simple'), tempDir);

t.context.tempDir = tempDir;
t.context.core = new LavasCore(tempDir);
});

test.afterEach.always('clean', async t => {
let {core, tempDir} = t.context;

await core.close();
// clean temp dir
await remove(tempDir);
});
import {syncConfig, makeTempDir, test} from '../../utils';

test('it should read from config.json after building', async t => {
let {core, tempDir} = t.context;
Expand Down
Loading

0 comments on commit 85090b3

Please sign in to comment.