1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-01-16 20:08:15 +01:00

refactor tests and babel config. Fixes target browsers.

This is basically the change propagated from the current
default preact tempalate. Now the code compiles according to set
browsers.
This commit is contained in:
Kushagra Gour 2018-10-21 19:18:53 +05:30
parent ebffdb5ecb
commit 37d8e9801a
6 changed files with 18 additions and 11 deletions

View File

@ -1,5 +1,9 @@
{
"presets": [
"env": {
"test": {
"presets": [
["preact-cli/babel", { "modules": "commonjs" }]
]
]
}
}
}

View File

@ -8,7 +8,7 @@
"serve": "preact build && preact serve",
"dev": "preact watch --template src/index.html --https --no-prerender",
"lint": "eslint src",
"test": "jest ./tests",
"test": "jest",
"precommit": "lint-staged"
},
"eslintConfig": {
@ -53,8 +53,6 @@
},
"dependencies": {
"@emmetio/codemirror-plugin": "^0.5.4",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"code-blast-codemirror": "chinchang/code-blast-codemirror#web-maker",
"codemirror": "^5.37.0",
"copy-webpack-plugin": "^4.5.1",
@ -72,7 +70,12 @@
"jest": {
"verbose": true,
"setupFiles": [
"<rootDir>/src/tests/__mocks__/browserMocks.js"
"<rootDir>/tests/__mocks__/browserMocks.js"
],
"testRegex": "(/(__tests__|tests)/.*|(\\.|/)(test|spec))\\.jsx?$",
"testPathIgnorePatterns": [
"/node_modules/",
"<rootDir>/tests/__mocks__/*"
],
"testURL": "http://localhost:8080",
"moduleFileExtensions": [
@ -83,7 +86,7 @@
"node_modules"
],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/tests/__mocks__/fileMock.js",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/tests/__mocks__/fileMock.js",
"\\.(css|less|scss)$": "identity-obj-proxy",
"^./style$": "identity-obj-proxy",
"^preact$": "<rootDir>/node_modules/preact/dist/preact.min.js",

View File

@ -1,3 +1,3 @@
// This fixed an error related to the CSS and loading gif breaking my Jest test
// See https://facebook.github.io/jest/docs/en/webpack.html#handling-static-assets
module.exports = 'test-file-stub';
// See https://facebook.github.io/jest/docs/en/webpack.html#handling-static-assets
module.exports = 'test-file-stub';

View File

@ -6,7 +6,7 @@ import {
removeFileAtPath,
getParentPath,
getExtensionFromFileName
} from '../fileUtils';
} from '../src/fileUtils';
function getNestedFiles() {
return [

View File

@ -1,5 +1,5 @@
import { h, Component } from 'preact';
import Footer from '../components/Footer';
import Footer from '../src/components/Footer';
import { Link } from 'preact-router/match';
// See: https://github.com/mzgoddard/preact-render-spy
import { shallow, deep } from 'preact-render-spy';