Skip to content

Commit d0af123

Browse files
Divyendu Singhtimsuchanek
authored andcommitted
[WIP] Feature tests (#750)
* base test * fix: setupEnzyme.ts path * remove dep on ts-jest * bump snap * bump snap + remove @types deps * updated package.json * borrow yarn.lock * working * fix base tests * add test with tabs * test setup * remove lints * recover localDevIndex from master
1 parent 62ecfdb commit d0af123

File tree

8 files changed

+929
-9
lines changed

8 files changed

+929
-9
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module.exports = {
2+
roots: ['<rootDir>/src'],
3+
transform: {
4+
'^.+\\.css$': '<rootDir>/config/jest/cssTransform.js',
5+
'^.+\\.tsx?$': '<rootDir>/config/jest/typescriptTransform.js',
6+
'^(?!.*\\.(css|json)$)': '<rootDir>/config/jest/fileTransform.js',
7+
},
8+
transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$'],
9+
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
10+
testPathIgnorePatterns: ['<rootDir>[/\\\\](build|docs|node_modules)[/\\\\]'],
11+
testEnvironment: 'jsdom',
12+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
13+
snapshotSerializers: ['enzyme-to-json/serializer'],
14+
setupTestFrameworkScriptFile: '<rootDir>/src/setupEnzyme.ts',
15+
globals: {
16+
'ts-jest': {
17+
tsConfigFile: 'tsconfig.jest.json',
18+
},
19+
},
20+
setupFiles: ['<rootDir>/config/polyfills.js', 'jest-localstorage-mock'],
21+
}

packages/graphql-playground-react/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"tsc": "tsc -p tsconfig.build.json",
2323
"build-package": "rimraf lib build/dist && npm run tsc && babel lib -d lib && cp -r ./src/assets/ ./lib/assets/ && cd lib && rimraf *.jsx;",
2424
"build-app": "node scripts/build.js",
25-
"test": "bundlesize",
25+
"test": "jest",
26+
"bundlesize": "bundlesize",
2627
"bump": "npm version patch --no-git-tag-version && git add package.json",
2728
"graphql-faker": "graphql-faker ./tests/schema.faker.graphql",
2829
"lint": "tslint \"src/**/*.ts{,x}\"",
@@ -63,6 +64,9 @@
6364
"css-loader": "0.28.11",
6465
"detect-port": "1.2.3",
6566
"dotenv": "5.0.1",
67+
"enzyme": "^3.3.0",
68+
"enzyme-adapter-react-16": "^1.1.1",
69+
"enzyme-to-json": "^3.3.4",
6670
"extract-text-webpack-plugin": "3.0.2",
6771
"file-loader": "1.1.11",
6872
"filesize": "3.6.1",
@@ -73,6 +77,7 @@
7377
"http-proxy-middleware": "0.17.4",
7478
"husky": "0.14.3",
7579
"jest": "22.1.4",
80+
"jest-localstorage-mock": "^2.2.0",
7681
"json-loader": "0.5.7",
7782
"lint-staged": "6.1.0",
7883
"node-noop": "1.0.0",

0 commit comments

Comments
 (0)