Skip to content

Commit

Permalink
chore: Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
finom committed Jan 18, 2020
1 parent 1d2aa4b commit 6b0d0e4
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 17 deletions.
8 changes: 0 additions & 8 deletions babel.config.js

This file was deleted.

3 changes: 1 addition & 2 deletions packages/parse-form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"main": "index.js",
"scripts": {
"test": "npm run cover",
"unit": "babel-node node_modules/.bin/babel-istanbul cover test/index.js && cat ./coverage/lcov.info",
"unit": "babel-node test/index.js",
"cover": "../../node_modules/.bin/babel-node ../../node_modules/.bin/babel-istanbul cover test/index.js",
"compile-npm": "babel src.js --out-file index.js",
"build": "../../node_modules/.bin/webpack --mode=production",
"prepublish": "npm run compile-npm"
Expand Down
8 changes: 5 additions & 3 deletions packages/parse-form/src.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import $ from 'balajs';
import {select, bindNode} from 'seemple';
const $ = require( 'balajs');
const {select, bindNode} = require( 'seemple');

export default function parseForm(object, selector, callback, eventOptions) {
function parseForm(object, selector, callback, eventOptions) {
const form = /:sandbox|:bound/.test(selector) ? select(object, selector) : $.one(selector);
const fields = $('input, textarea, output, progress, select', form);

Expand Down Expand Up @@ -30,3 +30,5 @@ export default function parseForm(object, selector, callback, eventOptions) {
if (typeof Seemple === 'function') {
Seemple.parseForm = parseForm;
}

module.exports = parseForm;
11 changes: 10 additions & 1 deletion packages/parse-form/test/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const Jasmine = require('jasmine');
const { JSDOM } = require('jsdom');

const { SpecReporter } = require('jasmine-spec-reporter');
const { addAlias } = require('module-alias');
const path = require('path');
const { execSync } = require('child_process')
const jasmine = new Jasmine();

global.window = new JSDOM('<!doctype html><html><body></body></html>', {
Expand All @@ -9,11 +12,17 @@ global.window = new JSDOM('<!doctype html><html><body></body></html>', {

global.document = global.window.document;

execSync('npm run npm-compile', {
cwd: path.resolve(__dirname, '../../seemple')
})

jasmine.loadConfig({
spec_dir: 'test/spec',
spec_files: [
'**/**_spec.js'
]
});

addAlias('seemple', path.resolve(__dirname, '../../seemple/npm'))

jasmine.execute();
2 changes: 1 addition & 1 deletion packages/router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index",
"scripts": {
"test": "npm run unit",
"unit": "../../node_modules/.bin/babel-node ../../node_modules/.bin/babel-istanbul cover test/index.js && cat ./coverage/lcov.info",
"unit": "../../node_modules/.bin/babel-node ../../node_modules/.bin/babel-istanbul cover test/index.js",
"lint": "eslint ./test ./src",
"npm-compile": "babel src -d .",
"build": "../../node_modules/.bin/webpack --mode=production"
Expand Down
7 changes: 5 additions & 2 deletions packages/router/src/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* globals Seemple */

import Router from './router';
const Router = require( './router').default;

export default function initRouter(obj, route, type) {
function initRouter(obj, route, type) {
Router[type || 'hash'].subscribe(obj, route);
return obj;
}
Expand All @@ -12,3 +12,6 @@ if (typeof Seemple === 'function') {
Seemple.Router = Router;
Seemple.initRouter = initRouter;
}


module.exports = initRouter

0 comments on commit 6b0d0e4

Please sign in to comment.