Move spec out of src

release
Etienne Lemay 2017-11-08 22:41:57 -08:00
parent cecb92bb9f
commit 56be88ed41
7 changed files with 25 additions and 35 deletions

4
.gitignore vendored
View File

@ -2,4 +2,6 @@ node_modules/
dist/
dist-es/
bundle.js
/src/data/data.js
stats.json
report.html
/src/data/data.js

View File

@ -3,6 +3,7 @@ scripts/
.*
src/
spec/
example/
karma.conf.js
yarn.lock

View File

@ -1,6 +1,6 @@
// Karma configuration
// Generated on Fri Jan 27 2017 13:33:03 GMT-0700 (MST)
var webpackConfig = require('./src/webpack.config.js');
var webpackConfig = require('./spec/webpack.config.js');
module.exports = function(config) {
config.set({
@ -16,7 +16,7 @@ module.exports = function(config) {
// list of files / patterns to load in the browser
files: [
'src/**/*Spec.js',
'spec/*spec.js',
],
@ -28,7 +28,7 @@ module.exports = function(config) {
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'src/**/*Spec.js': ['webpack'],
'spec/*spec.js': ['webpack'],
},

View File

@ -64,12 +64,12 @@
"clean": "rm -rf dist/ dist-es/ src/data/data.js",
"build:data": "node scripts/build-data",
"build:dist": "npm run build:cjs && npm run build:es",
"build:cjs": "BABEL_ENV=cjs babel src --out-dir dist --copy-files --ignore webpack.config.js",
"build:es": "babel src --out-dir dist-es --copy-files --ignore webpack.config.js",
"build:cjs": "BABEL_ENV=cjs babel src --out-dir dist --copy-files",
"build:es": "babel src --out-dir dist-es --copy-files",
"build": "npm run clean && npm run build:data && npm run build:dist",
"watch": "BABEL_ENV=cjs babel src --watch --out-dir dist --copy-files --ignore webpack.config.js",
"watch": "BABEL_ENV=cjs babel src --watch --out-dir dist --copy-files",
"start": "npm run watch",
"stats": "webpack --config ./src/webpack.config.js --json > stats.json",
"stats": "webpack --config ./spec/webpack.config.js --json > spec/stats.json",
"react:clean": "rimraf node_modules/{react,react-dom,react-addons-test-utils}",
"react:14": "npm run react:clean && npm i react@^0.14 react-dom@^0.14 react-addons-test-utils@^0.14 --save-dev",
"react:15": "npm run react:clean && npm i react@^15 react-dom@^15 react-addons-test-utils@^15 --save-dev",
@ -77,7 +77,7 @@
"prepublish": "npm run build",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook",
"prettier": "prettier --no-semi --single-quote --trailing-comma es5 --write \"src/**/*.js\""
"prettier": "prettier --no-semi --single-quote --trailing-comma es5 --write \"{src,spec}/**/*.js\""
},
"size-limit": [
{

View File

@ -1,4 +1,4 @@
import emojiIndex from './emoji-index'
import emojiIndex from '../src/utils/emoji-index'
describe('#emojiIndex', () => {
describe('search', function() {
@ -17,7 +17,9 @@ describe('#emojiIndex', () => {
})
it('should filter only emojis we care about, exclude pineapple', () => {
let emojisToShowFilter = (data) => { data.unified !== '1F34D' }
let emojisToShowFilter = data => {
data.unified !== '1F34D'
}
expect(
emojiIndex.search('apple', { emojisToShowFilter }).map(obj => obj.id)
).not.toContain('pineapple')

View File

@ -1,6 +1,6 @@
import React from 'react'
import TestUtils from 'react-dom/test-utils'
import Picker from './picker'
import Picker from '../src/components/picker'
const { click } = TestUtils.Simulate
@ -10,6 +10,11 @@ const {
findRenderedComponentWithType,
} = TestUtils
const render = (props = {}) => {
const defaultProps = {}
return renderIntoDocument(<Picker {...defaultProps} {...props} />)
}
describe('Picker', () => {
let subject
@ -29,9 +34,4 @@ describe('Picker', () => {
expect(subject.categories.length).toEqual(2)
})
})
function render(props = {}) {
const defaultProps = {}
return renderIntoDocument(<Picker {...defaultProps} {...props} />)
}
})

View File

@ -10,8 +10,8 @@ var TEST = process.env.NODE_ENV === 'test'
var config = {
entry: path.resolve('src/index.js'),
output: {
path: path.resolve('dist'),
filename: 'emoji-mart.js',
path: path.resolve('spec'),
filename: 'bundle.js',
library: 'EmojiMart',
libraryTarget: 'umd',
},
@ -23,22 +23,7 @@ var config = {
{
test: /\.js$/,
use: 'babel-loader',
include: [path.resolve('src'), path.resolve('data')],
},
{
test: /\.svg$/,
use: [
{
loader: 'babel-loader',
},
{
loader: 'svg-jsx-loader',
options: {
es6: true,
},
},
],
include: [path.resolve('src/svgs')],
include: [path.resolve('src'), path.resolve('spec')],
},
],
},