From b3cf41402bf65bfee1b7cab468a84b4719e121e9 Mon Sep 17 00:00:00 2001 From: abbr Date: Fri, 6 Oct 2017 12:22:17 -0700 Subject: [PATCH] #9, misc test framework enhancements. --- karma.conf.js | 21 +++--- package-lock.json | 137 +++++++++++++++++++++++++++++++++++- package.json | 1 + showprepper.sublime-project | 119 ++++++++++++++++--------------- test/components/AppTest.js | 1 + 5 files changed, 207 insertions(+), 72 deletions(-) diff --git a/karma.conf.js b/karma.conf.js index e426d23..d9a4563 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,14 +1,15 @@ -const webpackCfg = require('./webpack.config') -const ChromiumRevision = require('puppeteer/package.json').puppeteer - .chromium_revision -const Downloader = require('puppeteer/utils/ChromiumDownloader') -const revisionInfo = Downloader.revisionInfo( - Downloader.currentPlatform(), - ChromiumRevision -) - -process.env.CHROME_BIN = revisionInfo.executablePath +if (process.argv.indexOf('--browsers') < 0) { + const ChromiumRevision = require('puppeteer/package.json').puppeteer + .chromium_revision + const Downloader = require('puppeteer/utils/ChromiumDownloader') + const revisionInfo = Downloader.revisionInfo( + Downloader.currentPlatform(), + ChromiumRevision + ) + process.env.CHROME_BIN = revisionInfo.executablePath +} +const webpackCfg = require('./webpack.config') module.exports = function(config) { config.set({ basePath: '', diff --git a/package-lock.json b/package-lock.json index 078ccd8..6be0db1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1149,6 +1149,26 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true }, + "cheerio": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.22.0.tgz", + "integrity": "sha1-qbqoYKP5tZWmuBsahocxIe06Jp4=", + "dev": true, + "dependencies": { + "domhandler": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.1.tgz", + "integrity": "sha1-iS5HAAqZvlW783dP/qBWHYh5wlk=", + "dev": true + }, + "htmlparser2": { + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.9.2.tgz", + "integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=", + "dev": true + } + } + }, "chokidar": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", @@ -1901,6 +1921,12 @@ "integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=", "dev": true }, + "enzyme": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/enzyme/-/enzyme-2.9.1.tgz", + "integrity": "sha1-B9XOaRJBJA+4F78sSxjW5TAkDfY=", + "dev": true + }, "errno": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.4.tgz", @@ -3409,6 +3435,12 @@ "integrity": "sha1-FhdnFMgBeY5Ojyz391KUZ7tKV3E=", "dev": true }, + "function.prototype.name": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.0.3.tgz", + "integrity": "sha512-5EblxZUdioXi2JiMZ9FUbwYj40eQ9MFHyzFLBSPdlRl3SO8l7SLWuAnQ/at/1Wi4hjJwME/C5WpF2ZfAc8nGNw==", + "dev": true + }, "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", @@ -4073,6 +4105,12 @@ "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, + "is-subset": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-subset/-/is-subset-0.1.1.tgz", + "integrity": "sha1-ilkRfZMt4d4A8kX83TnOQ/HpOaY=", + "dev": true + }, "is-svg": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-svg/-/is-svg-2.1.0.tgz", @@ -4544,6 +4582,18 @@ "integrity": "sha1-+6HEUkwZ7ppfgTa0YJ8BfPTe1pI=", "dev": true }, + "lodash.assignin": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.assignin/-/lodash.assignin-4.2.0.tgz", + "integrity": "sha1-uo31+4QesKPoBEIysOJjqNxqKKI=", + "dev": true + }, + "lodash.bind": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/lodash.bind/-/lodash.bind-4.2.1.tgz", + "integrity": "sha1-euMBfpOWIqwxt9fX3LGzTbFpDTU=", + "dev": true + }, "lodash.camelcase": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-3.0.1.tgz", @@ -4556,12 +4606,72 @@ "integrity": "sha1-baj1QzSjZqfPTEx2742Aqhs2XtU=", "dev": true }, + "lodash.defaults": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", + "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=", + "dev": true + }, + "lodash.filter": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.filter/-/lodash.filter-4.6.0.tgz", + "integrity": "sha1-ZosdSYFgOuHMWm+nYBQ+SAtMSs4=", + "dev": true + }, + "lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=", + "dev": true + }, + "lodash.foreach": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.foreach/-/lodash.foreach-4.5.0.tgz", + "integrity": "sha1-Gmo16s5AEoDH8G3d7DUWWrJ+PlM=", + "dev": true + }, + "lodash.map": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.map/-/lodash.map-4.6.0.tgz", + "integrity": "sha1-dx7Hg540c9nEzeKLGTlMNWL09tM=", + "dev": true + }, "lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", "dev": true }, + "lodash.merge": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.0.tgz", + "integrity": "sha1-aYhLoUSsM/5plzemCG3v+t0PicU=", + "dev": true + }, + "lodash.pick": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz", + "integrity": "sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=", + "dev": true + }, + "lodash.reduce": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.reduce/-/lodash.reduce-4.6.0.tgz", + "integrity": "sha1-8atrg5KZrUj3hKu/R2WW8DuRTTs=", + "dev": true + }, + "lodash.reject": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.reject/-/lodash.reject-4.6.0.tgz", + "integrity": "sha1-gNZJLcFHCGS79YNTO2UfQqn1JBU=", + "dev": true + }, + "lodash.some": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.some/-/lodash.some-4.6.0.tgz", + "integrity": "sha1-G7nzFO9ri63tE7VJFpsqlF62jk0=", + "dev": true + }, "lodash.uniq": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", @@ -6675,17 +6785,41 @@ "integrity": "sha1-KKZZz5h9lqTavnhgKJ87UybEoDw=", "dev": true }, + "object-is": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.0.1.tgz", + "integrity": "sha1-CqYOyZiaCz7Xlc9NBvYs8a1lObY=", + "dev": true + }, "object-keys": { "version": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.11.tgz", "integrity": "sha1-xUYBd4rVYPEULODgG8yotW0TQm0=", "dev": true }, + "object.assign": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.0.4.tgz", + "integrity": "sha1-scnMBE7xuf5jYG/BQau7MuFHMMw=", + "dev": true + }, + "object.entries": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.0.4.tgz", + "integrity": "sha1-G/mk3SKI9bM/Opk9JXZh8F0WGl8=", + "dev": true + }, "object.omit": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", "dev": true }, + "object.values": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.0.4.tgz", + "integrity": "sha1-5STaCbT2b/Bd9FdUbscqyZ8TBpo=", + "dev": true + }, "obuf": { "version": "https://registry.npmjs.org/obuf/-/obuf-1.1.1.tgz", "integrity": "sha1-EEEktsYCxnlogaBCVB0220OlJk4=", @@ -8622,8 +8756,7 @@ "uuid": { "version": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", "integrity": "sha1-PdPT55Crwk17DToDT/q6vijrvAQ=", - "dev": true, - "optional": true + "dev": true }, "validate-npm-package-license": { "version": "3.0.1", diff --git a/package.json b/package.json index 46eec90..5030354 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "copy-webpack-plugin": "^3.0.1", "cross-env": "^5.0.5", "css-loader": "^0.23.0", + "enzyme": "^2.9.1", "eslint": "^4.7.2", "eslint-loader": "^1.9.0", "eslint-plugin-react": "^7.3.0", diff --git a/showprepper.sublime-project b/showprepper.sublime-project index 623009c..82f4244 100644 --- a/showprepper.sublime-project +++ b/showprepper.sublime-project @@ -1,66 +1,65 @@ { - "build_systems": [ - { - "cmd": [ - "node.exe", - "server.js" - ], - "env": + "build_systems": [{ + "cmd": [ + "node.exe", + "server.js" + ], + "env": { + "env": "dev", + "port": "8888" + }, + "name": "node-app", + "working_dir": "${project_path}" + }, + { + "cmd": [ + "npm.cmd", + "test" + ], + "name": "npm-run-test", + "working_dir": "${project_path}", + "target": "ansi_color_build", + "syntax": "Packages/ANSIescape/ANSI.tmLanguage" + }, + { + "cmd": [ + "npm.cmd", + "run", + "dist" + ], + "name": "npm-run-dist", + "working_dir": "${project_path}", + "target": "ansi_color_build", + "syntax": "Packages/ANSIescape/ANSI.tmLanguage" + }, + { + "cmd": [ + "node.exe", + "node_modules/karma/bin/karma", + "start", + "--no-single-run", + "--no-colors", + "--browsers", + "Chrome" + ], + "env": { + "NODE_ENV": "test" + }, + "name": "debug-karma", + "working_dir": "${project_path}" + } + ], + "folders": [{ + "path": "." + }, { - "env": "dev", - "port": "8888" + "path": "../impress.js" }, - "name": "node-app", - "working_dir": "${project_path}" - }, - { - "cmd": [ - "npm.cmd", - "test" - ], - "name": "npm-run-test", - "working_dir": "${project_path}", - "target": "ansi_color_build", - "syntax": "Packages/ANSIescape/ANSI.tmLanguage" - }, - { - "cmd": [ - "npm.cmd", - "run", - "dist" - ], - "name": "npm-run-dist", - "working_dir": "${project_path}", - "target": "ansi_color_build", - "syntax": "Packages/ANSIescape/ANSI.tmLanguage" - }, - { - "cmd": [ - "node.exe", - "--inspect-brk", - "node_modules/karma/bin/karma", - "start" - ], - "env": { - "NODE_ENV": "test" + "path": "../strut2" }, - "name": "debug-karma", - "working_dir": "${project_path}", - "target": "ansi_color_build", - "syntax": "Packages/ANSIescape/ANSI.tmLanguage" - }], - "folders": [ - { - "path": "." - }, - { - "path": "../impress.js" - }, - { - "path": "../strut2" - }, - { - "path": "../Strut" - }] + { + "path": "../Strut" + } + ] } diff --git a/test/components/AppTest.js b/test/components/AppTest.js index 7924fa8..7bddf02 100644 --- a/test/components/AppTest.js +++ b/test/components/AppTest.js @@ -18,6 +18,7 @@ describe('MainComponent', () => { }) it('should have its component name as default className', () => { + debugger expect(MainComponent.props.className).to.equal('sp-main-container') }) })