From 6c940a5e95289b99f4f0bc33b6c67ddb21e702e6 Mon Sep 17 00:00:00 2001 From: KHeo Date: Tue, 31 Mar 2020 17:05:40 +0900 Subject: [PATCH 01/18] Migrated typescript code from cypress Move through2 to dependencies. Fix --- index.js | 16 ++++++++++++++-- package.json | 3 ++- simple_tsify.js | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 simple_tsify.js diff --git a/index.js b/index.js index 969ab41..c2f2472 100644 --- a/index.js +++ b/index.js @@ -60,7 +60,7 @@ const defaultOptions = { }, } -const getBrowserifyOptions = (entry, userBrowserifyOptions = {}) => { +const getBrowserifyOptions = (entry, userBrowserifyOptions = {}, typescriptPath = null) => { let browserifyOptions = cloneDeep(defaultOptions.browserifyOptions) // allow user to override default options @@ -81,6 +81,18 @@ const getBrowserifyOptions = (entry, userBrowserifyOptions = {}) => { entries: [entry], }) + if (typescriptPath) { + browserifyOptions.extensions.push('.ts', '.tsx') + // remove babelify setting + browserifyOptions.transform.pop() + // add typescript compiler + browserifyOptions.transform.push([ + path.join(__dirname, './simple_tsify'), { + typescript: require(typescriptPath), + }, + ]) + } + debug('browserifyOptions: %o', browserifyOptions) return browserifyOptions @@ -127,7 +139,7 @@ const preprocessor = (options = {}) => { debug('input:', filePath) debug('output:', outputPath) - const browserifyOptions = getBrowserifyOptions(filePath, options.browserifyOptions) + const browserifyOptions = getBrowserifyOptions(filePath, options.browserifyOptions, options.typescript) const watchifyOptions = Object.assign({}, defaultOptions.watchifyOptions, options.watchifyOptions) const bundler = browserify(browserifyOptions) diff --git a/package.json b/package.json index 0d52f51..38938eb 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,8 @@ "debug": "4.1.1", "fs-extra": "7.0.1", "lodash.clonedeep": "4.5.0", - "watchify": "3.11.1" + "watchify": "3.11.1", + "through2": "^2.0.0" }, "release": { "analyzeCommits": { diff --git a/simple_tsify.js b/simple_tsify.js new file mode 100644 index 0000000..334ed3c --- /dev/null +++ b/simple_tsify.js @@ -0,0 +1,39 @@ +let through = require('through2') + +const isJson = (code) => { + try { + JSON.parse(code) + } catch (e) { + return false + } + + return true +} + +module.exports = function (b, opts) { + const chunks = [] + + return through( + (buf, enc, next) => { + chunks.push(buf.toString()) + next() + }, + function (next) { + const ts = opts.typescript + const text = chunks.join('') + + if (isJson(text)) { + this.push(text) + } else { + this.push(ts.transpileModule(text, { + compilerOptions: { + esModuleInterop: true, + jsx: 'react', + }, + }).outputText) + } + + next() + }, + ) +} From 487eec471d0eea580128c9fbab9fa5ce9d1ec6bf Mon Sep 17 00:00:00 2001 From: KHeo Date: Tue, 31 Mar 2020 16:35:36 +0900 Subject: [PATCH 02/18] Add doc. --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 19600d5..69dc496 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,16 @@ browserify({ }) ``` +### typescript + +When the path to the TypeScript package is given, Cypress will automatically transpile `.ts` spec, plugin, support files. Note that this **DOES NOT** check types. + +```javascript +browserify({ + typescript: require.resolve('typescript') +}) +``` + **Default**: `undefined` ## Modifying default options From 2825e41dc53e33d810167acde28810fd05a4c4ee Mon Sep 17 00:00:00 2001 From: KHeo Date: Tue, 31 Mar 2020 17:14:09 +0900 Subject: [PATCH 03/18] Add typescript. --- package-lock.json | 6 ++++++ package.json | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 0d1939a..349317c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12910,6 +12910,12 @@ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, + "typescript": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", + "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", + "dev": true + }, "uglify-js": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz", diff --git a/package.json b/package.json index 38938eb..99fc84a 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,8 @@ "semantic-release": "15.13.15", "sinon": "7.2.3", "sinon-chai": "3.3.0", - "snap-shot-it": "7.9.2" + "snap-shot-it": "7.9.2", + "typescript": "3.8.3" }, "dependencies": { "@babel/core": "7.4.5", From d02daf5a28d8cfe4936ae8124afb75573e620550 Mon Sep 17 00:00:00 2001 From: KHeo Date: Tue, 31 Mar 2020 17:14:24 +0900 Subject: [PATCH 04/18] Add e2e tests for typescript. --- test/e2e/e2e_spec.js | 15 +++++++++++++++ test/fixtures/math.ts | 5 +++++ test/fixtures/math_spec.ts | 13 +++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 test/fixtures/math.ts create mode 100644 test/fixtures/math_spec.ts diff --git a/test/e2e/e2e_spec.js b/test/e2e/e2e_spec.js index 972687b..dd1c596 100644 --- a/test/e2e/e2e_spec.js +++ b/test/e2e/e2e_spec.js @@ -33,6 +33,21 @@ describe('browserify preprocessor - e2e', function () { }) }) +describe('typescript', function () { + it('handles typescript when the path is given', function () { + return bundle('math_spec.ts', { + typescript: require.resolve('typescript'), + }).then((output) => { + // check that bundled tests work + eval(output) + }) + }) + + it('cannot handle typescript when the path is not given', function () { + expect(() => bundle('math_spec.ts')).to.throw + }) +}) + describe('imports and exports', () => { it('handles imports and exports', () => { return bundle('math_spec.js').then((output) => { diff --git a/test/fixtures/math.ts b/test/fixtures/math.ts new file mode 100644 index 0000000..0568956 --- /dev/null +++ b/test/fixtures/math.ts @@ -0,0 +1,5 @@ +export default { + add: (a: number, b: number) => { + return a + b + }, +} diff --git a/test/fixtures/math_spec.ts b/test/fixtures/math_spec.ts new file mode 100644 index 0000000..a48b68d --- /dev/null +++ b/test/fixtures/math_spec.ts @@ -0,0 +1,13 @@ +// math exports default object +// so if we want a property, first we need to grab the default +import math from './math' +const {add} = math + +context('math.js', function () { + it('imports function', () => { + expect(add, 'add').to.be.a('function') + }) + it('can add numbers', function () { + expect(add(1, 2)).to.eq(3) + }) +}) From 136dfd59cd4d8481233c6293e7ebfd4a40e013bb Mon Sep 17 00:00:00 2001 From: KHeo Date: Tue, 31 Mar 2020 17:42:12 +0900 Subject: [PATCH 05/18] Test .tsx file. --- test/e2e/e2e_spec.js | 17 +++++++++++++++-- test/fixtures/math_spec.tsx | 9 +++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 test/fixtures/math_spec.tsx diff --git a/test/e2e/e2e_spec.js b/test/e2e/e2e_spec.js index dd1c596..637bbbd 100644 --- a/test/e2e/e2e_spec.js +++ b/test/e2e/e2e_spec.js @@ -34,7 +34,7 @@ describe('browserify preprocessor - e2e', function () { }) describe('typescript', function () { - it('handles typescript when the path is given', function () { + it('handles .ts file when the path is given', function () { return bundle('math_spec.ts', { typescript: require.resolve('typescript'), }).then((output) => { @@ -43,9 +43,22 @@ describe('typescript', function () { }) }) - it('cannot handle typescript when the path is not given', function () { + it('handles .tsx file when the path is given', function () { + return bundle('math_spec.ts', { + typescript: require.resolve('typescript'), + }).then((output) => { + // check that bundled tests work + eval(output) + }) + }) + + it('cannot handle .ts file when the path is not given', function () { expect(() => bundle('math_spec.ts')).to.throw }) + + it('cannot handle .tsx file when the path is not given', function () { + expect(() => bundle('math_spec.tsx')).to.throw + }) }) describe('imports and exports', () => { diff --git a/test/fixtures/math_spec.tsx b/test/fixtures/math_spec.tsx new file mode 100644 index 0000000..2c33086 --- /dev/null +++ b/test/fixtures/math_spec.tsx @@ -0,0 +1,9 @@ +import math from './math' + +interface Props { + greeting: string +} + +export const Foo = ({ greeting }: Props) => { + return
{greeting}{math.add(1, 2)}
+} From 01dae0c457a4991f38cc4a49292bd94a3192bcc4 Mon Sep 17 00:00:00 2001 From: KHeo Date: Thu, 2 Apr 2020 17:22:45 +0900 Subject: [PATCH 06/18] Reason why simple_tsify is necessary. --- simple_tsify.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/simple_tsify.js b/simple_tsify.js index 334ed3c..33d7054 100644 --- a/simple_tsify.js +++ b/simple_tsify.js @@ -10,6 +10,10 @@ const isJson = (code) => { return true } +// tsify doesn't have transpile-only option like ts-node or ts-loader. +// It means it should check types whenever spec file is changed +// and it slows down the test speed a lot. +// We skip this slow type-checking process by using transpileModule() api. module.exports = function (b, opts) { const chunks = [] From 2652f0241d6f2f6995edf3653a9263a345aab45b Mon Sep 17 00:00:00 2001 From: KHeo Date: Thu, 2 Apr 2020 19:04:29 +0900 Subject: [PATCH 07/18] Test typescript options + remove babelify even if it's not the last item --- index.js | 10 +++++- test/e2e/e2e_spec.js | 24 +++++++++---- test/e2e/ts_spec.js | 72 +++++++++++++++++++++++++++++++++++++ test/fixtures/math_spec.ts | 9 +++-- test/fixtures/math_spec2.ts | 18 ++++++++++ 5 files changed, 123 insertions(+), 10 deletions(-) create mode 100644 test/e2e/ts_spec.js create mode 100644 test/fixtures/math_spec2.ts diff --git a/index.js b/index.js index c2f2472..f806e53 100644 --- a/index.js +++ b/index.js @@ -82,9 +82,17 @@ const getBrowserifyOptions = (entry, userBrowserifyOptions = {}, typescriptPath }) if (typescriptPath) { + const transform = browserifyOptions.transform + const hasTsifyTransform = transform.some(([name]) => name.includes('tsify')) + const hastsifyPlugin = browserifyOptions.plugin.includes('tsify') + + if (hasTsifyTransform || hastsifyPlugin) { + throw new Error('We see you passed the typescript option and also passed a browserify transform for TypeScript. Please only do one or the other.') + } + browserifyOptions.extensions.push('.ts', '.tsx') // remove babelify setting - browserifyOptions.transform.pop() + browserifyOptions.transform = transform.filter(([name]) => !name.includes('babelify')) // add typescript compiler browserifyOptions.transform.push([ path.join(__dirname, './simple_tsify'), { diff --git a/test/e2e/e2e_spec.js b/test/e2e/e2e_spec.js index 637bbbd..b0aabc3 100644 --- a/test/e2e/e2e_spec.js +++ b/test/e2e/e2e_spec.js @@ -44,7 +44,7 @@ describe('typescript', function () { }) it('handles .tsx file when the path is given', function () { - return bundle('math_spec.ts', { + return bundle('math_spec.tsx', { typescript: require.resolve('typescript'), }).then((output) => { // check that bundled tests work @@ -52,12 +52,22 @@ describe('typescript', function () { }) }) - it('cannot handle .ts file when the path is not given', function () { - expect(() => bundle('math_spec.ts')).to.throw - }) - - it('cannot handle .tsx file when the path is not given', function () { - expect(() => bundle('math_spec.tsx')).to.throw + it('babelify is removed even if it is not the last item', () => { + const { browserifyOptions } = preprocessor.defaultOptions + + return bundle('math_spec2.ts', { + browserifyOptions: { + ...browserifyOptions, + transform: [ + browserifyOptions.transform[1], + browserifyOptions.transform[0], + ], + }, + typescript: require.resolve('typescript'), + }).then((output) => { + // check that bundled tests work + eval(output) + }) }) }) diff --git a/test/e2e/ts_spec.js b/test/e2e/ts_spec.js new file mode 100644 index 0000000..6bc9e71 --- /dev/null +++ b/test/e2e/ts_spec.js @@ -0,0 +1,72 @@ +// This spec is broken out of e2e_spec.js +// Because eval()s in that file causes unexpected failures. + +const chai = require('chai') +const path = require('path') + +const fs = require('../../fs') +const preprocessor = require('../../index') + +/* eslint-disable-next-line no-unused-vars */ +const expect = chai.expect + +beforeEach(function () { + fs.removeSync(path.join(__dirname, '_test-output')) +}) + +// do not generate source maps by default +const DEFAULT_OPTIONS = { browserifyOptions: { debug: false } } + +const bundle = (fixtureName, options = DEFAULT_OPTIONS) => { + const on = () => {} + const filePath = path.join(__dirname, '..', 'fixtures', fixtureName) + const outputPath = path.join(__dirname, '..', '_test-output', 'output.js') + + return preprocessor(options)({ filePath, outputPath, on }).then(() => { + return fs.readFileSync(outputPath).toString() + }) +} + +describe('throws errors when typescript path and tsify are given together', function () { + it('plugin', function () { + expect(() => bundle('math_spec.ts', { + browserifyOptions: { + plugin: ['tsify'], + }, + typescript: require.resolve('typescript'), + })).to.throw('Please only do one or the other.') + }) + + it('transform', function () { + expect(() => bundle('math_spec.ts', { + browserifyOptions: { + transform: [ + ['path/to/tsify', {}], + ], + }, + typescript: require.resolve('typescript'), + })).to.throw('Please only do one or the other.') + }) +}) + +describe('typescript transpile failure', function () { + it('cannot handle .ts file when the path is not given', function () { + return bundle('math_spec.ts') + .then(() => { + expect(true).to.eq('should not be here') + }) + .catch((err) => { + expect(err.message).to.include('\'import\' and \'export\' may appear only with \'sourceType: module\'') + }) + }) + + it('cannot handle .tsx file when the path is not given', function () { + return bundle('math_spec.tsx') + .then(() => { + expect(true).to.eq('should not be here') + }) + .catch((err) => { + expect(err.message).to.include('\'import\' and \'export\' may appear only with \'sourceType: module\'') + }) + }) +}) diff --git a/test/fixtures/math_spec.ts b/test/fixtures/math_spec.ts index a48b68d..54dd135 100644 --- a/test/fixtures/math_spec.ts +++ b/test/fixtures/math_spec.ts @@ -1,13 +1,18 @@ // math exports default object // so if we want a property, first we need to grab the default import math from './math' -const {add} = math +const { add } = math -context('math.js', function () { +const x: number = 3 + +context('math.ts', function () { it('imports function', () => { expect(add, 'add').to.be.a('function') }) it('can add numbers', function () { expect(add(1, 2)).to.eq(3) }) + it('test ts-typed variable', function () { + expect(x).to.eq(3) + }) }) diff --git a/test/fixtures/math_spec2.ts b/test/fixtures/math_spec2.ts new file mode 100644 index 0000000..54dd135 --- /dev/null +++ b/test/fixtures/math_spec2.ts @@ -0,0 +1,18 @@ +// math exports default object +// so if we want a property, first we need to grab the default +import math from './math' +const { add } = math + +const x: number = 3 + +context('math.ts', function () { + it('imports function', () => { + expect(add, 'add').to.be.a('function') + }) + it('can add numbers', function () { + expect(add(1, 2)).to.eq(3) + }) + it('test ts-typed variable', function () { + expect(x).to.eq(3) + }) +}) From a96c0508f2b97e9de4a9b62ffc7c59b203379888 Mon Sep 17 00:00:00 2001 From: KHeo Date: Fri, 3 Apr 2020 15:26:09 +0900 Subject: [PATCH 08/18] Test tsx file with enzyme. --- package-lock.json | 630 +++++++++++++++++++++++++++++++++- package.json | 4 + test/e2e/e2e_spec.js | 4 +- test/fixtures/component.tsx | 7 + test/fixtures/enzyme_spec.tsx | 16 + test/fixtures/math_spec.tsx | 9 - 6 files changed, 658 insertions(+), 12 deletions(-) create mode 100644 test/fixtures/component.tsx create mode 100644 test/fixtures/enzyme_spec.tsx delete mode 100644 test/fixtures/math_spec.tsx diff --git a/package-lock.json b/package-lock.json index 349317c..5cf1f06 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1608,6 +1608,24 @@ "indent-string": "^3.2.0" } }, + "airbnb-prop-types": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/airbnb-prop-types/-/airbnb-prop-types-2.15.0.tgz", + "integrity": "sha512-jUh2/hfKsRjNFC4XONQrxo/n/3GG4Tn6Hl0WlFQN5PY9OMC9loSCoAYKnZsWaP8wEfd5xcrPloK0Zg6iS1xwVA==", + "dev": true, + "requires": { + "array.prototype.find": "^2.1.0", + "function.prototype.name": "^1.1.1", + "has": "^1.0.3", + "is-regex": "^1.0.4", + "object-is": "^1.0.1", + "object.assign": "^4.1.0", + "object.entries": "^1.1.0", + "prop-types": "^15.7.2", + "prop-types-exact": "^1.2.0", + "react-is": "^16.9.0" + } + }, "ajv": { "version": "6.10.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz", @@ -1792,6 +1810,26 @@ "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=" }, + "array.prototype.find": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/array.prototype.find/-/array.prototype.find-2.1.1.tgz", + "integrity": "sha512-mi+MYNJYLTx2eNYy+Yh6raoQacCsNeeMUaspFPh9Y141lFSsWxxB8V9mM2ye+eqiRs917J6/pJ4M9ZPzenWckA==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.4" + } + }, + "array.prototype.flat": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.3.tgz", + "integrity": "sha512-gBlRZV0VSmfPIeWfuuy56XZMvbVfbEUnOXUvt3F/eUUUSyzlgLxhEX4YAEpxNAogRGehPSnfXyPtYyKAhkzQhQ==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1" + } + }, "arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", @@ -2034,6 +2072,12 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" }, + "boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", + "dev": true + }, "boom": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", @@ -2551,6 +2595,31 @@ "integrity": "sha1-FCD/sQ/URNz8ebQ4kbv//TKoRgA=", "dev": true }, + "cheerio": { + "version": "1.0.0-rc.3", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.3.tgz", + "integrity": "sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA==", + "dev": true, + "requires": { + "css-select": "~1.2.0", + "dom-serializer": "~0.1.1", + "entities": "~1.1.1", + "htmlparser2": "^3.9.1", + "lodash": "^4.15.0", + "parse5": "^3.0.1" + }, + "dependencies": { + "parse5": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz", + "integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==", + "dev": true, + "requires": { + "@types/node": "*" + } + } + } + }, "chokidar": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.1.tgz", @@ -3277,8 +3346,7 @@ "version": "2.20.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", - "dev": true, - "optional": true + "dev": true }, "common-tags": { "version": "1.8.0", @@ -3576,6 +3644,24 @@ "integrity": "sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=", "dev": true }, + "css-select": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", + "dev": true, + "requires": { + "boolbase": "~1.0.0", + "css-what": "2.1", + "domutils": "1.5.1", + "nth-check": "~1.0.1" + } + }, + "css-what": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz", + "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==", + "dev": true + }, "currently-unhandled": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", @@ -3903,6 +3989,12 @@ "path-type": "^3.0.0" } }, + "discontinuous-range": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/discontinuous-range/-/discontinuous-range-1.0.0.tgz", + "integrity": "sha1-44Mx8IRLukm5qctxx3FYWqsbxlo=", + "dev": true + }, "disparity": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/disparity/-/disparity-3.0.0.tgz", @@ -3955,11 +4047,46 @@ "esutils": "^2.0.2" } }, + "dom-serializer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", + "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==", + "dev": true, + "requires": { + "domelementtype": "^1.3.0", + "entities": "^1.1.1" + } + }, "domain-browser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==" }, + "domelementtype": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", + "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", + "dev": true + }, + "domhandler": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", + "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", + "dev": true, + "requires": { + "domelementtype": "1" + } + }, + "domutils": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", + "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", + "dev": true, + "requires": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, "dot-prop": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", @@ -4017,6 +4144,12 @@ "once": "^1.4.0" } }, + "entities": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", + "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", + "dev": true + }, "env-ci": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/env-ci/-/env-ci-3.2.2.tgz", @@ -4053,6 +4186,93 @@ } } }, + "enzyme": { + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/enzyme/-/enzyme-3.11.0.tgz", + "integrity": "sha512-Dw8/Gs4vRjxY6/6i9wU0V+utmQO9kvh9XLnz3LIudviOnVYDEe2ec+0k+NQoMamn1VrjKgCUOWj5jG/5M5M0Qw==", + "dev": true, + "requires": { + "array.prototype.flat": "^1.2.3", + "cheerio": "^1.0.0-rc.3", + "enzyme-shallow-equal": "^1.0.1", + "function.prototype.name": "^1.1.2", + "has": "^1.0.3", + "html-element-map": "^1.2.0", + "is-boolean-object": "^1.0.1", + "is-callable": "^1.1.5", + "is-number-object": "^1.0.4", + "is-regex": "^1.0.5", + "is-string": "^1.0.5", + "is-subset": "^0.1.1", + "lodash.escape": "^4.0.1", + "lodash.isequal": "^4.5.0", + "object-inspect": "^1.7.0", + "object-is": "^1.0.2", + "object.assign": "^4.1.0", + "object.entries": "^1.1.1", + "object.values": "^1.1.1", + "raf": "^3.4.1", + "rst-selector-parser": "^2.2.3", + "string.prototype.trim": "^1.2.1" + } + }, + "enzyme-adapter-react-16": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.15.2.tgz", + "integrity": "sha512-SkvDrb8xU3lSxID8Qic9rB8pvevDbLybxPK6D/vW7PrT0s2Cl/zJYuXvsd1EBTz0q4o3iqG3FJhpYz3nUNpM2Q==", + "dev": true, + "requires": { + "enzyme-adapter-utils": "^1.13.0", + "enzyme-shallow-equal": "^1.0.1", + "has": "^1.0.3", + "object.assign": "^4.1.0", + "object.values": "^1.1.1", + "prop-types": "^15.7.2", + "react-is": "^16.12.0", + "react-test-renderer": "^16.0.0-0", + "semver": "^5.7.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "enzyme-adapter-utils": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/enzyme-adapter-utils/-/enzyme-adapter-utils-1.13.0.tgz", + "integrity": "sha512-YuEtfQp76Lj5TG1NvtP2eGJnFKogk/zT70fyYHXK2j3v6CtuHqc8YmgH/vaiBfL8K1SgVVbQXtTcgQZFwzTVyQ==", + "dev": true, + "requires": { + "airbnb-prop-types": "^2.15.0", + "function.prototype.name": "^1.1.2", + "object.assign": "^4.1.0", + "object.fromentries": "^2.0.2", + "prop-types": "^15.7.2", + "semver": "^5.7.1" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "enzyme-shallow-equal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/enzyme-shallow-equal/-/enzyme-shallow-equal-1.0.1.tgz", + "integrity": "sha512-hGA3i1so8OrYOZSM9whlkNmVHOicJpsjgTzC+wn2JMJXhq1oO4kA4bJ5MsfzSIcC71aLDKzJ6gZpIxrqt3QTAQ==", + "dev": true, + "requires": { + "has": "^1.0.3", + "object-is": "^1.0.2" + } + }, "error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -4062,6 +4282,36 @@ "is-arrayish": "^0.2.1" } }, + "es-abstract": { + "version": "1.17.5", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.5.tgz", + "integrity": "sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==", + "dev": true, + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.1.5", + "is-regex": "^1.0.5", + "object-inspect": "^1.7.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.0", + "string.prototype.trimleft": "^2.1.1", + "string.prototype.trimright": "^2.1.1" + } + }, + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, "es6-promise": { "version": "4.2.4", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.4.tgz", @@ -4923,12 +5173,29 @@ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, + "function.prototype.name": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.2.tgz", + "integrity": "sha512-C8A+LlHBJjB2AdcRPorc5JvJ5VUoWlXdEHLOJdCI7kjHEtGTpHQUiqMvCIKUwIsGwZX2jZJy761AXsn356bJQg==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "functions-have-names": "^1.2.0" + } + }, "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", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, + "functions-have-names": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.1.tgz", + "integrity": "sha512-j48B/ZI7VKs3sgeI2cZp7WXWmZXu7Iq5pl5/vptV5N2mq+DGFuS/ulaDjtaoLpYzuD6u8UgrUKHfgo7fDTSiBA==", + "dev": true + }, "get-assigned-identifiers": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/get-assigned-identifiers/-/get-assigned-identifiers-1.2.0.tgz", @@ -5352,11 +5619,55 @@ "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", "dev": true }, + "html-element-map": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/html-element-map/-/html-element-map-1.2.0.tgz", + "integrity": "sha512-0uXq8HsuG1v2TmQ8QkIhzbrqeskE4kn52Q18QJ9iAA/SnHoEKXWiUxHQtclRsCFWEUD2So34X+0+pZZu862nnw==", + "dev": true, + "requires": { + "array-filter": "^1.0.0" + }, + "dependencies": { + "array-filter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-1.0.0.tgz", + "integrity": "sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=", + "dev": true + } + } + }, "htmlescape": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/htmlescape/-/htmlescape-1.1.1.tgz", "integrity": "sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E=" }, + "htmlparser2": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", + "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", + "dev": true, + "requires": { + "domelementtype": "^1.3.1", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^3.1.1" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, "http-proxy-agent": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz", @@ -5808,6 +6119,12 @@ "binary-extensions": "^1.0.0" } }, + "is-boolean-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.0.1.tgz", + "integrity": "sha512-TqZuVwa/sppcrhUCAYkGBk7w0yxfQQnxq28fjkO53tnK9FQXmdwz2JS5+GjsWQ6RByES1K40nI+yDic5c9/aAQ==", + "dev": true + }, "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", @@ -5822,6 +6139,12 @@ "builtin-modules": "^1.0.0" } }, + "is-callable": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", + "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==", + "dev": true + }, "is-ci": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", @@ -5839,6 +6162,12 @@ "kind-of": "^3.0.2" } }, + "is-date-object": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", + "dev": true + }, "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", @@ -5913,6 +6242,12 @@ "kind-of": "^3.0.2" } }, + "is-number-object": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.4.tgz", + "integrity": "sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw==", + "dev": true + }, "is-obj": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", @@ -5961,6 +6296,15 @@ "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=", "dev": true }, + "is-regex": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", + "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, "is-relative": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", @@ -5982,12 +6326,27 @@ "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, + "is-string": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", + "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", + "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-symbol": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "dev": true, + "requires": { + "has-symbols": "^1.0.1" + } + }, "is-text-path": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz", @@ -6274,18 +6633,36 @@ "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=" }, + "lodash.escape": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-4.0.1.tgz", + "integrity": "sha1-yQRGkMIeBClL6qUXcS/e0fqI3pg=", + "dev": true + }, "lodash.escaperegexp": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz", "integrity": "sha1-ZHYsSGGAglGKw99Mz11YhtriA0c=", "dev": true }, + "lodash.flattendeep": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", + "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", + "dev": true + }, "lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", "dev": true }, + "lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=", + "dev": true + }, "lodash.isplainobject": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", @@ -6745,6 +7122,12 @@ "moment": ">= 2.9.0" } }, + "moo": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.1.tgz", + "integrity": "sha512-I1mnb5xn4fO80BH9BLcF0yLypy2UKl+Cb01Fu0hJRkJjlCRtxZMWkTdAtDd5ZqCOxtCkhmRwyI57vWT+1iZ67w==", + "dev": true + }, "ms": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", @@ -6797,6 +7180,19 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, + "nearley": { + "version": "2.19.1", + "resolved": "https://registry.npmjs.org/nearley/-/nearley-2.19.1.tgz", + "integrity": "sha512-xq47GIUGXxU9vQg7g/y1o1xuKnkO7ev4nRWqftmQrLkfnE/FjRqDaGOUakM8XHPn/6pW3bGjU2wgoJyId90rqg==", + "dev": true, + "requires": { + "commander": "^2.19.0", + "moo": "^0.5.0", + "railroad-diagrams": "^1.0.0", + "randexp": "0.4.6", + "semver": "^5.4.1" + } + }, "neo-async": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", @@ -10563,6 +10959,15 @@ } } }, + "nth-check": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", + "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==", + "dev": true, + "requires": { + "boolbase": "~1.0.0" + } + }, "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", @@ -10594,6 +10999,18 @@ } } }, + "object-inspect": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", + "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", + "dev": true + }, + "object-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.0.2.tgz", + "integrity": "sha512-Epah+btZd5wrrfjkJZq1AOB9O6OxUQto45hzFd7lXGrpHPGE0W1k+426yrZV+k6NJOzLNNW/nVsmZdIWsAqoOQ==", + "dev": true + }, "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -10625,6 +11042,30 @@ "object-keys": "^1.0.11" } }, + "object.entries": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.1.tgz", + "integrity": "sha512-ilqR7BgdyZetJutmDPfXCDffGa0/Yzl2ivVNpbx/g4UeWrCdRnFDUBrKJGLhGieRHDATnyZXWBeCb29k9CJysQ==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "function-bind": "^1.1.1", + "has": "^1.0.3" + } + }, + "object.fromentries": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.2.tgz", + "integrity": "sha512-r3ZiBH7MQppDJVLx6fhD618GKNG40CZYH9wgwdhKxBDDbQgjeWGGd4AtkZad84d291YxvWe7bJGuE65Anh0dxQ==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "function-bind": "^1.1.1", + "has": "^1.0.3" + } + }, "object.pick": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", @@ -10640,6 +11081,18 @@ } } }, + "object.values": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.1.tgz", + "integrity": "sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "function-bind": "^1.1.1", + "has": "^1.0.3" + } + }, "octokit-pagination-methods": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz", @@ -11043,6 +11496,12 @@ "sha.js": "^2.4.8" } }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + }, "pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", @@ -11202,6 +11661,28 @@ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "dev": true }, + "prop-types": { + "version": "15.7.2", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", + "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", + "dev": true, + "requires": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.8.1" + } + }, + "prop-types-exact": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/prop-types-exact/-/prop-types-exact-1.2.0.tgz", + "integrity": "sha512-K+Tk3Kd9V0odiXFP9fwDHUYRyvK3Nun3GVyPapSIs5OBkITAm15W0CPFD/YKTkMUAbc0b9CUwRQp2ybiBIq+eA==", + "dev": true, + "requires": { + "has": "^1.0.3", + "object.assign": "^4.1.0", + "reflect.ownkeys": "^0.2.0" + } + }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -11269,12 +11750,37 @@ "integrity": "sha1-EIOSF/bBNiuJGUBE0psjP9fzLwE=", "dev": true }, + "raf": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz", + "integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==", + "dev": true, + "requires": { + "performance-now": "^2.1.0" + } + }, + "railroad-diagrams": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz", + "integrity": "sha1-635iZ1SN3t+4mcG5Dlc3RVnN234=", + "dev": true + }, "ramda": { "version": "0.25.0", "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.25.0.tgz", "integrity": "sha512-GXpfrYVPwx3K7RQ6aYT8KPS8XViSXUVJT1ONhoKPE9VAleW42YE+U+8VEyGWt41EnEQW7gwecYJriTI0pKoecQ==", "dev": true }, + "randexp": { + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/randexp/-/randexp-0.4.6.tgz", + "integrity": "sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ==", + "dev": true, + "requires": { + "discontinuous-range": "1.0.0", + "ret": "~0.1.10" + } + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -11312,6 +11818,47 @@ } } }, + "react": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react/-/react-16.13.1.tgz", + "integrity": "sha512-YMZQQq32xHLX0bz5Mnibv1/LHb3Sqzngu7xstSM+vrkE5Kzr9xE0yMByK5kMoTK30YVJE61WfbxIFFvfeDKT1w==", + "dev": true, + "requires": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1", + "prop-types": "^15.6.2" + } + }, + "react-dom": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.13.1.tgz", + "integrity": "sha512-81PIMmVLnCNLO/fFOQxdQkvEq/+Hfpv24XNJfpyZhTRfO0QcmQIF/PgCa1zCOj2w1hrn12MFLyaJ/G0+Mxtfag==", + "dev": true, + "requires": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1", + "prop-types": "^15.6.2", + "scheduler": "^0.19.1" + } + }, + "react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true + }, + "react-test-renderer": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-16.13.1.tgz", + "integrity": "sha512-Sn2VRyOK2YJJldOqoh8Tn/lWQ+ZiKhyZTPtaO0Q6yNj+QDbmRkVFap6pZPy3YQk8DScRDfyqm/KxKYP9gCMRiQ==", + "dev": true, + "requires": { + "object-assign": "^4.1.1", + "prop-types": "^15.6.2", + "react-is": "^16.8.6", + "scheduler": "^0.19.1" + } + }, "read-installed": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/read-installed/-/read-installed-4.0.3.tgz", @@ -11435,6 +11982,12 @@ "esprima": "~4.0.0" } }, + "reflect.ownkeys": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/reflect.ownkeys/-/reflect.ownkeys-0.2.0.tgz", + "integrity": "sha1-dJrO7H8/34tj+SegSAnpDFwLNGA=", + "dev": true + }, "regenerate": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", @@ -11634,6 +12187,16 @@ "inherits": "^2.0.1" } }, + "rst-selector-parser": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/rst-selector-parser/-/rst-selector-parser-2.2.3.tgz", + "integrity": "sha1-gbIw6i/MYGbInjRy3nlChdmwPZE=", + "dev": true, + "requires": { + "lodash.flattendeep": "^4.4.0", + "nearley": "^2.7.10" + } + }, "run-async": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", @@ -11692,6 +12255,16 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, + "scheduler": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.19.1.tgz", + "integrity": "sha512-n/zwRWRYSUj0/3g/otKDRPMh6qv2SYMWNq85IEa8iZyAv8od9zDYpGSnpBEjNgcMNq6Scbu5KfIPxNF72R/2EA==", + "dev": true, + "requires": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1" + } + }, "semantic-release": { "version": "15.13.15", "resolved": "https://registry.npmjs.org/semantic-release/-/semantic-release-15.13.15.tgz", @@ -12596,6 +13169,59 @@ "strip-ansi": "^3.0.0" } }, + "string.prototype.trim": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.1.tgz", + "integrity": "sha512-MjGFEeqixw47dAMFMtgUro/I0+wNqZB5GKXGt1fFr24u3TzDXCPu7J9Buppzoe3r/LqkSDLDDJzE15RGWDGAVw==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "function-bind": "^1.1.1" + } + }, + "string.prototype.trimend": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.0.tgz", + "integrity": "sha512-EEJnGqa/xNfIg05SxiPSqRS7S9qwDhYts1TSLR1BQfYUfPe1stofgGKvwERK9+9yf+PpfBMlpBaCHucXGPQfUA==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, + "string.prototype.trimleft": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.2.tgz", + "integrity": "sha512-gCA0tza1JBvqr3bfAIFJGqfdRTyPae82+KTnm3coDXkZN9wnuW3HjGgN386D7hfv5CHQYCI022/rJPVlqXyHSw==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5", + "string.prototype.trimstart": "^1.0.0" + } + }, + "string.prototype.trimright": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.2.tgz", + "integrity": "sha512-ZNRQ7sY3KroTaYjRS6EbNiiHrOkjihL9aQE/8gfQ4DtAC/aEBRHFJa44OmoWxGGqXuJlfKkZW4WcXErGr+9ZFg==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5", + "string.prototype.trimend": "^1.0.0" + } + }, + "string.prototype.trimstart": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.0.tgz", + "integrity": "sha512-iCP8g01NFYiiBOnwG1Xc3WZLyoo+RuBymwIlWncShXDDJYWN6DbnM3odslBJdgCdRlq94B5s63NWAZlcn2CS4w==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, "string_decoder": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.2.0.tgz", diff --git a/package.json b/package.json index 99fc84a..796a68c 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,8 @@ "chokidar-cli": "1.2.2", "dependency-check": "3.3.0", "deps-ok": "1.4.1", + "enzyme": "3.11.0", + "enzyme-adapter-react-16": "1.15.2", "eslint": "5.13.0", "eslint-plugin-cypress-dev": "2.0.0", "eslint-plugin-mocha": "5.3.0", @@ -52,6 +54,8 @@ "mocha": "5.2.0", "mockery": "2.1.0", "nsp": "3.2.1", + "react": "16.13.1", + "react-dom": "16.13.1", "semantic-release": "15.13.15", "sinon": "7.2.3", "sinon-chai": "3.3.0", diff --git a/test/e2e/e2e_spec.js b/test/e2e/e2e_spec.js index b0aabc3..63cd892 100644 --- a/test/e2e/e2e_spec.js +++ b/test/e2e/e2e_spec.js @@ -44,7 +44,9 @@ describe('typescript', function () { }) it('handles .tsx file when the path is given', function () { - return bundle('math_spec.tsx', { + this.timeout(10000) + + return bundle('enzyme_spec.tsx', { typescript: require.resolve('typescript'), }).then((output) => { // check that bundled tests work diff --git a/test/fixtures/component.tsx b/test/fixtures/component.tsx new file mode 100644 index 0000000..b36133b --- /dev/null +++ b/test/fixtures/component.tsx @@ -0,0 +1,7 @@ +import React from 'react' + +export default () => { + return ( +
icon
+ ) +} \ No newline at end of file diff --git a/test/fixtures/enzyme_spec.tsx b/test/fixtures/enzyme_spec.tsx new file mode 100644 index 0000000..e1fec3e --- /dev/null +++ b/test/fixtures/enzyme_spec.tsx @@ -0,0 +1,16 @@ +import React from 'react'; +import { expect } from 'chai'; +import Enzyme from 'enzyme'; +import { shallow } from 'enzyme'; +import Adapter from 'enzyme-adapter-react-16'; + +Enzyme.configure({ adapter: new Adapter() }); + +import MyComponent from './component'; + +describe('', () => { + it('renders an `.icon-star`', () => { + const wrapper = shallow(); + expect(wrapper.find('.icon-star')).to.have.lengthOf(1); + }); +}); \ No newline at end of file diff --git a/test/fixtures/math_spec.tsx b/test/fixtures/math_spec.tsx deleted file mode 100644 index 2c33086..0000000 --- a/test/fixtures/math_spec.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import math from './math' - -interface Props { - greeting: string -} - -export const Foo = ({ greeting }: Props) => { - return
{greeting}{math.add(1, 2)}
-} From 74d4bd95dcb56d9bda664569eba2cfd6ba5405d3 Mon Sep 17 00:00:00 2001 From: KHeo Date: Fri, 3 Apr 2020 15:51:15 +0900 Subject: [PATCH 09/18] Fix test failure. --- test/e2e/e2e_spec.js | 52 +++++++++++++- test/e2e/ts_spec.js | 72 ------------------- test/fixtures/{ => typescript}/component.tsx | 0 .../fixtures/{ => typescript}/enzyme_spec.tsx | 0 test/fixtures/{ => typescript}/math.ts | 0 test/fixtures/{ => typescript}/math_spec.ts | 0 test/fixtures/{ => typescript}/math_spec2.ts | 2 +- test/fixtures/typescript/test1.ts | 1 + test/fixtures/typescript/test2.ts | 1 + test/fixtures/typescript/test3.ts | 1 + test/fixtures/typescript/test4.tsx | 5 ++ 11 files changed, 58 insertions(+), 76 deletions(-) delete mode 100644 test/e2e/ts_spec.js rename test/fixtures/{ => typescript}/component.tsx (100%) rename test/fixtures/{ => typescript}/enzyme_spec.tsx (100%) rename test/fixtures/{ => typescript}/math.ts (100%) rename test/fixtures/{ => typescript}/math_spec.ts (100%) rename test/fixtures/{ => typescript}/math_spec2.ts (91%) create mode 100644 test/fixtures/typescript/test1.ts create mode 100644 test/fixtures/typescript/test2.ts create mode 100644 test/fixtures/typescript/test3.ts create mode 100644 test/fixtures/typescript/test4.tsx diff --git a/test/e2e/e2e_spec.js b/test/e2e/e2e_spec.js index 63cd892..d6ee8a4 100644 --- a/test/e2e/e2e_spec.js +++ b/test/e2e/e2e_spec.js @@ -35,7 +35,7 @@ describe('browserify preprocessor - e2e', function () { describe('typescript', function () { it('handles .ts file when the path is given', function () { - return bundle('math_spec.ts', { + return bundle('typescript/math_spec.ts', { typescript: require.resolve('typescript'), }).then((output) => { // check that bundled tests work @@ -44,9 +44,11 @@ describe('typescript', function () { }) it('handles .tsx file when the path is given', function () { + // This test loads many packages like react, enzyme. + // Because of that, we need more time. this.timeout(10000) - return bundle('enzyme_spec.tsx', { + return bundle('typescript/enzyme_spec.tsx', { typescript: require.resolve('typescript'), }).then((output) => { // check that bundled tests work @@ -57,7 +59,7 @@ describe('typescript', function () { it('babelify is removed even if it is not the last item', () => { const { browserifyOptions } = preprocessor.defaultOptions - return bundle('math_spec2.ts', { + return bundle('typescript/math_spec2.ts', { browserifyOptions: { ...browserifyOptions, transform: [ @@ -71,6 +73,50 @@ describe('typescript', function () { eval(output) }) }) + + describe('throws errors when typescript path and tsify are given together', function () { + it('plugin', function () { + expect(() => bundle('typescript/test1.ts', { + browserifyOptions: { + plugin: ['tsify'], + }, + typescript: require.resolve('typescript'), + })).to.throw('Please only do one or the other.') + }) + + it('transform', function () { + expect(() => bundle('typescript/test2.ts', { + browserifyOptions: { + transform: [ + ['path/to/tsify', {}], + ], + }, + typescript: require.resolve('typescript'), + })).to.throw('Please only do one or the other.') + }) + }) + + describe('typescript transpile failure', function () { + it('cannot handle .ts file when the path is not given', function () { + return bundle('typescript/test3.ts') + .then(() => { + expect(true).to.eq('should not be here') + }) + .catch((err) => { + expect(err.message).to.include('\'import\' and \'export\' may appear only with \'sourceType: module\'') + }) + }) + + it('cannot handle .tsx file when the path is not given', function () { + return bundle('typescript/test4.tsx') + .then(() => { + expect(true).to.eq('should not be here') + }) + .catch((err) => { + expect(err.message).to.include('\'import\' and \'export\' may appear only with \'sourceType: module\'') + }) + }) + }) }) describe('imports and exports', () => { diff --git a/test/e2e/ts_spec.js b/test/e2e/ts_spec.js deleted file mode 100644 index 6bc9e71..0000000 --- a/test/e2e/ts_spec.js +++ /dev/null @@ -1,72 +0,0 @@ -// This spec is broken out of e2e_spec.js -// Because eval()s in that file causes unexpected failures. - -const chai = require('chai') -const path = require('path') - -const fs = require('../../fs') -const preprocessor = require('../../index') - -/* eslint-disable-next-line no-unused-vars */ -const expect = chai.expect - -beforeEach(function () { - fs.removeSync(path.join(__dirname, '_test-output')) -}) - -// do not generate source maps by default -const DEFAULT_OPTIONS = { browserifyOptions: { debug: false } } - -const bundle = (fixtureName, options = DEFAULT_OPTIONS) => { - const on = () => {} - const filePath = path.join(__dirname, '..', 'fixtures', fixtureName) - const outputPath = path.join(__dirname, '..', '_test-output', 'output.js') - - return preprocessor(options)({ filePath, outputPath, on }).then(() => { - return fs.readFileSync(outputPath).toString() - }) -} - -describe('throws errors when typescript path and tsify are given together', function () { - it('plugin', function () { - expect(() => bundle('math_spec.ts', { - browserifyOptions: { - plugin: ['tsify'], - }, - typescript: require.resolve('typescript'), - })).to.throw('Please only do one or the other.') - }) - - it('transform', function () { - expect(() => bundle('math_spec.ts', { - browserifyOptions: { - transform: [ - ['path/to/tsify', {}], - ], - }, - typescript: require.resolve('typescript'), - })).to.throw('Please only do one or the other.') - }) -}) - -describe('typescript transpile failure', function () { - it('cannot handle .ts file when the path is not given', function () { - return bundle('math_spec.ts') - .then(() => { - expect(true).to.eq('should not be here') - }) - .catch((err) => { - expect(err.message).to.include('\'import\' and \'export\' may appear only with \'sourceType: module\'') - }) - }) - - it('cannot handle .tsx file when the path is not given', function () { - return bundle('math_spec.tsx') - .then(() => { - expect(true).to.eq('should not be here') - }) - .catch((err) => { - expect(err.message).to.include('\'import\' and \'export\' may appear only with \'sourceType: module\'') - }) - }) -}) diff --git a/test/fixtures/component.tsx b/test/fixtures/typescript/component.tsx similarity index 100% rename from test/fixtures/component.tsx rename to test/fixtures/typescript/component.tsx diff --git a/test/fixtures/enzyme_spec.tsx b/test/fixtures/typescript/enzyme_spec.tsx similarity index 100% rename from test/fixtures/enzyme_spec.tsx rename to test/fixtures/typescript/enzyme_spec.tsx diff --git a/test/fixtures/math.ts b/test/fixtures/typescript/math.ts similarity index 100% rename from test/fixtures/math.ts rename to test/fixtures/typescript/math.ts diff --git a/test/fixtures/math_spec.ts b/test/fixtures/typescript/math_spec.ts similarity index 100% rename from test/fixtures/math_spec.ts rename to test/fixtures/typescript/math_spec.ts diff --git a/test/fixtures/math_spec2.ts b/test/fixtures/typescript/math_spec2.ts similarity index 91% rename from test/fixtures/math_spec2.ts rename to test/fixtures/typescript/math_spec2.ts index 54dd135..40da79f 100644 --- a/test/fixtures/math_spec2.ts +++ b/test/fixtures/typescript/math_spec2.ts @@ -5,7 +5,7 @@ const { add } = math const x: number = 3 -context('math.ts', function () { +context('math.ts 2', function () { it('imports function', () => { expect(add, 'add').to.be.a('function') }) diff --git a/test/fixtures/typescript/test1.ts b/test/fixtures/typescript/test1.ts new file mode 100644 index 0000000..2b7cff4 --- /dev/null +++ b/test/fixtures/typescript/test1.ts @@ -0,0 +1 @@ +export const f = (a: number, b: number) => a + b \ No newline at end of file diff --git a/test/fixtures/typescript/test2.ts b/test/fixtures/typescript/test2.ts new file mode 100644 index 0000000..c5f4061 --- /dev/null +++ b/test/fixtures/typescript/test2.ts @@ -0,0 +1 @@ +export const g = (a: number, b: number, c: number) => a + b + c \ No newline at end of file diff --git a/test/fixtures/typescript/test3.ts b/test/fixtures/typescript/test3.ts new file mode 100644 index 0000000..f53de83 --- /dev/null +++ b/test/fixtures/typescript/test3.ts @@ -0,0 +1 @@ +export const message: string = `I love you` \ No newline at end of file diff --git a/test/fixtures/typescript/test4.tsx b/test/fixtures/typescript/test4.tsx new file mode 100644 index 0000000..1c0c31f --- /dev/null +++ b/test/fixtures/typescript/test4.tsx @@ -0,0 +1,5 @@ +export default () => { + return ( +
Hello world
+ ) +} \ No newline at end of file From bc1c8c90843a55beee356f8db8947ac777000296 Mon Sep 17 00:00:00 2001 From: Chris Breiding Date: Fri, 3 Apr 2020 10:35:19 -0400 Subject: [PATCH 10/18] remove enzyme --- package-lock.json | 580 +---------------------- package.json | 2 - test/e2e/e2e_spec.js | 6 +- test/fixtures/typescript/enzyme_spec.tsx | 16 - test/fixtures/typescript/react_spec.tsx | 14 + 5 files changed, 17 insertions(+), 601 deletions(-) delete mode 100644 test/fixtures/typescript/enzyme_spec.tsx create mode 100644 test/fixtures/typescript/react_spec.tsx diff --git a/package-lock.json b/package-lock.json index 5cf1f06..1dd5b47 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1608,24 +1608,6 @@ "indent-string": "^3.2.0" } }, - "airbnb-prop-types": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/airbnb-prop-types/-/airbnb-prop-types-2.15.0.tgz", - "integrity": "sha512-jUh2/hfKsRjNFC4XONQrxo/n/3GG4Tn6Hl0WlFQN5PY9OMC9loSCoAYKnZsWaP8wEfd5xcrPloK0Zg6iS1xwVA==", - "dev": true, - "requires": { - "array.prototype.find": "^2.1.0", - "function.prototype.name": "^1.1.1", - "has": "^1.0.3", - "is-regex": "^1.0.4", - "object-is": "^1.0.1", - "object.assign": "^4.1.0", - "object.entries": "^1.1.0", - "prop-types": "^15.7.2", - "prop-types-exact": "^1.2.0", - "react-is": "^16.9.0" - } - }, "ajv": { "version": "6.10.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz", @@ -1810,26 +1792,6 @@ "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=" }, - "array.prototype.find": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/array.prototype.find/-/array.prototype.find-2.1.1.tgz", - "integrity": "sha512-mi+MYNJYLTx2eNYy+Yh6raoQacCsNeeMUaspFPh9Y141lFSsWxxB8V9mM2ye+eqiRs917J6/pJ4M9ZPzenWckA==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.4" - } - }, - "array.prototype.flat": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.3.tgz", - "integrity": "sha512-gBlRZV0VSmfPIeWfuuy56XZMvbVfbEUnOXUvt3F/eUUUSyzlgLxhEX4YAEpxNAogRGehPSnfXyPtYyKAhkzQhQ==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1" - } - }, "arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", @@ -2072,12 +2034,6 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" }, - "boolbase": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", - "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", - "dev": true - }, "boom": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", @@ -2595,31 +2551,6 @@ "integrity": "sha1-FCD/sQ/URNz8ebQ4kbv//TKoRgA=", "dev": true }, - "cheerio": { - "version": "1.0.0-rc.3", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.3.tgz", - "integrity": "sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA==", - "dev": true, - "requires": { - "css-select": "~1.2.0", - "dom-serializer": "~0.1.1", - "entities": "~1.1.1", - "htmlparser2": "^3.9.1", - "lodash": "^4.15.0", - "parse5": "^3.0.1" - }, - "dependencies": { - "parse5": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz", - "integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==", - "dev": true, - "requires": { - "@types/node": "*" - } - } - } - }, "chokidar": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.1.tgz", @@ -3346,7 +3277,8 @@ "version": "2.20.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", - "dev": true + "dev": true, + "optional": true }, "common-tags": { "version": "1.8.0", @@ -3644,24 +3576,6 @@ "integrity": "sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=", "dev": true }, - "css-select": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", - "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", - "dev": true, - "requires": { - "boolbase": "~1.0.0", - "css-what": "2.1", - "domutils": "1.5.1", - "nth-check": "~1.0.1" - } - }, - "css-what": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz", - "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==", - "dev": true - }, "currently-unhandled": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", @@ -3989,12 +3903,6 @@ "path-type": "^3.0.0" } }, - "discontinuous-range": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/discontinuous-range/-/discontinuous-range-1.0.0.tgz", - "integrity": "sha1-44Mx8IRLukm5qctxx3FYWqsbxlo=", - "dev": true - }, "disparity": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/disparity/-/disparity-3.0.0.tgz", @@ -4047,46 +3955,11 @@ "esutils": "^2.0.2" } }, - "dom-serializer": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", - "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==", - "dev": true, - "requires": { - "domelementtype": "^1.3.0", - "entities": "^1.1.1" - } - }, "domain-browser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==" }, - "domelementtype": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", - "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", - "dev": true - }, - "domhandler": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", - "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", - "dev": true, - "requires": { - "domelementtype": "1" - } - }, - "domutils": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", - "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", - "dev": true, - "requires": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, "dot-prop": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", @@ -4144,12 +4017,6 @@ "once": "^1.4.0" } }, - "entities": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", - "dev": true - }, "env-ci": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/env-ci/-/env-ci-3.2.2.tgz", @@ -4186,93 +4053,6 @@ } } }, - "enzyme": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/enzyme/-/enzyme-3.11.0.tgz", - "integrity": "sha512-Dw8/Gs4vRjxY6/6i9wU0V+utmQO9kvh9XLnz3LIudviOnVYDEe2ec+0k+NQoMamn1VrjKgCUOWj5jG/5M5M0Qw==", - "dev": true, - "requires": { - "array.prototype.flat": "^1.2.3", - "cheerio": "^1.0.0-rc.3", - "enzyme-shallow-equal": "^1.0.1", - "function.prototype.name": "^1.1.2", - "has": "^1.0.3", - "html-element-map": "^1.2.0", - "is-boolean-object": "^1.0.1", - "is-callable": "^1.1.5", - "is-number-object": "^1.0.4", - "is-regex": "^1.0.5", - "is-string": "^1.0.5", - "is-subset": "^0.1.1", - "lodash.escape": "^4.0.1", - "lodash.isequal": "^4.5.0", - "object-inspect": "^1.7.0", - "object-is": "^1.0.2", - "object.assign": "^4.1.0", - "object.entries": "^1.1.1", - "object.values": "^1.1.1", - "raf": "^3.4.1", - "rst-selector-parser": "^2.2.3", - "string.prototype.trim": "^1.2.1" - } - }, - "enzyme-adapter-react-16": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.15.2.tgz", - "integrity": "sha512-SkvDrb8xU3lSxID8Qic9rB8pvevDbLybxPK6D/vW7PrT0s2Cl/zJYuXvsd1EBTz0q4o3iqG3FJhpYz3nUNpM2Q==", - "dev": true, - "requires": { - "enzyme-adapter-utils": "^1.13.0", - "enzyme-shallow-equal": "^1.0.1", - "has": "^1.0.3", - "object.assign": "^4.1.0", - "object.values": "^1.1.1", - "prop-types": "^15.7.2", - "react-is": "^16.12.0", - "react-test-renderer": "^16.0.0-0", - "semver": "^5.7.0" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, - "enzyme-adapter-utils": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/enzyme-adapter-utils/-/enzyme-adapter-utils-1.13.0.tgz", - "integrity": "sha512-YuEtfQp76Lj5TG1NvtP2eGJnFKogk/zT70fyYHXK2j3v6CtuHqc8YmgH/vaiBfL8K1SgVVbQXtTcgQZFwzTVyQ==", - "dev": true, - "requires": { - "airbnb-prop-types": "^2.15.0", - "function.prototype.name": "^1.1.2", - "object.assign": "^4.1.0", - "object.fromentries": "^2.0.2", - "prop-types": "^15.7.2", - "semver": "^5.7.1" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, - "enzyme-shallow-equal": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/enzyme-shallow-equal/-/enzyme-shallow-equal-1.0.1.tgz", - "integrity": "sha512-hGA3i1so8OrYOZSM9whlkNmVHOicJpsjgTzC+wn2JMJXhq1oO4kA4bJ5MsfzSIcC71aLDKzJ6gZpIxrqt3QTAQ==", - "dev": true, - "requires": { - "has": "^1.0.3", - "object-is": "^1.0.2" - } - }, "error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -4282,36 +4062,6 @@ "is-arrayish": "^0.2.1" } }, - "es-abstract": { - "version": "1.17.5", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.5.tgz", - "integrity": "sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.1.5", - "is-regex": "^1.0.5", - "object-inspect": "^1.7.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.0", - "string.prototype.trimleft": "^2.1.1", - "string.prototype.trimright": "^2.1.1" - } - }, - "es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, "es6-promise": { "version": "4.2.4", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.4.tgz", @@ -5173,29 +4923,12 @@ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, - "function.prototype.name": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.2.tgz", - "integrity": "sha512-C8A+LlHBJjB2AdcRPorc5JvJ5VUoWlXdEHLOJdCI7kjHEtGTpHQUiqMvCIKUwIsGwZX2jZJy761AXsn356bJQg==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "functions-have-names": "^1.2.0" - } - }, "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", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, - "functions-have-names": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.1.tgz", - "integrity": "sha512-j48B/ZI7VKs3sgeI2cZp7WXWmZXu7Iq5pl5/vptV5N2mq+DGFuS/ulaDjtaoLpYzuD6u8UgrUKHfgo7fDTSiBA==", - "dev": true - }, "get-assigned-identifiers": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/get-assigned-identifiers/-/get-assigned-identifiers-1.2.0.tgz", @@ -5619,55 +5352,11 @@ "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", "dev": true }, - "html-element-map": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/html-element-map/-/html-element-map-1.2.0.tgz", - "integrity": "sha512-0uXq8HsuG1v2TmQ8QkIhzbrqeskE4kn52Q18QJ9iAA/SnHoEKXWiUxHQtclRsCFWEUD2So34X+0+pZZu862nnw==", - "dev": true, - "requires": { - "array-filter": "^1.0.0" - }, - "dependencies": { - "array-filter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-1.0.0.tgz", - "integrity": "sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=", - "dev": true - } - } - }, "htmlescape": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/htmlescape/-/htmlescape-1.1.1.tgz", "integrity": "sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E=" }, - "htmlparser2": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", - "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", - "dev": true, - "requires": { - "domelementtype": "^1.3.1", - "domhandler": "^2.3.0", - "domutils": "^1.5.1", - "entities": "^1.1.1", - "inherits": "^2.0.1", - "readable-stream": "^3.1.1" - }, - "dependencies": { - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } - } - }, "http-proxy-agent": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz", @@ -6119,12 +5808,6 @@ "binary-extensions": "^1.0.0" } }, - "is-boolean-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.0.1.tgz", - "integrity": "sha512-TqZuVwa/sppcrhUCAYkGBk7w0yxfQQnxq28fjkO53tnK9FQXmdwz2JS5+GjsWQ6RByES1K40nI+yDic5c9/aAQ==", - "dev": true - }, "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", @@ -6139,12 +5822,6 @@ "builtin-modules": "^1.0.0" } }, - "is-callable": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", - "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==", - "dev": true - }, "is-ci": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", @@ -6162,12 +5839,6 @@ "kind-of": "^3.0.2" } }, - "is-date-object": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", - "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", - "dev": true - }, "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", @@ -6242,12 +5913,6 @@ "kind-of": "^3.0.2" } }, - "is-number-object": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.4.tgz", - "integrity": "sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw==", - "dev": true - }, "is-obj": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", @@ -6296,15 +5961,6 @@ "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=", "dev": true }, - "is-regex": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", - "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", - "dev": true, - "requires": { - "has": "^1.0.3" - } - }, "is-relative": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", @@ -6326,27 +5982,12 @@ "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, - "is-string": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", - "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", - "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-symbol": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", - "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", - "dev": true, - "requires": { - "has-symbols": "^1.0.1" - } - }, "is-text-path": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz", @@ -6633,36 +6274,18 @@ "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=" }, - "lodash.escape": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-4.0.1.tgz", - "integrity": "sha1-yQRGkMIeBClL6qUXcS/e0fqI3pg=", - "dev": true - }, "lodash.escaperegexp": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz", "integrity": "sha1-ZHYsSGGAglGKw99Mz11YhtriA0c=", "dev": true }, - "lodash.flattendeep": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", - "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", - "dev": true - }, "lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", "dev": true }, - "lodash.isequal": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", - "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=", - "dev": true - }, "lodash.isplainobject": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", @@ -7122,12 +6745,6 @@ "moment": ">= 2.9.0" } }, - "moo": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.1.tgz", - "integrity": "sha512-I1mnb5xn4fO80BH9BLcF0yLypy2UKl+Cb01Fu0hJRkJjlCRtxZMWkTdAtDd5ZqCOxtCkhmRwyI57vWT+1iZ67w==", - "dev": true - }, "ms": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", @@ -7180,19 +6797,6 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "nearley": { - "version": "2.19.1", - "resolved": "https://registry.npmjs.org/nearley/-/nearley-2.19.1.tgz", - "integrity": "sha512-xq47GIUGXxU9vQg7g/y1o1xuKnkO7ev4nRWqftmQrLkfnE/FjRqDaGOUakM8XHPn/6pW3bGjU2wgoJyId90rqg==", - "dev": true, - "requires": { - "commander": "^2.19.0", - "moo": "^0.5.0", - "railroad-diagrams": "^1.0.0", - "randexp": "0.4.6", - "semver": "^5.4.1" - } - }, "neo-async": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", @@ -10959,15 +10563,6 @@ } } }, - "nth-check": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", - "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==", - "dev": true, - "requires": { - "boolbase": "~1.0.0" - } - }, "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", @@ -10999,18 +10594,6 @@ } } }, - "object-inspect": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", - "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", - "dev": true - }, - "object-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.0.2.tgz", - "integrity": "sha512-Epah+btZd5wrrfjkJZq1AOB9O6OxUQto45hzFd7lXGrpHPGE0W1k+426yrZV+k6NJOzLNNW/nVsmZdIWsAqoOQ==", - "dev": true - }, "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -11042,30 +10625,6 @@ "object-keys": "^1.0.11" } }, - "object.entries": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.1.tgz", - "integrity": "sha512-ilqR7BgdyZetJutmDPfXCDffGa0/Yzl2ivVNpbx/g4UeWrCdRnFDUBrKJGLhGieRHDATnyZXWBeCb29k9CJysQ==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "function-bind": "^1.1.1", - "has": "^1.0.3" - } - }, - "object.fromentries": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.2.tgz", - "integrity": "sha512-r3ZiBH7MQppDJVLx6fhD618GKNG40CZYH9wgwdhKxBDDbQgjeWGGd4AtkZad84d291YxvWe7bJGuE65Anh0dxQ==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "function-bind": "^1.1.1", - "has": "^1.0.3" - } - }, "object.pick": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", @@ -11081,18 +10640,6 @@ } } }, - "object.values": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.1.tgz", - "integrity": "sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "function-bind": "^1.1.1", - "has": "^1.0.3" - } - }, "octokit-pagination-methods": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz", @@ -11496,12 +11043,6 @@ "sha.js": "^2.4.8" } }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "dev": true - }, "pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", @@ -11672,17 +11213,6 @@ "react-is": "^16.8.1" } }, - "prop-types-exact": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/prop-types-exact/-/prop-types-exact-1.2.0.tgz", - "integrity": "sha512-K+Tk3Kd9V0odiXFP9fwDHUYRyvK3Nun3GVyPapSIs5OBkITAm15W0CPFD/YKTkMUAbc0b9CUwRQp2ybiBIq+eA==", - "dev": true, - "requires": { - "has": "^1.0.3", - "object.assign": "^4.1.0", - "reflect.ownkeys": "^0.2.0" - } - }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -11750,37 +11280,12 @@ "integrity": "sha1-EIOSF/bBNiuJGUBE0psjP9fzLwE=", "dev": true }, - "raf": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz", - "integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==", - "dev": true, - "requires": { - "performance-now": "^2.1.0" - } - }, - "railroad-diagrams": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz", - "integrity": "sha1-635iZ1SN3t+4mcG5Dlc3RVnN234=", - "dev": true - }, "ramda": { "version": "0.25.0", "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.25.0.tgz", "integrity": "sha512-GXpfrYVPwx3K7RQ6aYT8KPS8XViSXUVJT1ONhoKPE9VAleW42YE+U+8VEyGWt41EnEQW7gwecYJriTI0pKoecQ==", "dev": true }, - "randexp": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/randexp/-/randexp-0.4.6.tgz", - "integrity": "sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ==", - "dev": true, - "requires": { - "discontinuous-range": "1.0.0", - "ret": "~0.1.10" - } - }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -11847,18 +11352,6 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", "dev": true }, - "react-test-renderer": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-16.13.1.tgz", - "integrity": "sha512-Sn2VRyOK2YJJldOqoh8Tn/lWQ+ZiKhyZTPtaO0Q6yNj+QDbmRkVFap6pZPy3YQk8DScRDfyqm/KxKYP9gCMRiQ==", - "dev": true, - "requires": { - "object-assign": "^4.1.1", - "prop-types": "^15.6.2", - "react-is": "^16.8.6", - "scheduler": "^0.19.1" - } - }, "read-installed": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/read-installed/-/read-installed-4.0.3.tgz", @@ -11982,12 +11475,6 @@ "esprima": "~4.0.0" } }, - "reflect.ownkeys": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/reflect.ownkeys/-/reflect.ownkeys-0.2.0.tgz", - "integrity": "sha1-dJrO7H8/34tj+SegSAnpDFwLNGA=", - "dev": true - }, "regenerate": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", @@ -12187,16 +11674,6 @@ "inherits": "^2.0.1" } }, - "rst-selector-parser": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/rst-selector-parser/-/rst-selector-parser-2.2.3.tgz", - "integrity": "sha1-gbIw6i/MYGbInjRy3nlChdmwPZE=", - "dev": true, - "requires": { - "lodash.flattendeep": "^4.4.0", - "nearley": "^2.7.10" - } - }, "run-async": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", @@ -13169,59 +12646,6 @@ "strip-ansi": "^3.0.0" } }, - "string.prototype.trim": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.1.tgz", - "integrity": "sha512-MjGFEeqixw47dAMFMtgUro/I0+wNqZB5GKXGt1fFr24u3TzDXCPu7J9Buppzoe3r/LqkSDLDDJzE15RGWDGAVw==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "function-bind": "^1.1.1" - } - }, - "string.prototype.trimend": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.0.tgz", - "integrity": "sha512-EEJnGqa/xNfIg05SxiPSqRS7S9qwDhYts1TSLR1BQfYUfPe1stofgGKvwERK9+9yf+PpfBMlpBaCHucXGPQfUA==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" - } - }, - "string.prototype.trimleft": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.2.tgz", - "integrity": "sha512-gCA0tza1JBvqr3bfAIFJGqfdRTyPae82+KTnm3coDXkZN9wnuW3HjGgN386D7hfv5CHQYCI022/rJPVlqXyHSw==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5", - "string.prototype.trimstart": "^1.0.0" - } - }, - "string.prototype.trimright": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.2.tgz", - "integrity": "sha512-ZNRQ7sY3KroTaYjRS6EbNiiHrOkjihL9aQE/8gfQ4DtAC/aEBRHFJa44OmoWxGGqXuJlfKkZW4WcXErGr+9ZFg==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5", - "string.prototype.trimend": "^1.0.0" - } - }, - "string.prototype.trimstart": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.0.tgz", - "integrity": "sha512-iCP8g01NFYiiBOnwG1Xc3WZLyoo+RuBymwIlWncShXDDJYWN6DbnM3odslBJdgCdRlq94B5s63NWAZlcn2CS4w==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" - } - }, "string_decoder": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.2.0.tgz", diff --git a/package.json b/package.json index 796a68c..5f948f6 100644 --- a/package.json +++ b/package.json @@ -44,8 +44,6 @@ "chokidar-cli": "1.2.2", "dependency-check": "3.3.0", "deps-ok": "1.4.1", - "enzyme": "3.11.0", - "enzyme-adapter-react-16": "1.15.2", "eslint": "5.13.0", "eslint-plugin-cypress-dev": "2.0.0", "eslint-plugin-mocha": "5.3.0", diff --git a/test/e2e/e2e_spec.js b/test/e2e/e2e_spec.js index d6ee8a4..a1af762 100644 --- a/test/e2e/e2e_spec.js +++ b/test/e2e/e2e_spec.js @@ -44,11 +44,7 @@ describe('typescript', function () { }) it('handles .tsx file when the path is given', function () { - // This test loads many packages like react, enzyme. - // Because of that, we need more time. - this.timeout(10000) - - return bundle('typescript/enzyme_spec.tsx', { + return bundle('typescript/react_spec.tsx', { typescript: require.resolve('typescript'), }).then((output) => { // check that bundled tests work diff --git a/test/fixtures/typescript/enzyme_spec.tsx b/test/fixtures/typescript/enzyme_spec.tsx deleted file mode 100644 index e1fec3e..0000000 --- a/test/fixtures/typescript/enzyme_spec.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import React from 'react'; -import { expect } from 'chai'; -import Enzyme from 'enzyme'; -import { shallow } from 'enzyme'; -import Adapter from 'enzyme-adapter-react-16'; - -Enzyme.configure({ adapter: new Adapter() }); - -import MyComponent from './component'; - -describe('', () => { - it('renders an `.icon-star`', () => { - const wrapper = shallow(); - expect(wrapper.find('.icon-star')).to.have.lengthOf(1); - }); -}); \ No newline at end of file diff --git a/test/fixtures/typescript/react_spec.tsx b/test/fixtures/typescript/react_spec.tsx new file mode 100644 index 0000000..c976152 --- /dev/null +++ b/test/fixtures/typescript/react_spec.tsx @@ -0,0 +1,14 @@ +import React from 'react' +import { expect } from 'chai' + +import MyComponent from './component' + +describe('', () => { + it('renders an `.icon-star`', () => { + const component = + + expect(component.type().type).to.equal('div') + expect(component.type().props.className).to.equal('icon-star') + expect(component.type().props.children).to.equal('icon') + }) +}) From 31778724c740d07aef15bbf66e1887628a63527b Mon Sep 17 00:00:00 2001 From: Chris Breiding Date: Fri, 3 Apr 2020 10:35:39 -0400 Subject: [PATCH 11/18] use arrow function syntax --- test/e2e/e2e_spec.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test/e2e/e2e_spec.js b/test/e2e/e2e_spec.js index a1af762..097f803 100644 --- a/test/e2e/e2e_spec.js +++ b/test/e2e/e2e_spec.js @@ -8,7 +8,7 @@ const preprocessor = require('../../index') /* eslint-disable-next-line no-unused-vars */ const expect = chai.expect -beforeEach(function () { +beforeEach(() => { fs.removeSync(path.join(__dirname, '_test-output')) }) @@ -25,16 +25,16 @@ const bundle = (fixtureName, options = DEFAULT_OPTIONS) => { }) } -describe('browserify preprocessor - e2e', function () { - it('correctly preprocesses the file', function () { +describe('browserify preprocessor - e2e', () => { + it('correctly preprocesses the file', () => { return bundle('example_spec.js').then((output) => { snapshot(output) }) }) }) -describe('typescript', function () { - it('handles .ts file when the path is given', function () { +describe('typescript', () => { + it('handles .ts file when the path is given', () => { return bundle('typescript/math_spec.ts', { typescript: require.resolve('typescript'), }).then((output) => { @@ -43,7 +43,7 @@ describe('typescript', function () { }) }) - it('handles .tsx file when the path is given', function () { + it('handles .tsx file when the path is given', () => { return bundle('typescript/react_spec.tsx', { typescript: require.resolve('typescript'), }).then((output) => { @@ -70,8 +70,8 @@ describe('typescript', function () { }) }) - describe('throws errors when typescript path and tsify are given together', function () { - it('plugin', function () { + describe('throws errors when typescript path and tsify are given together', () => { + it('plugin', () => { expect(() => bundle('typescript/test1.ts', { browserifyOptions: { plugin: ['tsify'], @@ -80,7 +80,7 @@ describe('typescript', function () { })).to.throw('Please only do one or the other.') }) - it('transform', function () { + it('transform', () => { expect(() => bundle('typescript/test2.ts', { browserifyOptions: { transform: [ @@ -92,8 +92,8 @@ describe('typescript', function () { }) }) - describe('typescript transpile failure', function () { - it('cannot handle .ts file when the path is not given', function () { + describe('typescript transpile failure', () => { + it('cannot handle .ts file when the path is not given', () => { return bundle('typescript/test3.ts') .then(() => { expect(true).to.eq('should not be here') @@ -103,7 +103,7 @@ describe('typescript', function () { }) }) - it('cannot handle .tsx file when the path is not given', function () { + it('cannot handle .tsx file when the path is not given', () => { return bundle('typescript/test4.tsx') .then(() => { expect(true).to.eq('should not be here') From 098d3bcaf7ee64276d82c234504d2eb21a6d4bd3 Mon Sep 17 00:00:00 2001 From: Chris Breiding Date: Fri, 3 Apr 2020 10:43:35 -0400 Subject: [PATCH 12/18] move files into lib directory --- index.js | 4 ++-- fs.js => lib/fs.js | 0 simple_tsify.js => lib/simple_tsify.js | 0 test/e2e/e2e_spec.js | 2 +- test/unit/index_spec.js | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename fs.js => lib/fs.js (100%) rename simple_tsify.js => lib/simple_tsify.js (100%) diff --git a/index.js b/index.js index f806e53..6d0d618 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,7 @@ const path = require('path') const Promise = require('bluebird') -const fs = require('./fs') +const fs = require('./lib/fs') const cloneDeep = require('lodash.clonedeep') const browserify = require('browserify') @@ -95,7 +95,7 @@ const getBrowserifyOptions = (entry, userBrowserifyOptions = {}, typescriptPath browserifyOptions.transform = transform.filter(([name]) => !name.includes('babelify')) // add typescript compiler browserifyOptions.transform.push([ - path.join(__dirname, './simple_tsify'), { + path.join(__dirname, './lib/simple_tsify'), { typescript: require(typescriptPath), }, ]) diff --git a/fs.js b/lib/fs.js similarity index 100% rename from fs.js rename to lib/fs.js diff --git a/simple_tsify.js b/lib/simple_tsify.js similarity index 100% rename from simple_tsify.js rename to lib/simple_tsify.js diff --git a/test/e2e/e2e_spec.js b/test/e2e/e2e_spec.js index 097f803..c6c9d71 100644 --- a/test/e2e/e2e_spec.js +++ b/test/e2e/e2e_spec.js @@ -2,7 +2,7 @@ const chai = require('chai') const path = require('path') const snapshot = require('snap-shot-it') -const fs = require('../../fs') +const fs = require('../../lib/fs') const preprocessor = require('../../index') /* eslint-disable-next-line no-unused-vars */ diff --git a/test/unit/index_spec.js b/test/unit/index_spec.js index 6c23487..fabe2cb 100644 --- a/test/unit/index_spec.js +++ b/test/unit/index_spec.js @@ -23,7 +23,7 @@ const streamApi = { streamApi.on = sandbox.stub().returns(streamApi) -const fs = require('../../fs') +const fs = require('../../lib/fs') const preprocessor = require('../../index') describe('browserify preprocessor', function () { From 02a44efde6a510966878bfc96a569dccf5ace027 Mon Sep 17 00:00:00 2001 From: Chris Breiding Date: Fri, 3 Apr 2020 10:44:04 -0400 Subject: [PATCH 13/18] remove duplicate file --- test/e2e/e2e_spec.js | 2 +- test/fixtures/typescript/math_spec2.ts | 18 ------------------ 2 files changed, 1 insertion(+), 19 deletions(-) delete mode 100644 test/fixtures/typescript/math_spec2.ts diff --git a/test/e2e/e2e_spec.js b/test/e2e/e2e_spec.js index c6c9d71..62c3a1b 100644 --- a/test/e2e/e2e_spec.js +++ b/test/e2e/e2e_spec.js @@ -55,7 +55,7 @@ describe('typescript', () => { it('babelify is removed even if it is not the last item', () => { const { browserifyOptions } = preprocessor.defaultOptions - return bundle('typescript/math_spec2.ts', { + return bundle('typescript/math_spec.ts', { browserifyOptions: { ...browserifyOptions, transform: [ diff --git a/test/fixtures/typescript/math_spec2.ts b/test/fixtures/typescript/math_spec2.ts deleted file mode 100644 index 40da79f..0000000 --- a/test/fixtures/typescript/math_spec2.ts +++ /dev/null @@ -1,18 +0,0 @@ -// math exports default object -// so if we want a property, first we need to grab the default -import math from './math' -const { add } = math - -const x: number = 3 - -context('math.ts 2', function () { - it('imports function', () => { - expect(add, 'add').to.be.a('function') - }) - it('can add numbers', function () { - expect(add(1, 2)).to.eq(3) - }) - it('test ts-typed variable', function () { - expect(x).to.eq(3) - }) -}) From b1c5d43d97719ed12d4747a53ca4470bde0f55b4 Mon Sep 17 00:00:00 2001 From: Chris Breiding Date: Fri, 3 Apr 2020 10:54:41 -0400 Subject: [PATCH 14/18] remove need to extra test files --- index.js | 8 ++++++++ test/e2e/e2e_spec.js | 15 +++++++++------ test/e2e/output.js | 0 test/fixtures/typescript/test1.ts | 1 - test/fixtures/typescript/test2.ts | 1 - test/fixtures/typescript/test3.ts | 1 - test/fixtures/typescript/test4.tsx | 5 ----- 7 files changed, 17 insertions(+), 14 deletions(-) delete mode 100644 test/e2e/output.js delete mode 100644 test/fixtures/typescript/test1.ts delete mode 100644 test/fixtures/typescript/test2.ts delete mode 100644 test/fixtures/typescript/test3.ts delete mode 100644 test/fixtures/typescript/test4.tsx diff --git a/index.js b/index.js index 6d0d618..0f6b208 100644 --- a/index.js +++ b/index.js @@ -242,4 +242,12 @@ const preprocessor = (options = {}) => { // provide a clone of the default options preprocessor.defaultOptions = JSON.parse(JSON.stringify(defaultOptions)) +if (process.env.__TESTING__) { + preprocessor.reset = () => { + for (let filePath in bundles) { + delete bundles[filePath] + } + } +} + module.exports = preprocessor diff --git a/test/e2e/e2e_spec.js b/test/e2e/e2e_spec.js index 62c3a1b..558c8f1 100644 --- a/test/e2e/e2e_spec.js +++ b/test/e2e/e2e_spec.js @@ -2,6 +2,8 @@ const chai = require('chai') const path = require('path') const snapshot = require('snap-shot-it') +process.env.__TESTING__ = true + const fs = require('../../lib/fs') const preprocessor = require('../../index') @@ -10,6 +12,7 @@ const expect = chai.expect beforeEach(() => { fs.removeSync(path.join(__dirname, '_test-output')) + preprocessor.reset() }) // do not generate source maps by default @@ -72,7 +75,7 @@ describe('typescript', () => { describe('throws errors when typescript path and tsify are given together', () => { it('plugin', () => { - expect(() => bundle('typescript/test1.ts', { + expect(() => bundle('typescript/math_spec.ts', { browserifyOptions: { plugin: ['tsify'], }, @@ -81,7 +84,7 @@ describe('typescript', () => { }) it('transform', () => { - expect(() => bundle('typescript/test2.ts', { + expect(() => bundle('typescript/math_spec.ts', { browserifyOptions: { transform: [ ['path/to/tsify', {}], @@ -94,9 +97,9 @@ describe('typescript', () => { describe('typescript transpile failure', () => { it('cannot handle .ts file when the path is not given', () => { - return bundle('typescript/test3.ts') + return bundle('typescript/math_spec.ts') .then(() => { - expect(true).to.eq('should not be here') + throw new Error('Should reject with error and not resolve') }) .catch((err) => { expect(err.message).to.include('\'import\' and \'export\' may appear only with \'sourceType: module\'') @@ -104,9 +107,9 @@ describe('typescript', () => { }) it('cannot handle .tsx file when the path is not given', () => { - return bundle('typescript/test4.tsx') + return bundle('typescript/component.tsx') .then(() => { - expect(true).to.eq('should not be here') + throw new Error('Should reject with error and not resolve') }) .catch((err) => { expect(err.message).to.include('\'import\' and \'export\' may appear only with \'sourceType: module\'') diff --git a/test/e2e/output.js b/test/e2e/output.js deleted file mode 100644 index e69de29..0000000 diff --git a/test/fixtures/typescript/test1.ts b/test/fixtures/typescript/test1.ts deleted file mode 100644 index 2b7cff4..0000000 --- a/test/fixtures/typescript/test1.ts +++ /dev/null @@ -1 +0,0 @@ -export const f = (a: number, b: number) => a + b \ No newline at end of file diff --git a/test/fixtures/typescript/test2.ts b/test/fixtures/typescript/test2.ts deleted file mode 100644 index c5f4061..0000000 --- a/test/fixtures/typescript/test2.ts +++ /dev/null @@ -1 +0,0 @@ -export const g = (a: number, b: number, c: number) => a + b + c \ No newline at end of file diff --git a/test/fixtures/typescript/test3.ts b/test/fixtures/typescript/test3.ts deleted file mode 100644 index f53de83..0000000 --- a/test/fixtures/typescript/test3.ts +++ /dev/null @@ -1 +0,0 @@ -export const message: string = `I love you` \ No newline at end of file diff --git a/test/fixtures/typescript/test4.tsx b/test/fixtures/typescript/test4.tsx deleted file mode 100644 index 1c0c31f..0000000 --- a/test/fixtures/typescript/test4.tsx +++ /dev/null @@ -1,5 +0,0 @@ -export default () => { - return ( -
Hello world
- ) -} \ No newline at end of file From f548957c43ade2986811163cc65664a1609aa4d0 Mon Sep 17 00:00:00 2001 From: Chris Breiding Date: Fri, 3 Apr 2020 11:13:24 -0400 Subject: [PATCH 15/18] update error message --- index.js | 10 +++++++++- test/e2e/e2e_spec.js | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 0f6b208..abb76fc 100644 --- a/index.js +++ b/index.js @@ -87,7 +87,15 @@ const getBrowserifyOptions = (entry, userBrowserifyOptions = {}, typescriptPath const hastsifyPlugin = browserifyOptions.plugin.includes('tsify') if (hasTsifyTransform || hastsifyPlugin) { - throw new Error('We see you passed the typescript option and also passed a browserify transform for TypeScript. Please only do one or the other.') + const type = hasTsifyTransform ? 'transform' : 'plugin' + + throw new Error(`It looks like you passed the 'typescript' option and also specified a browserify ${type} for TypeScript. This may cause conflicts. + +Please do one of the following: + + 1) Pass in the 'typescript' option and omit the browserify ${type} (Recommmended) + 2) Omit the 'typescript' option and continue to use your own browserify ${type} +`) } browserifyOptions.extensions.push('.ts', '.tsx') diff --git a/test/e2e/e2e_spec.js b/test/e2e/e2e_spec.js index 558c8f1..2a93c2f 100644 --- a/test/e2e/e2e_spec.js +++ b/test/e2e/e2e_spec.js @@ -80,7 +80,7 @@ describe('typescript', () => { plugin: ['tsify'], }, typescript: require.resolve('typescript'), - })).to.throw('Please only do one or the other.') + })).to.throw('This may cause conflicts') }) it('transform', () => { @@ -91,7 +91,7 @@ describe('typescript', () => { ], }, typescript: require.resolve('typescript'), - })).to.throw('Please only do one or the other.') + })).to.throw('This may cause conflicts') }) }) From 6927035f65a8a8621acfb10448a0564bfed3b09a Mon Sep 17 00:00:00 2001 From: Chris Breiding Date: Fri, 3 Apr 2020 11:56:14 -0400 Subject: [PATCH 16/18] move e2e tests to unit tests --- test/e2e/e2e_spec.js | 62 --------------------------- test/unit/index_spec.js | 93 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 90 insertions(+), 65 deletions(-) diff --git a/test/e2e/e2e_spec.js b/test/e2e/e2e_spec.js index 2a93c2f..dd6f1f9 100644 --- a/test/e2e/e2e_spec.js +++ b/test/e2e/e2e_spec.js @@ -54,68 +54,6 @@ describe('typescript', () => { eval(output) }) }) - - it('babelify is removed even if it is not the last item', () => { - const { browserifyOptions } = preprocessor.defaultOptions - - return bundle('typescript/math_spec.ts', { - browserifyOptions: { - ...browserifyOptions, - transform: [ - browserifyOptions.transform[1], - browserifyOptions.transform[0], - ], - }, - typescript: require.resolve('typescript'), - }).then((output) => { - // check that bundled tests work - eval(output) - }) - }) - - describe('throws errors when typescript path and tsify are given together', () => { - it('plugin', () => { - expect(() => bundle('typescript/math_spec.ts', { - browserifyOptions: { - plugin: ['tsify'], - }, - typescript: require.resolve('typescript'), - })).to.throw('This may cause conflicts') - }) - - it('transform', () => { - expect(() => bundle('typescript/math_spec.ts', { - browserifyOptions: { - transform: [ - ['path/to/tsify', {}], - ], - }, - typescript: require.resolve('typescript'), - })).to.throw('This may cause conflicts') - }) - }) - - describe('typescript transpile failure', () => { - it('cannot handle .ts file when the path is not given', () => { - return bundle('typescript/math_spec.ts') - .then(() => { - throw new Error('Should reject with error and not resolve') - }) - .catch((err) => { - expect(err.message).to.include('\'import\' and \'export\' may appear only with \'sourceType: module\'') - }) - }) - - it('cannot handle .tsx file when the path is not given', () => { - return bundle('typescript/component.tsx') - .then(() => { - throw new Error('Should reject with error and not resolve') - }) - .catch((err) => { - expect(err.message).to.include('\'import\' and \'export\' may appear only with \'sourceType: module\'') - }) - }) - }) }) describe('imports and exports', () => { diff --git a/test/unit/index_spec.js b/test/unit/index_spec.js index fabe2cb..f3f07cb 100644 --- a/test/unit/index_spec.js +++ b/test/unit/index_spec.js @@ -23,6 +23,8 @@ const streamApi = { streamApi.on = sandbox.stub().returns(streamApi) +process.env.__TESTING__ = true + const fs = require('../../lib/fs') const preprocessor = require('../../index') @@ -46,7 +48,6 @@ describe('browserify preprocessor', function () { on: sandbox.stub(), } sandbox.stub(fs, 'createWriteStream').returns(this.createWriteStreamApi) - sandbox.stub(fs, 'ensureDirAsync').resolves() this.options = {} @@ -75,8 +76,8 @@ describe('browserify preprocessor', function () { }) describe('preprocessor function', function () { - afterEach(function () { - this.file.on.withArgs('close').yield() // resets the cached bundles + beforeEach(function () { + preprocessor.reset() }) describe('when it finishes cleanly', function () { @@ -351,5 +352,91 @@ describe('browserify preprocessor', function () { }) }) }) + + describe('typescript support', function () { + beforeEach(function () { + this.options.typescript = require.resolve('typescript') + }) + + it('adds tsify transform', function () { + this.createWriteStreamApi.on.withArgs('finish').yields() + + return this.run().then(() => { + expect(browserify.lastCall.args[0].transform[1][0]).to.include('simple_tsify') + }) + }) + + it('adds to extensions', function () { + this.createWriteStreamApi.on.withArgs('finish').yields() + + return this.run().then(() => { + expect(browserify.lastCall.args[0].extensions).to.eql(['.js', '.jsx', '.coffee', '.ts', '.tsx']) + }) + }) + + it('removes babelify transform', function () { + this.createWriteStreamApi.on.withArgs('finish').yields() + + return this.run().then(() => { + const transforms = browserify.lastCall.args[0].transform + + expect(transforms).to.have.length(2) + expect(transforms[1][0]).not.to.include('babelify') + }) + }) + + it('does not change browserify options without typescript option', function () { + this.createWriteStreamApi.on.withArgs('finish').yields() + + this.options.typescript = undefined + + return this.run().then(() => { + expect(browserify.lastCall.args[0].transform[1][0]).to.include('babelify') + expect(browserify.lastCall.args[0].transform[1][0]).not.to.include('simple_tsify') + expect(browserify.lastCall.args[0].extensions).to.eql(['.js', '.jsx', '.coffee']) + }) + }) + + it('removes babelify transform even if it is not the last item', function () { + this.createWriteStreamApi.on.withArgs('finish').yields() + + const { browserifyOptions } = preprocessor.defaultOptions + + this.options.browserifyOptions = { + ...browserifyOptions, + transform: [ + browserifyOptions.transform[1], + browserifyOptions.transform[0], + ], + } + + return this.run().then(() => { + const transforms = browserify.lastCall.args[0].transform + + expect(transforms).to.have.length(2) + expect(transforms[1][0]).not.to.include('babelify') + }) + }) + + describe('when typescript path and tsify are given together', function () { + it('throws error when it is a plugin', function () { + this.options.browserifyOptions = { + plugin: ['tsify'], + } + + expect(this.run).to.throw('This may cause conflicts') + }) + + it('throws error when it is a transform', function () { + this.options.browserifyOptions = { + transform: [ + ['path/to/tsify', {}], + ], + } + + expect(this.run).to.throw('This may cause conflicts') + }) + }) + }) }) }) From c0cc19110fadea1598c6e15dae48154fe11231f3 Mon Sep 17 00:00:00 2001 From: Chris Breiding Date: Fri, 3 Apr 2020 11:57:25 -0400 Subject: [PATCH 17/18] properly nest e2e tests --- test/e2e/e2e_spec.js | 104 +++++++++++++++++++++---------------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/test/e2e/e2e_spec.js b/test/e2e/e2e_spec.js index dd6f1f9..2145be3 100644 --- a/test/e2e/e2e_spec.js +++ b/test/e2e/e2e_spec.js @@ -34,74 +34,74 @@ describe('browserify preprocessor - e2e', () => { snapshot(output) }) }) -}) -describe('typescript', () => { - it('handles .ts file when the path is given', () => { - return bundle('typescript/math_spec.ts', { - typescript: require.resolve('typescript'), - }).then((output) => { - // check that bundled tests work - eval(output) + describe('imports and exports', () => { + it('handles imports and exports', () => { + return bundle('math_spec.js').then((output) => { + // check that bundled tests work + eval(output) + }) }) - }) - it('handles .tsx file when the path is given', () => { - return bundle('typescript/react_spec.tsx', { - typescript: require.resolve('typescript'), - }).then((output) => { - // check that bundled tests work - eval(output) + it('named ES6', () => { + return bundle('divide_spec.js').then((output) => { + // check that bundled tests work + eval(output) + }) }) - }) -}) -describe('imports and exports', () => { - it('handles imports and exports', () => { - return bundle('math_spec.js').then((output) => { - // check that bundled tests work - eval(output) - }) - }) - it('named ES6', () => { - return bundle('divide_spec.js').then((output) => { - // check that bundled tests work - eval(output) + it('handles module.exports and import', () => { + return bundle('sub_spec.js').then((output) => { + // check that bundled tests work + eval(output) + snapshot('sub import', output) + }) }) - }) + it('handles module.exports and default import', () => { + return bundle('mul_spec.js').then((output) => { + // check that bundled tests work + eval(output) + // for some reason, this bundle included full resolved path + // to interop require module + // which on CI generates different path. + // so as long as eval works, do not snapshot it + }) + }) - it('handles module.exports and import', () => { - return bundle('sub_spec.js').then((output) => { - // check that bundled tests work - eval(output) - snapshot('sub import', output) + it('handles default string import', () => { + return bundle('dom_spec.js').then((output) => { + // check that bundled tests work + eval(output) + }) }) - }) - it('handles module.exports and default import', () => { - return bundle('mul_spec.js').then((output) => { - // check that bundled tests work - eval(output) - // for some reason, this bundle included full resolved path - // to interop require module - // which on CI generates different path. - // so as long as eval works, do not snapshot it + it('handles non-top-level require', () => { + return bundle('require_spec.js').then((output) => { + // check that bundled tests work + eval(output) + }) }) }) - it('handles default string import', () => { - return bundle('dom_spec.js').then((output) => { - // check that bundled tests work - eval(output) + describe('typescript', () => { + it('handles .ts file when the path is given', () => { + return bundle('typescript/math_spec.ts', { + typescript: require.resolve('typescript'), + }).then((output) => { + // check that bundled tests work + eval(output) + }) }) - }) - it('handles non-top-level require', () => { - return bundle('require_spec.js').then((output) => { - // check that bundled tests work - eval(output) + it('handles .tsx file when the path is given', () => { + return bundle('typescript/react_spec.tsx', { + typescript: require.resolve('typescript'), + }).then((output) => { + // check that bundled tests work + eval(output) + }) }) }) }) From f3afccd92f3fc343f951b181490c641a50d34e45 Mon Sep 17 00:00:00 2001 From: Chris Breiding Date: Fri, 3 Apr 2020 14:42:05 -0400 Subject: [PATCH 18/18] make it clear where error is coming from --- index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index abb76fc..ab2f349 100644 --- a/index.js +++ b/index.js @@ -89,12 +89,14 @@ const getBrowserifyOptions = (entry, userBrowserifyOptions = {}, typescriptPath if (hasTsifyTransform || hastsifyPlugin) { const type = hasTsifyTransform ? 'transform' : 'plugin' - throw new Error(`It looks like you passed the 'typescript' option and also specified a browserify ${type} for TypeScript. This may cause conflicts. + throw new Error(`Error running @cypress/browserify-preprocessor: + +It looks like you passed the 'typescript' option and also specified a browserify ${type} for TypeScript. This may cause conflicts. Please do one of the following: - 1) Pass in the 'typescript' option and omit the browserify ${type} (Recommmended) - 2) Omit the 'typescript' option and continue to use your own browserify ${type} +1) Pass in the 'typescript' option and omit the browserify ${type} (Recommmended) +2) Omit the 'typescript' option and continue to use your own browserify ${type} `) }