Skip to content

Commit ae7c656

Browse files
committed
chore(env): update build and test environment
1 parent fae7b60 commit ae7c656

19 files changed

+2368
-142
lines changed

.circleci/config.yml

+52-14
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,55 @@
1-
version: 2.1
1+
# version: 2.1
22

3-
orbs:
4-
cypress: cypress-io/[email protected]
3+
# orbs:
4+
# cypress: cypress-io/[email protected]
55

6-
workflows:
6+
# workflows:
7+
# build:
8+
# jobs:
9+
# - cypress/install:
10+
# yarn: true
11+
# build: yarn build
12+
# - cypress/run:
13+
# requires:
14+
# - cypress/install
15+
# yarn: true
16+
# start: yarn develop
17+
# wait-on: "--timeout 20000 http://localhost:8000"
18+
19+
# Javascript Node CircleCI 2.0 configuration file
20+
#
21+
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
22+
#
23+
version: 2
24+
jobs:
725
build:
8-
jobs:
9-
- cypress/install:
10-
yarn: true
11-
build: yarn build
12-
- cypress/run:
13-
requires:
14-
- cypress/install
15-
yarn: true
16-
start: yarn develop
17-
wait-on: "--timeout 20000 http://localhost:8000"
26+
docker:
27+
# specify the version you desire here
28+
- image: circleci/node:10.16
29+
30+
# Specify service dependencies here if necessary
31+
# CircleCI maintains a library of pre-built images
32+
# documented at https://circleci.com/docs/2.0/circleci-images/
33+
# - image: circleci/mongo:3.4.4
34+
35+
working_directory: ~/repo
36+
37+
steps:
38+
- checkout
39+
40+
# Download and cache dependencies
41+
- restore_cache:
42+
keys:
43+
- v1-dependencies-{{ checksum "package.json" }}
44+
# fallback to using the latest cache if no exact match is found
45+
- v1-dependencies-
46+
47+
- run: yarn install
48+
49+
- save_cache:
50+
paths:
51+
- node_modules
52+
key: v1-dependencies-{{ checksum "package.json" }}
53+
54+
# run tests!
55+
- run: yarn test

.eslintrc.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
extends: ["airbnb", "prettier", "prettier/react"],
3+
plugins: ["emotion", "prettier"],
4+
env: {
5+
jest: true,
6+
},
7+
parser: "babel-eslint",
8+
rules: {
9+
"react/jsx-filename-extension": "off",
10+
},
11+
}

.eslintrc.json

-8
This file was deleted.

.gitignore

+135-14
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,70 @@
1+
# Project dependencies
2+
.cache
3+
node_modules
4+
yarn-error.log
5+
package-lock.json
6+
7+
# Build directory
8+
/public
9+
.DS_Store
10+
11+
# Created by https://www.gitignore.io/api/node,linux,macos,windows,visualstudiocode
12+
# Edit at https://www.gitignore.io/?templates=node,linux,macos,windows,visualstudiocode
13+
14+
### Linux ###
15+
*~
16+
17+
# temporary files which can be created if a process still has a handle open of a deleted file
18+
.fuse_hidden*
19+
20+
# KDE directory preferences
21+
.directory
22+
23+
# Linux trash folder which might appear on any partition or disk
24+
.Trash-*
25+
26+
# .nfs files are created when an open file is removed but is still being accessed
27+
.nfs*
28+
29+
### macOS ###
30+
# General
31+
.DS_Store
32+
.AppleDouble
33+
.LSOverride
34+
35+
# Icon must end with two \r
36+
Icon
37+
38+
# Thumbnails
39+
._*
40+
41+
# Files that might appear in the root of a volume
42+
.DocumentRevisions-V100
43+
.fseventsd
44+
.Spotlight-V100
45+
.TemporaryItems
46+
.Trashes
47+
.VolumeIcon.icns
48+
.com.apple.timemachine.donotpresent
49+
50+
# Directories potentially created on remote AFP share
51+
.AppleDB
52+
.AppleDesktop
53+
Network Trash Folder
54+
Temporary Items
55+
.apdisk
56+
57+
### Node ###
158
# Logs
259
logs
360
*.log
461
npm-debug.log*
562
yarn-debug.log*
663
yarn-error.log*
64+
lerna-debug.log*
65+
66+
# Diagnostic reports (https://nodejs.org/api/report.html)
67+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
768

869
# Runtime data
970
pids
@@ -16,11 +77,12 @@ lib-cov
1677

1778
# Coverage directory used by tools like istanbul
1879
coverage
80+
*.lcov
1981

2082
# nyc test coverage
2183
.nyc_output
2284

23-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
85+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
2486
.grunt
2587

2688
# Bower dependency directory (https://bower.io/)
@@ -29,16 +91,19 @@ bower_components
2991
# node-waf configuration
3092
.lock-wscript
3193

32-
# Compiled binary addons (http://nodejs.org/api/addons.html)
94+
# Compiled binary addons (https://nodejs.org/api/addons.html)
3395
build/Release
3496

3597
# Dependency directories
3698
node_modules/
3799
jspm_packages/
38100

39-
# Typescript v1 declaration files
101+
# TypeScript v1 declaration files
40102
typings/
41103

104+
# TypeScript cache
105+
*.tsbuildinfo
106+
42107
# Optional npm cache directory
43108
.npm
44109

@@ -51,19 +116,75 @@ typings/
51116
# Output of 'npm pack'
52117
*.tgz
53118

119+
# Yarn Integrity file
120+
.yarn-integrity
121+
54122
# dotenv environment variables file
55123
.env
124+
.env.test
56125

57-
# gatsby files
58-
.cache/
59-
public
126+
# parcel-bundler cache (https://parceljs.org/)
127+
.cache
60128

61-
# Mac files
62-
.DS_Store
129+
# next.js build output
130+
.next
63131

64-
# Yarn
65-
yarn-error.log
66-
.pnp/
67-
.pnp.js
68-
# Yarn Integrity file
69-
.yarn-integrity
132+
# nuxt.js build output
133+
.nuxt
134+
135+
# vuepress build output
136+
.vuepress/dist
137+
138+
# Serverless directories
139+
.serverless/
140+
141+
# FuseBox cache
142+
.fusebox/
143+
144+
# DynamoDB Local files
145+
.dynamodb/
146+
147+
### VisualStudioCode ###
148+
.vscode/*
149+
!.vscode/settings.json
150+
!.vscode/tasks.json
151+
!.vscode/launch.json
152+
!.vscode/extensions.json
153+
154+
### VisualStudioCode Patch ###
155+
# Ignore all local history of files
156+
.history
157+
158+
### Windows ###
159+
# Windows thumbnail cache files
160+
Thumbs.db
161+
Thumbs.db:encryptable
162+
ehthumbs.db
163+
ehthumbs_vista.db
164+
165+
# Dump file
166+
*.stackdump
167+
168+
# Folder config file
169+
[Dd]esktop.ini
170+
171+
# Recycle Bin used on file shares
172+
$RECYCLE.BIN/
173+
174+
# Windows Installer files
175+
*.cab
176+
*.msi
177+
*.msix
178+
*.msm
179+
*.msp
180+
181+
# Windows shortcuts
182+
*.lnk
183+
184+
# Gatsby
185+
public
186+
.cache
187+
**/public
188+
**/cache
189+
190+
# End of https://www.gitignore.io/api/node,linux,macos,windows,visualstudiocode

.prettierrc

-7
This file was deleted.

__mocks__/file-mock.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = "test-file-stub"

__mocks__/gatsby.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const React = require("react")
2+
3+
const gatsby = jest.requireActual("gatsby")
4+
5+
module.exports = {
6+
...gatsby,
7+
graphql: jest.fn(),
8+
Link: jest.fn().mockImplementation(
9+
// these props are invalid for an `a` tag
10+
({
11+
activeClassName,
12+
activeStyle,
13+
getProps,
14+
innerRef,
15+
partiallyActive,
16+
ref,
17+
replace,
18+
to,
19+
...rest
20+
}) =>
21+
React.createElement("a", {
22+
...rest,
23+
href: to,
24+
})
25+
),
26+
StaticQuery: jest.fn(),
27+
useStaticQuery: jest.fn(),
28+
}

commitlint.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ["@commitlint/config-conventional"],
3+
}

cypress/videos/default.test.js.mp4

-83 KB
Binary file not shown.

husky.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module.exports = {
22
hooks: {
3-
"pre-commit": "yarn lint",
3+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
4+
"pre-commit": "lint-staged",
45
},
56
}

jest-dom.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/* eslint-disable import/no-extraneous-dependencies */
2+
import "@testing-library/jest-dom/extend-expect"

jest-preprocess.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/* eslint-disable import/no-extraneous-dependencies */
2+
const babelOptions = {
3+
presets: ["babel-preset-gatsby"],
4+
}
5+
6+
module.exports = require("babel-jest").createTransformer(babelOptions)

jest.config.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module.exports = {
2+
transform: {
3+
"^.+\\.jsx?$": `<rootDir>/jest-preprocess.js`,
4+
},
5+
moduleNameMapper: {
6+
".+\\.(css|styl|less|sass|scss)$": `identity-obj-proxy`,
7+
".+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": `<rootDir>/__mocks__/file-mock.js`,
8+
},
9+
testPathIgnorePatterns: [
10+
`node_modules`,
11+
`.cache`,
12+
`public`,
13+
`<rootDir>/cypress`,
14+
],
15+
transformIgnorePatterns: [`node_modules/(?!(gatsby)/)`],
16+
globals: {
17+
__PATH_PREFIX__: ``,
18+
},
19+
testURL: `http://localhost`,
20+
setupFiles: [`<rootDir>/loadershim.js`],
21+
setupFilesAfterEnv: [`<rootDir>/jest-dom.js`],
22+
}

loadershim.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/* eslint-disable no-underscore-dangle */
2+
global.___loader = {
3+
enqueue: jest.fn(),
4+
}

0 commit comments

Comments
 (0)