From f7b08ec5c14f647caff6a3dee49bdfa57eff3371 Mon Sep 17 00:00:00 2001 From: Fabian Wiles Date: Tue, 28 Aug 2018 06:52:19 +1200 Subject: [PATCH 1/4] feat(cypress_test): introduce rule --- defs.bzl | 2 + examples/integration/BUILD.bazel | 12 + examples/integration/another.spec.ts | 5 + examples/integration/index.spec.ts | 5 + internal/cypress_test/BUILD.bazel | 21 + internal/cypress_test/cypress_runner.js | 47 ++ internal/cypress_test/cypress_test.bzl | 62 +++ package.json | 1 + yarn.lock | 711 +++++++++++++++++++++++- 9 files changed, 848 insertions(+), 18 deletions(-) create mode 100644 examples/integration/BUILD.bazel create mode 100644 examples/integration/another.spec.ts create mode 100644 examples/integration/index.spec.ts create mode 100644 internal/cypress_test/BUILD.bazel create mode 100644 internal/cypress_test/cypress_runner.js create mode 100644 internal/cypress_test/cypress_test.bzl diff --git a/defs.bzl b/defs.bzl index aa3bafb9..d50dfe01 100644 --- a/defs.bzl +++ b/defs.bzl @@ -24,6 +24,7 @@ load("//internal/karma:ts_web_test.bzl", _ts_web_test = "ts_web_test_macro", _ts_web_test_suite = "ts_web_test_suite") load("//internal/protobufjs:ts_proto_library.bzl", _ts_proto_library = "ts_proto_library") +load("//internal/cypress_test:cypress_test.bzl", _cypress_test = "cypress_test") ts_setup_workspace = _ts_setup_workspace ts_library = _ts_library @@ -35,3 +36,4 @@ ts_web_test_suite = _ts_web_test_suite ts_proto_library = _ts_proto_library # DO NOT ADD MORE rules here unless they appear in the generated docsite. # Run yarn skydoc to re-generate the docsite. +cypress_test = _cypress_test diff --git a/examples/integration/BUILD.bazel b/examples/integration/BUILD.bazel new file mode 100644 index 00000000..1c394cd2 --- /dev/null +++ b/examples/integration/BUILD.bazel @@ -0,0 +1,12 @@ +load("//:defs.bzl", "ts_library", "cypress_test") + +ts_library( + name = "test_lib", + srcs = [":index.spec.ts", "another.spec.ts"], +) + +cypress_test( + name = "test", + deps = [":test_lib"], + srcs = [] +) diff --git a/examples/integration/another.spec.ts b/examples/integration/another.spec.ts new file mode 100644 index 00000000..b07a41f2 --- /dev/null +++ b/examples/integration/another.spec.ts @@ -0,0 +1,5 @@ +describe('My First Test', function() { + it('Does not do much!', function() { + (expect(true) as any).to.equal(true) + }) +}) \ No newline at end of file diff --git a/examples/integration/index.spec.ts b/examples/integration/index.spec.ts new file mode 100644 index 00000000..b07a41f2 --- /dev/null +++ b/examples/integration/index.spec.ts @@ -0,0 +1,5 @@ +describe('My First Test', function() { + it('Does not do much!', function() { + (expect(true) as any).to.equal(true) + }) +}) \ No newline at end of file diff --git a/internal/cypress_test/BUILD.bazel b/internal/cypress_test/BUILD.bazel new file mode 100644 index 00000000..a7d2f83b --- /dev/null +++ b/internal/cypress_test/BUILD.bazel @@ -0,0 +1,21 @@ +# Copyright 2017 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +package(default_visibility = ["//visibility:public"]) + +exports_files([ + "cypress_runner.js", + # Exported to be consumed for generating skydoc. + "cypress_test.bzl", +]) diff --git a/internal/cypress_test/cypress_runner.js b/internal/cypress_test/cypress_runner.js new file mode 100644 index 00000000..17b2d925 --- /dev/null +++ b/internal/cypress_test/cypress_runner.js @@ -0,0 +1,47 @@ +const fs = require('fs'); +const path = require('path'); +const cypress = require('cypress'); + +const UTF8 = { + encoding: 'utf-8' +}; + +// These exit codes are handled specially by Bazel: +// https://github.com/bazelbuild/bazel/blob/486206012a664ecb20bdb196a681efc9a9825049/src/main/java/com/google/devtools/build/lib/util/ExitCode.java#L44 +const BAZEL_EXIT_TESTS_FAILED = 3; +const BAZEL_EXIT_NO_TESTS_FOUND = 4; + +// Set the StackTraceLimit to infinity. This will make stack capturing slower, but more useful. +// Since we are running tests having proper stack traces is very useful and should be always set to +// the maximum (See: https://nodejs.org/api/errors.html#errors_error_stacktracelimit) +Error.stackTraceLimit = Infinity; + +function main(args) { + if (!args.length) { + throw new Error('Spec file manifest expected argument missing'); + } + const manifest = require.resolve(args[0]); + const specLocations = fs.readFileSync(manifest, UTF8).split('\n').filter(p =>p.length > 0).map(f => { + return require.resolve(f) + }); + + const specs = specLocations.filter(f => f.endsWith('spec.js')) + // console.log(specs) +// console.log(process.env) +// console.log(specLocations) + const cypressJsonSettings = {integrationFolder: 'integration', video: false, screenshots: false,} + fs.writeFileSync('../../../cypress.json', JSON.stringify()) + console.log(process.cwd()); + console.log(specs[0]) + // console.log(path.relative('.', specs[0])) + + cypress.run({ + project: '../../../', + spec: specs + }); + +} + +if (require.main === module) { + process.exitCode = main(process.argv.slice(2)); +} \ No newline at end of file diff --git a/internal/cypress_test/cypress_test.bzl b/internal/cypress_test/cypress_test.bzl new file mode 100644 index 00000000..ea04f0b7 --- /dev/null +++ b/internal/cypress_test/cypress_test.bzl @@ -0,0 +1,62 @@ +# Copyright 2017 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""NodeJS testing + +These rules let you run tests outside of a browser. This is typically faster +than launching a test in Karma, for example. +""" +load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_test") +load("@build_bazel_rules_nodejs//internal/common:devmode_js_sources.bzl", "devmode_js_sources") + +def cypress_test( + name, + srcs = [], + data = [], + deps = [], + expected_exit_code = 0, + **kwargs): + """Runs tests in NodeJS using the Jasmine test runner. + + To debug the test, see debugging notes in `nodejs_test`. + + Args: + name: name of the resulting label + srcs: JavaScript source files containing Jasmine specs + data: Runtime dependencies which will be loaded while the test executes + deps: Other targets which produce JavaScript, such as ts_library + expected_exit_code: The expected exit code for the test. Defaults to 0. + **kwargs: remaining arguments are passed to the test rule + """ + devmode_js_sources( + name = "%s_devmode_srcs" % name, + deps = srcs + deps, + # testonly = 1, + ) + + all_data = data + srcs + deps + all_data += [Label("//internal/cypress_test:cypress_runner.js")] + all_data += [":%s_devmode_srcs.MF" % name] + # all_data += [Label("@bazel_tools//tools/bash/runfiles")] + entry_point = "build_bazel_rules_typescript/internal/cypress_test/cypress_runner.js" + + nodejs_test( + name = name, + data = all_data, + entry_point = entry_point, + templated_args = ["$(location :%s_devmode_srcs.MF)" % name], + # testonly = 1, + expected_exit_code = expected_exit_code, + **kwargs + ) diff --git a/package.json b/package.json index 6d9788a4..bd9a19ee 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "typescript": ">=2.4.2" }, "dependencies": { + "cypress": "^3.1.0", "protobufjs": "5.0.0", "tsickle": "0.25.x", "tsutils": "2.20.0" diff --git a/yarn.lock b/yarn.lock index 9c52425b..000e0358 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6,14 +6,73 @@ version "0.2.0" resolved "https://registry.yarnpkg.com/@bazel/ibazel/-/ibazel-0.2.0.tgz#c119aef4344a789cef5e792caaee52264123e71c" +"@cypress/listr-verbose-renderer@0.4.1": + version "0.4.1" + resolved "https://registry.yarnpkg.com/@cypress/listr-verbose-renderer/-/listr-verbose-renderer-0.4.1.tgz#a77492f4b11dcc7c446a34b3e28721afd33c642a" + dependencies: + chalk "^1.1.3" + cli-cursor "^1.0.2" + date-fns "^1.27.2" + figures "^1.7.0" + +"@cypress/xvfb@1.2.3": + version "1.2.3" + resolved "https://registry.yarnpkg.com/@cypress/xvfb/-/xvfb-1.2.3.tgz#6319afdcdcff7d1505daeeaa84484d0596189860" + dependencies: + debug "^3.1.0" + lodash.once "^4.1.1" + +"@types/blob-util@1.3.3": + version "1.3.3" + resolved "https://registry.yarnpkg.com/@types/blob-util/-/blob-util-1.3.3.tgz#adba644ae34f88e1dd9a5864c66ad651caaf628a" + +"@types/bluebird@3.5.18": + version "3.5.18" + resolved "https://registry.yarnpkg.com/@types/bluebird/-/bluebird-3.5.18.tgz#6a60435d4663e290f3709898a4f75014f279c4d6" + +"@types/chai-jquery@1.1.35": + version "1.1.35" + resolved "https://registry.yarnpkg.com/@types/chai-jquery/-/chai-jquery-1.1.35.tgz#9a8f0a39ec0851b2768a8f8c764158c2a2568d04" + dependencies: + "@types/chai" "*" + "@types/jquery" "*" + +"@types/chai@*": + version "4.1.4" + resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.1.4.tgz#5ca073b330d90b4066d6ce18f60d57f2084ce8ca" + +"@types/chai@4.0.8": + version "4.0.8" + resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.0.8.tgz#d27600e9ba2f371e08695d90a0fe0408d89c7be7" + "@types/jasmine@^2.8.2": version "2.8.2" resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.8.2.tgz#6ae4d8740c0da5d5a627df725b4eed71b8e36668" +"@types/jquery@*": + version "3.3.6" + resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-3.3.6.tgz#5932ead926307ca21e5b36808257f7c926b06565" + +"@types/jquery@3.2.16": + version "3.2.16" + resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-3.2.16.tgz#04419c404a3194350e7d3f339a90e72c88db3111" + +"@types/lodash@4.14.87": + version "4.14.87" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.87.tgz#55f92183b048c2c64402afe472f8333f4e319a6b" + "@types/long@^4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.0.tgz#719551d2352d301ac8b81db732acb6bdc28dbdef" +"@types/minimatch@3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" + +"@types/mocha@2.2.44": + version "2.2.44" + resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.44.tgz#1d4a798e53f35212fd5ad4d04050620171cd5b5e" + "@types/node@7.0.18": version "7.0.18" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.18.tgz#cd67f27d3dc0cfb746f0bdd5e086c4c5d55be173" @@ -30,6 +89,21 @@ version "2.53.43" resolved "https://registry.yarnpkg.com/@types/selenium-webdriver/-/selenium-webdriver-2.53.43.tgz#2de3d718819bc20165754c4a59afb7e9833f6707" +"@types/sinon-chai@2.7.29": + version "2.7.29" + resolved "https://registry.yarnpkg.com/@types/sinon-chai/-/sinon-chai-2.7.29.tgz#4db01497e2dd1908b2bd30d1782f456353f5f723" + dependencies: + "@types/chai" "*" + "@types/sinon" "*" + +"@types/sinon@*": + version "5.0.1" + resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-5.0.1.tgz#a15b36ec42f1f53166617491feabd1734cb03e21" + +"@types/sinon@4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-4.0.0.tgz#9a93ffa4ee1329e85166278a5ed99f81dc4c8362" + "@types/source-map@^0.5.1": version "0.5.1" resolved "https://registry.yarnpkg.com/@types/source-map/-/source-map-0.5.1.tgz#7e74db5d06ab373a712356eebfaea2fad0ea2367" @@ -62,6 +136,10 @@ ajv@^5.1.0: fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.3.0" +ansi-escapes@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" + ansi-regex@^0.2.0, ansi-regex@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-0.2.1.tgz#0d8e946967a3d8143f93e24e298525fc1b2235f9" @@ -78,6 +156,12 @@ ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" +ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + dependencies: + color-convert "^1.9.0" + array-union@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" @@ -107,6 +191,12 @@ assert-plus@1.0.0, assert-plus@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" +async@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/async/-/async-2.4.0.tgz#4990200f18ea5b837c2cc4f8c031a6985c385611" + dependencies: + lodash "^4.14.0" + async@^1.5.2: version "1.5.2" resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" @@ -123,6 +213,13 @@ aws4@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" +babel-runtime@^6.18.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.11.0" + balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" @@ -139,6 +236,10 @@ blocking-proxy@0.0.5: dependencies: minimist "^1.2.0" +bluebird@3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.0.tgz#791420d7f551eea2897453a8a77653f96606d67c" + boom@4.x.x: version "4.3.1" resolved "https://registry.yarnpkg.com/boom/-/boom-4.3.1.tgz#4f8a3005cb4a7e3889f749030fd25b96e01d2e31" @@ -158,12 +259,22 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" +buffer-crc32@~0.2.3: + version "0.2.13" + resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" + bytebuffer@~5: version "5.0.1" resolved "https://registry.yarnpkg.com/bytebuffer/-/bytebuffer-5.0.1.tgz#582eea4b1a873b6d020a48d58df85f0bba6cfddd" dependencies: long "~3" +cachedir@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/cachedir/-/cachedir-1.3.0.tgz#5e01928bf2d95b5edd94b0942188246740e0dbc4" + dependencies: + os-homedir "^1.0.1" + camelcase@^2.0.1: version "2.1.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" @@ -182,7 +293,15 @@ chalk@0.5.1: strip-ansi "^0.3.0" supports-color "^0.2.0" -chalk@^1.1.1, chalk@^1.1.3: +chalk@2.4.1, chalk@^2.0.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" dependencies: @@ -192,6 +311,14 @@ chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" +check-more-types@2.24.0: + version "2.24.0" + resolved "https://registry.yarnpkg.com/check-more-types/-/check-more-types-2.24.0.tgz#1420ffb10fd444dcfc79b43891bbfffd32a84600" + +ci-info@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.4.0.tgz#4841d53cad49f11b827b648ebde27a6e189b412f" + clang-format@1.0.49: version "1.0.49" resolved "https://registry.yarnpkg.com/clang-format/-/clang-format-1.0.49.tgz#bf52f42277d41ed3618591f87145acf64aceb7e6" @@ -200,6 +327,23 @@ clang-format@1.0.49: glob "^7.0.0" resolve "^1.1.6" +cli-cursor@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" + dependencies: + restore-cursor "^1.0.1" + +cli-spinners@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-0.1.2.tgz#bb764d88e185fb9e1e6a2a1f19772318f605e31c" + +cli-truncate@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-0.2.1.tgz#9f15cfbb0705005369216c626ac7d05ab90dd574" + dependencies: + slice-ansi "0.0.4" + string-width "^1.0.1" + cliui@^3.0.3: version "3.2.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" @@ -216,6 +360,16 @@ code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" +color-convert@^1.9.0: + version "1.9.2" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.2.tgz#49881b8fba67df12a96bdf3f56c0aab9e7913147" + dependencies: + color-name "1.1.1" + +color-name@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.1.tgz#4b1415304cf50028ea81643643bd82ea05803689" + colors@1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b" @@ -230,14 +384,32 @@ combined-stream@^1.0.5, combined-stream@~1.0.5: dependencies: delayed-stream "~1.0.0" +commander@2.11.0: + version "2.11.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" + commander@2.6.0: version "2.6.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.6.0.tgz#9df7e52fb2a0cb0fb89058ee80c3104225f37e1d" +common-tags@1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.4.0.tgz#1187be4f3d4cf0c0427d43f74eef1f73501614c0" + dependencies: + babel-runtime "^6.18.0" + concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" +concat-stream@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" + dependencies: + inherits "^2.0.3" + readable-stream "^2.2.2" + typedarray "^0.0.6" + concurrently@^3.5.1: version "3.5.1" resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-3.5.1.tgz#ee8b60018bbe86b02df13e5249453c6ececd2521" @@ -251,6 +423,10 @@ concurrently@^3.5.1: supports-color "^3.2.3" tree-kill "^1.1.0" +core-js@^2.4.0: + version "2.5.7" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.7.tgz#f972608ff0cead68b841a16a932d0b183791814e" + core-js@~2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.3.0.tgz#fab83fbb0b2d8dc85fa636c4b9d34c75420c6d65" @@ -263,29 +439,84 @@ corser@~2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/corser/-/corser-2.0.1.tgz#8eda252ecaab5840dcd975ceb90d9370c819ff87" +cross-spawn@^6.0.0: + version "6.0.5" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + dependencies: + nice-try "^1.0.4" + path-key "^2.0.1" + semver "^5.5.0" + shebang-command "^1.2.0" + which "^1.2.9" + cryptiles@3.x.x: version "3.1.2" resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-3.1.2.tgz#a89fbb220f5ce25ec56e8c4aa8a4fd7b5b0d29fe" dependencies: boom "5.x.x" +cypress@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-3.1.0.tgz#b718ba64289b887c7ab7a7f09245d871a4a409ba" + dependencies: + "@cypress/listr-verbose-renderer" "0.4.1" + "@cypress/xvfb" "1.2.3" + "@types/blob-util" "1.3.3" + "@types/bluebird" "3.5.18" + "@types/chai" "4.0.8" + "@types/chai-jquery" "1.1.35" + "@types/jquery" "3.2.16" + "@types/lodash" "4.14.87" + "@types/minimatch" "3.0.3" + "@types/mocha" "2.2.44" + "@types/sinon" "4.0.0" + "@types/sinon-chai" "2.7.29" + bluebird "3.5.0" + cachedir "1.3.0" + chalk "2.4.1" + check-more-types "2.24.0" + commander "2.11.0" + common-tags "1.4.0" + debug "3.1.0" + execa "0.10.0" + executable "4.1.1" + extract-zip "1.6.6" + fs-extra "4.0.1" + getos "3.1.0" + glob "7.1.2" + is-ci "1.0.10" + is-installed-globally "0.1.0" + lazy-ass "1.6.0" + listr "0.12.0" + lodash "4.17.10" + log-symbols "2.2.0" + minimist "1.2.0" + progress "1.1.8" + ramda "0.24.1" + request "2.87.0" + request-progress "0.3.1" + supports-color "5.1.0" + tmp "0.0.31" + url "0.11.0" + yauzl "2.8.0" + dashdash@^1.12.0: version "1.14.1" resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" dependencies: assert-plus "^1.0.0" -date-fns@^1.23.0: +date-fns@^1.23.0, date-fns@^1.27.2: version "1.29.0" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6" -debug@2, debug@^2.2.0: +debug@2, debug@2.6.9, debug@^2.2.0: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" dependencies: ms "2.0.0" -debug@^3.1.0: +debug@3.1.0, debug@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" dependencies: @@ -326,11 +557,15 @@ ecstatic@^3.0.0: minimist "^1.1.0" url-join "^2.0.2" +elegant-spinner@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" + es6-promise@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.0.2.tgz#010d5858423a5f118979665f46486a95c6ee2bb6" -escape-string-regexp@^1.0.0, escape-string-regexp@^1.0.2: +escape-string-regexp@^1.0.0, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -338,6 +573,28 @@ eventemitter3@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.0.tgz#090b4d6cdbd645ed10bf750d4b5407942d7ba163" +execa@0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.10.0.tgz#ff456a8f53f90f8eccc71a96d11bdfc7f082cb50" + dependencies: + cross-spawn "^6.0.0" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + +executable@4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/executable/-/executable-4.1.1.tgz#41532bff361d3e57af4d763b70582db18f5d133c" + dependencies: + pify "^2.2.0" + +exit-hook@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" + exit@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" @@ -346,6 +603,15 @@ extend@3, extend@~3.0.0, extend@~3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" +extract-zip@1.6.6: + version "1.6.6" + resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-1.6.6.tgz#1290ede8d20d0872b429fd3f351ca128ec5ef85c" + dependencies: + concat-stream "1.6.0" + debug "2.6.9" + mkdirp "0.5.0" + yauzl "2.4.1" + extsprintf@1.3.0, extsprintf@^1.2.0: version "1.3.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" @@ -358,6 +624,19 @@ fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" +fd-slicer@~1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.0.1.tgz#8b5bcbd9ec327c5041bf9ab023fd6750f1177e65" + dependencies: + pend "~1.2.0" + +figures@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" + dependencies: + escape-string-regexp "^1.0.5" + object-assign "^4.1.0" + follow-redirects@^1.0.0: version "1.4.1" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.4.1.tgz#d8120f4518190f55aac65bb6fc7b85fcd666d6aa" @@ -376,37 +655,61 @@ form-data@~2.3.1: combined-stream "^1.0.5" mime-types "^2.1.12" +fs-extra@4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.1.tgz#7fc0c6c8957f983f57f306a24e5b9ddd8d0dd880" + dependencies: + graceful-fs "^4.1.2" + jsonfile "^3.0.0" + universalify "^0.1.0" + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" +get-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + +getos@3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/getos/-/getos-3.1.0.tgz#db3aa4df15a3295557ce5e81aa9e3e5cdfaa6567" + dependencies: + async "2.4.0" + getpass@^0.1.1: version "0.1.7" resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" dependencies: assert-plus "^1.0.0" -glob@^5.0.10: - version "5.0.15" - resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1" +glob@7.1.2, glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6: + version "7.1.2" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" dependencies: + fs.realpath "^1.0.0" inflight "^1.0.4" inherits "2" - minimatch "2 || 3" + minimatch "^3.0.4" once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6: - version "7.1.2" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" +glob@^5.0.10: + version "5.0.15" + resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1" dependencies: - fs.realpath "^1.0.0" inflight "^1.0.4" inherits "2" - minimatch "^3.0.4" + minimatch "2 || 3" once "^1.3.0" path-is-absolute "^1.0.0" +global-dirs@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-0.1.1.tgz#b319c0dd4607f353f3be9cca4c72fc148c49f445" + dependencies: + ini "^1.3.4" + globby@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" @@ -418,6 +721,10 @@ globby@^5.0.0: pify "^2.0.0" pinkie-promise "^2.0.0" +graceful-fs@^4.1.2, graceful-fs@^4.1.6: + version "4.1.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" + har-schema@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" @@ -445,6 +752,14 @@ has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" +has-flag@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + hawk@~6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/hawk/-/hawk-6.0.2.tgz#af4d914eb065f9b5ce4d9d11c1cb2126eecc3038" @@ -503,6 +818,16 @@ immediate@~3.0.5: version "3.0.6" resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" +indent-string@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80" + dependencies: + repeating "^2.0.0" + +indent-string@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-3.2.0.tgz#4a5fd6d27cc332f37e5419a504dbb837105c9289" + inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -510,7 +835,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@~2.0.1: +inherits@2, inherits@^2.0.3, inherits@~2.0.1, inherits@~2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" @@ -522,12 +847,31 @@ invert-kv@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" +is-ci@1.0.10: + version "1.0.10" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.0.10.tgz#f739336b2632365061a9d48270cd56ae3369318e" + dependencies: + ci-info "^1.0.0" + +is-finite@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" + dependencies: + number-is-nan "^1.0.0" + is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" dependencies: number-is-nan "^1.0.0" +is-installed-globally@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/is-installed-globally/-/is-installed-globally-0.1.0.tgz#0dfd98f5a9111716dd535dda6492f67bf3d25a80" + dependencies: + global-dirs "^0.1.0" + is-path-inside "^1.0.0" + is-path-cwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" @@ -544,6 +888,14 @@ is-path-inside@^1.0.0: dependencies: path-is-inside "^1.0.1" +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + +is-stream@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" @@ -552,6 +904,10 @@ isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" @@ -588,6 +944,12 @@ json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" +jsonfile@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-3.0.1.tgz#a5ecc6f65f53f662c4415c7675a0331d0992ec66" + optionalDependencies: + graceful-fs "^4.1.6" + jsprim@^1.2.2: version "1.4.1" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" @@ -607,6 +969,10 @@ jszip@^3.1.3: pako "~1.0.2" readable-stream "~2.0.6" +lazy-ass@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/lazy-ass/-/lazy-ass-1.6.0.tgz#7999655e8646c17f089fdd187d150d3324d54513" + lcid@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" @@ -619,10 +985,84 @@ lie@~3.1.0: dependencies: immediate "~3.0.5" +listr-silent-renderer@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz#924b5a3757153770bf1a8e3fbf74b8bbf3f9242e" + +listr-update-renderer@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/listr-update-renderer/-/listr-update-renderer-0.2.0.tgz#ca80e1779b4e70266807e8eed1ad6abe398550f9" + dependencies: + chalk "^1.1.3" + cli-truncate "^0.2.1" + elegant-spinner "^1.0.1" + figures "^1.7.0" + indent-string "^3.0.0" + log-symbols "^1.0.2" + log-update "^1.0.2" + strip-ansi "^3.0.1" + +listr-verbose-renderer@^0.4.0: + version "0.4.1" + resolved "https://registry.yarnpkg.com/listr-verbose-renderer/-/listr-verbose-renderer-0.4.1.tgz#8206f4cf6d52ddc5827e5fd14989e0e965933a35" + dependencies: + chalk "^1.1.3" + cli-cursor "^1.0.2" + date-fns "^1.27.2" + figures "^1.7.0" + +listr@0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/listr/-/listr-0.12.0.tgz#6bce2c0f5603fa49580ea17cd6a00cc0e5fa451a" + dependencies: + chalk "^1.1.3" + cli-truncate "^0.2.1" + figures "^1.7.0" + indent-string "^2.1.0" + is-promise "^2.1.0" + is-stream "^1.1.0" + listr-silent-renderer "^1.1.1" + listr-update-renderer "^0.2.0" + listr-verbose-renderer "^0.4.0" + log-symbols "^1.0.2" + log-update "^1.0.2" + ora "^0.2.3" + p-map "^1.1.1" + rxjs "^5.0.0-beta.11" + stream-to-observable "^0.1.0" + strip-ansi "^3.0.1" + +lodash.once@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac" + +lodash@4.17.10, lodash@^4.14.0: + version "4.17.10" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" + lodash@^4.5.1: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" +log-symbols@2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" + dependencies: + chalk "^2.0.1" + +log-symbols@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18" + dependencies: + chalk "^1.0.0" + +log-update@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/log-update/-/log-update-1.0.2.tgz#19929f64c4093d2d2e7075a1dad8af59c296b8d1" + dependencies: + ansi-escapes "^1.0.0" + cli-cursor "^1.0.2" + long@~3: version "3.2.0" resolved "https://registry.yarnpkg.com/long/-/long-3.2.0.tgz#d821b7138ca1cb581c172990ef14db200b5c474b" @@ -651,10 +1091,16 @@ minimist@0.0.8, minimist@~0.0.1: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" -minimist@^1.1.0, minimist@^1.2.0: +minimist@1.2.0, minimist@^1.1.0, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" +mkdirp@0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.0.tgz#1d73076a6df986cd9344e15e71fcc05a4c9abf12" + dependencies: + minimist "0.0.8" + mkdirp@0.5.x, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" @@ -665,6 +1111,16 @@ ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" +nice-try@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4" + +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + dependencies: + path-key "^2.0.0" + number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" @@ -673,7 +1129,7 @@ oauth-sign@~0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" -object-assign@^4.0.1: +object-assign@^4.0.1, object-assign@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -683,6 +1139,10 @@ once@^1.3.0: dependencies: wrappy "1" +onetime@^1.0.0: + version "1.1.0" + resolved "http://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" + opener@~1.4.0: version "1.4.3" resolved "https://registry.yarnpkg.com/opener/-/opener-1.4.3.tgz#5c6da2c5d7e5831e8ffa3964950f8d6674ac90b8" @@ -702,6 +1162,19 @@ optjs@~3.2.2: version "3.2.2" resolved "https://registry.yarnpkg.com/optjs/-/optjs-3.2.2.tgz#69a6ce89c442a44403141ad2f9b370bd5bb6f4ee" +ora@^0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/ora/-/ora-0.2.3.tgz#37527d220adcd53c39b73571d754156d5db657a4" + dependencies: + chalk "^1.1.1" + cli-cursor "^1.0.2" + cli-spinners "^0.1.2" + object-assign "^4.0.1" + +os-homedir@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + os-locale@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9" @@ -712,6 +1185,14 @@ os-tmpdir@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + +p-map@^1.1.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b" + pako@~1.0.2: version "1.0.6" resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.6.tgz#0101211baa70c4bca4a0f63f2206e97b7dfaf258" @@ -724,15 +1205,23 @@ path-is-inside@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" +path-key@^2.0.0, path-key@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + path-parse@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" +pend@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" + performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" -pify@^2.0.0: +pify@^2.0.0, pify@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -758,6 +1247,14 @@ process-nextick-args@~1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" +process-nextick-args@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" + +progress@1.1.8: + version "1.1.8" + resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" + protobufjs@5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-5.0.0.tgz#4223063233ea96ac063ca2b554035204db524fa1" @@ -787,6 +1284,10 @@ protractor@^5.2.0: webdriver-js-extender "^1.0.0" webdriver-manager "^12.0.6" +punycode@1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" + punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" @@ -803,6 +1304,26 @@ qs@~6.5.1: version "6.5.1" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" +querystring@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" + +ramda@0.24.1: + version "0.24.1" + resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.24.1.tgz#c3b7755197f35b8dc3502228262c4c91ddb6b857" + +readable-stream@^2.2.2: + version "2.3.6" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + readable-stream@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e" @@ -814,6 +1335,47 @@ readable-stream@~2.0.6: string_decoder "~0.10.x" util-deprecate "~1.0.1" +regenerator-runtime@^0.11.0: + version "0.11.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" + +repeating@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" + dependencies: + is-finite "^1.0.0" + +request-progress@0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/request-progress/-/request-progress-0.3.1.tgz#0721c105d8a96ac6b2ce8b2c89ae2d5ecfcf6b3a" + dependencies: + throttleit "~0.0.2" + +request@2.87.0: + version "2.87.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.87.0.tgz#32f00235cd08d482b4d0d68db93a829c0ed5756e" + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.6.0" + caseless "~0.12.0" + combined-stream "~1.0.5" + extend "~3.0.1" + forever-agent "~0.6.1" + form-data "~2.3.1" + har-validator "~5.0.3" + http-signature "~1.2.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.17" + oauth-sign "~0.8.2" + performance-now "^2.1.0" + qs "~6.5.1" + safe-buffer "^5.1.1" + tough-cookie "~2.3.3" + tunnel-agent "^0.6.0" + uuid "^3.1.0" + request@^2.78.0: version "2.83.0" resolved "https://registry.yarnpkg.com/request/-/request-2.83.0.tgz#ca0b65da02ed62935887808e6f510381034e3356" @@ -851,6 +1413,13 @@ resolve@^1.1.6: dependencies: path-parse "^1.0.5" +restore-cursor@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" + dependencies: + exit-hook "^1.0.0" + onetime "^1.0.0" + rimraf@^2.2.8, rimraf@^2.5.2, rimraf@^2.5.4: version "2.6.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" @@ -861,10 +1430,20 @@ rx@2.3.24: version "2.3.24" resolved "https://registry.yarnpkg.com/rx/-/rx-2.3.24.tgz#14f950a4217d7e35daa71bbcbe58eff68ea4b2b7" +rxjs@^5.0.0-beta.11: + version "5.5.11" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.11.tgz#f733027ca43e3bec6b994473be4ab98ad43ced87" + dependencies: + symbol-observable "1.0.1" + safe-buffer@^5.0.1, safe-buffer@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" +safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + saucelabs@~1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/saucelabs/-/saucelabs-1.3.0.tgz#d240e8009df7fa87306ec4578a69ba3b5c424fee" @@ -902,10 +1481,32 @@ semver@^5.3.0: version "5.4.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" +semver@^5.5.0: + version "5.5.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.1.tgz#7dfdd8814bdb7cabc7be0fb1d734cfb66c940477" + semver@~5.0.1: version "5.0.3" resolved "https://registry.yarnpkg.com/semver/-/semver-5.0.3.tgz#77466de589cd5d3c95f138aa78bc569a3cb5d27a" +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + dependencies: + shebang-regex "^1.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + +signal-exit@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + +slice-ansi@0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" + sntp@2.x.x: version "2.1.0" resolved "https://registry.yarnpkg.com/sntp/-/sntp-2.1.0.tgz#2c6cec14fedc2222739caf9b5c3d85d1cc5a2cc8" @@ -940,6 +1541,10 @@ sshpk@^1.7.0: jsbn "~0.1.0" tweetnacl "~0.14.0" +stream-to-observable@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/stream-to-observable/-/stream-to-observable-0.1.0.tgz#45bf1d9f2d7dc09bed81f1c307c430e68b84cffe" + string-width@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" @@ -952,6 +1557,12 @@ string_decoder@~0.10.x: version "0.10.31" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + dependencies: + safe-buffer "~5.1.0" + stringstream@~0.0.5: version "0.0.5" resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" @@ -968,6 +1579,16 @@ strip-ansi@^3.0.0, strip-ansi@^3.0.1: dependencies: ansi-regex "^2.0.0" +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + +supports-color@5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.1.0.tgz#058a021d1b619f7ddf3980d712ea3590ce7de3d5" + dependencies: + has-flag "^2.0.0" + supports-color@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-0.2.0.tgz#d92de2694eb3f67323973d7ae3d8b55b4c22190a" @@ -982,6 +1603,20 @@ supports-color@^3.2.3: dependencies: has-flag "^1.0.0" +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + dependencies: + has-flag "^3.0.0" + +symbol-observable@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4" + +throttleit@~0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/throttleit/-/throttleit-0.0.2.tgz#cfedf88e60c00dd9697b61fdd2a8343a9b680eaf" + tmp@0.0.24: version "0.0.24" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.24.tgz#d6a5e198d14a9835cc6f2d7c3d9e302428c8cf12" @@ -992,6 +1627,12 @@ tmp@0.0.30: dependencies: os-tmpdir "~1.0.1" +tmp@0.0.31: + version "0.0.31" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.31.tgz#8f38ab9438e17315e5dbd8b3657e8bfb277ae4a7" + dependencies: + os-tmpdir "~1.0.1" + tough-cookie@~2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.3.tgz#0b618a5565b6dea90bf3425d04d55edc475a7561" @@ -1031,6 +1672,10 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" +typedarray@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" + typescript@2.7.x: version "2.7.2" resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.7.2.tgz#2d615a1ef4aee4f574425cdff7026edf81919836" @@ -1045,10 +1690,21 @@ union@~0.4.3: dependencies: qs "~2.3.3" +universalify@^0.1.0: + version "0.1.2" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + url-join@^2.0.2: version "2.0.5" resolved "https://registry.yarnpkg.com/url-join/-/url-join-2.0.5.tgz#5af22f18c052a000a48d7b82c5e9c2e2feeda728" +url@0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" + dependencies: + punycode "1.3.2" + querystring "0.2.0" + util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" @@ -1088,6 +1744,12 @@ webdriver-manager@^12.0.6: semver "^5.3.0" xml2js "^0.4.17" +which@^1.2.9: + version "1.3.1" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" + dependencies: + isexe "^2.0.0" + window-size@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.4.tgz#f8e1aa1ee5a53ec5bf151ffa09742a6ad7697876" @@ -1147,3 +1809,16 @@ yargs@^3.10.0: string-width "^1.0.1" window-size "^0.1.4" y18n "^3.2.0" + +yauzl@2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.4.1.tgz#9528f442dab1b2284e58b4379bb194e22e0c4005" + dependencies: + fd-slicer "~1.0.1" + +yauzl@2.8.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.8.0.tgz#79450aff22b2a9c5a41ef54e02db907ccfbf9ee2" + dependencies: + buffer-crc32 "~0.2.3" + fd-slicer "~1.0.1" From 9be2701dc9322df74a1386704b29097799f2c453 Mon Sep 17 00:00:00 2001 From: Fabian Wiles Date: Sat, 1 Sep 2018 08:39:58 +1200 Subject: [PATCH 2/4] fixup! feat(cypress_test): introduce rule --- examples/integration/BUILD.bazel | 2 +- examples/integration/another.spec.ts | 5 --- examples/integration/index.spec.ts | 4 +- examples/tsconfig.json | 5 ++- internal/cypress_test/cypress_runner.js | 57 +++++++++++++++++++------ internal/cypress_test/cypress_test.bzl | 4 ++ 6 files changed, 54 insertions(+), 23 deletions(-) delete mode 100644 examples/integration/another.spec.ts diff --git a/examples/integration/BUILD.bazel b/examples/integration/BUILD.bazel index 1c394cd2..c030c425 100644 --- a/examples/integration/BUILD.bazel +++ b/examples/integration/BUILD.bazel @@ -2,7 +2,7 @@ load("//:defs.bzl", "ts_library", "cypress_test") ts_library( name = "test_lib", - srcs = [":index.spec.ts", "another.spec.ts"], + srcs = [":index.spec.ts"], ) cypress_test( diff --git a/examples/integration/another.spec.ts b/examples/integration/another.spec.ts deleted file mode 100644 index b07a41f2..00000000 --- a/examples/integration/another.spec.ts +++ /dev/null @@ -1,5 +0,0 @@ -describe('My First Test', function() { - it('Does not do much!', function() { - (expect(true) as any).to.equal(true) - }) -}) \ No newline at end of file diff --git a/examples/integration/index.spec.ts b/examples/integration/index.spec.ts index b07a41f2..19319f62 100644 --- a/examples/integration/index.spec.ts +++ b/examples/integration/index.spec.ts @@ -1,5 +1,5 @@ describe('My First Test', function() { - it('Does not do much!', function() { - (expect(true) as any).to.equal(true) + it('Visits the Kitchen Sink', function() { + cy.visit('https://example.cypress.io') }) }) \ No newline at end of file diff --git a/examples/tsconfig.json b/examples/tsconfig.json index 6b05f236..504ac185 100644 --- a/examples/tsconfig.json +++ b/examples/tsconfig.json @@ -5,7 +5,10 @@ // Include the output directory in rootDirs so that generated .d.ts files // can be used for type-checking in the editor, for example the car.proto // produces a car.d.ts. - "rootDirs": [".", "../bazel-bin/examples"] + "rootDirs": [".", "../bazel-bin/examples"], + "types": [ + "cypress" + ] } } diff --git a/internal/cypress_test/cypress_runner.js b/internal/cypress_test/cypress_runner.js index 17b2d925..92285f01 100644 --- a/internal/cypress_test/cypress_runner.js +++ b/internal/cypress_test/cypress_runner.js @@ -10,38 +10,67 @@ const UTF8 = { // https://github.com/bazelbuild/bazel/blob/486206012a664ecb20bdb196a681efc9a9825049/src/main/java/com/google/devtools/build/lib/util/ExitCode.java#L44 const BAZEL_EXIT_TESTS_FAILED = 3; const BAZEL_EXIT_NO_TESTS_FOUND = 4; +const IBAZEL_NOTIFY_BUILD_SUCCESS = 'IBAZEL_BUILD_COMPLETED SUCCESS'; +const IBAZEL_NOTIFY_CHANGES = 'IBAZEL_NOTIFY_CHANGES'; // Set the StackTraceLimit to infinity. This will make stack capturing slower, but more useful. // Since we are running tests having proper stack traces is very useful and should be always set to // the maximum (See: https://nodejs.org/api/errors.html#errors_error_stacktracelimit) Error.stackTraceLimit = Infinity; -function main(args) { +async function main(args) { if (!args.length) { throw new Error('Spec file manifest expected argument missing'); } const manifest = require.resolve(args[0]); + const exeRoot = path.dirname(manifest); + const specLocations = fs.readFileSync(manifest, UTF8).split('\n').filter(p =>p.length > 0).map(f => { return require.resolve(f) }); const specs = specLocations.filter(f => f.endsWith('spec.js')) - // console.log(specs) -// console.log(process.env) -// console.log(specLocations) - const cypressJsonSettings = {integrationFolder: 'integration', video: false, screenshots: false,} - fs.writeFileSync('../../../cypress.json', JSON.stringify()) - console.log(process.cwd()); - console.log(specs[0]) - // console.log(path.relative('.', specs[0])) - - cypress.run({ - project: '../../../', + + const cypressJsonSettings = {integrationFolder: '.', video: false, screenshots: false, supportFile: false} + fs.writeFileSync(path.join(exeRoot, 'cypress.json'), JSON.stringify(cypressJsonSettings)); + + const isIBazelMode = Boolean(process.env[IBAZEL_NOTIFY_CHANGES]); + + // we cant use open right now due to https://github.com/cypress-io/cypress/issues/1925 + if(isIBazelMode) { + await open(exeRoot, specs); + } else { + await run(exeRoot, specs); + } + +} + +async function run(configFilePath, specs) { + if(specs.length === 0) { + process.exit(BAZEL_EXIT_NO_TESTS_FOUND); + } + + const result = await cypress.run({ + project: configFilePath, spec: specs - }); + }); + + // if no tests failed then it's a pass + if(result.totalFailed > 0) { + process.exit(BAZEL_EXIT_TESTS_FAILED); + } else { + process.exit(0) + } } +function open(configFilePath, specs) { + cypress.open({ + project: configFilePath, + spec: specs + }); +} + if (require.main === module) { - process.exitCode = main(process.argv.slice(2)); + main(process.argv.slice(2)).catch(err => console.log(err)); } \ No newline at end of file diff --git a/internal/cypress_test/cypress_test.bzl b/internal/cypress_test/cypress_test.bzl index ea04f0b7..57fc4b81 100644 --- a/internal/cypress_test/cypress_test.bzl +++ b/internal/cypress_test/cypress_test.bzl @@ -25,6 +25,7 @@ def cypress_test( srcs = [], data = [], deps = [], + tags = [], expected_exit_code = 0, **kwargs): """Runs tests in NodeJS using the Jasmine test runner. @@ -50,9 +51,12 @@ def cypress_test( all_data += [":%s_devmode_srcs.MF" % name] # all_data += [Label("@bazel_tools//tools/bash/runfiles")] entry_point = "build_bazel_rules_typescript/internal/cypress_test/cypress_runner.js" + # disabled due to https://github.com/cypress-io/cypress/issues/1925 + # tags = tags + ["ibazel_notify_changes"] nodejs_test( name = name, + tags = tags, data = all_data, entry_point = entry_point, templated_args = ["$(location :%s_devmode_srcs.MF)" % name], From e664c44ae372e0efd8b758b930364ff318081f49 Mon Sep 17 00:00:00 2001 From: Fabian Wiles Date: Thu, 1 Nov 2018 10:01:42 +1300 Subject: [PATCH 3/4] try with a native rule instead --- examples/integration/index.spec.ts | 5 ++ examples/tsconfig.json | 3 - internal/cypress_test/cypress_test.bzl | 97 +++++++++++++++----------- 3 files changed, 62 insertions(+), 43 deletions(-) diff --git a/examples/integration/index.spec.ts b/examples/integration/index.spec.ts index 19319f62..84e68c7b 100644 --- a/examples/integration/index.spec.ts +++ b/examples/integration/index.spec.ts @@ -1,3 +1,8 @@ + +// declare let it: any; +// declare let describe: any; +declare let cy: any; + describe('My First Test', function() { it('Visits the Kitchen Sink', function() { cy.visit('https://example.cypress.io') diff --git a/examples/tsconfig.json b/examples/tsconfig.json index 504ac185..aac954d4 100644 --- a/examples/tsconfig.json +++ b/examples/tsconfig.json @@ -6,9 +6,6 @@ // can be used for type-checking in the editor, for example the car.proto // produces a car.d.ts. "rootDirs": [".", "../bazel-bin/examples"], - "types": [ - "cypress" - ] } } diff --git a/internal/cypress_test/cypress_test.bzl b/internal/cypress_test/cypress_test.bzl index 57fc4b81..5884349a 100644 --- a/internal/cypress_test/cypress_test.bzl +++ b/internal/cypress_test/cypress_test.bzl @@ -20,47 +20,64 @@ than launching a test in Karma, for example. load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_test") load("@build_bazel_rules_nodejs//internal/common:devmode_js_sources.bzl", "devmode_js_sources") -def cypress_test( - name, - srcs = [], - data = [], - deps = [], - tags = [], - expected_exit_code = 0, - **kwargs): - """Runs tests in NodeJS using the Jasmine test runner. +def _impl(ctx): + cypressjson_content = "{ \"integrationFolder\": \".\", \"video\": false, \"screenshots\": false, \"supportFile\": false }" + ctx.actions.write(output = ctx.outputs.cypressjson, content = cypressjson_content) - To debug the test, see debugging notes in `nodejs_test`. + files = depset(ctx.files.srcs) + for d in ctx.attr.deps: + if hasattr(d, "node_sources"): + files += d.node_sources + elif hasattr(d, "files"): + files += d.files - Args: - name: name of the resulting label - srcs: JavaScript source files containing Jasmine specs - data: Runtime dependencies which will be loaded while the test executes - deps: Other targets which produce JavaScript, such as ts_library - expected_exit_code: The expected exit code for the test. Defaults to 0. - **kwargs: remaining arguments are passed to the test rule - """ - devmode_js_sources( - name = "%s_devmode_srcs" % name, - deps = srcs + deps, - # testonly = 1, - ) + cypress_executable_path = ctx.executable.cypress.short_path + # if cypress_executable_path.startswith('..'): + # cypress_executable_path = "external" + cypress_executable_path[2:] - all_data = data + srcs + deps - all_data += [Label("//internal/cypress_test:cypress_runner.js")] - all_data += [":%s_devmode_srcs.MF" % name] - # all_data += [Label("@bazel_tools//tools/bash/runfiles")] - entry_point = "build_bazel_rules_typescript/internal/cypress_test/cypress_runner.js" - # disabled due to https://github.com/cypress-io/cypress/issues/1925 - # tags = tags + ["ibazel_notify_changes"] + # print(cypress_executable_path) - nodejs_test( - name = name, - tags = tags, - data = all_data, - entry_point = entry_point, - templated_args = ["$(location :%s_devmode_srcs.MF)" % name], - # testonly = 1, - expected_exit_code = expected_exit_code, - **kwargs - ) + ctx.actions.write( + output = ctx.outputs.executable, + is_executable = True, + content = """#!/usr/bin/env bash +readonly CYPRESS={TMPL_cypress} + +$CYPRESS open + + """.format(TMPL_cypress = cypress_executable_path)) + + print(ctx.files) + + return [DefaultInfo( + runfiles = ctx.runfiles( + files = ctx.files.srcs + ctx.files.deps + ctx.files.cypress, + transitive_files = files, + # Propagate karma_bin and its runfiles + collect_data = True, + collect_default = True, + ), + )] + +cypress_test = rule ( + implementation = _impl, + test = True, + # executable = True, + outputs = {"cypressjson": "cypress.json"}, + attrs = { + "deps": attr.label_list(), + "srcs": attr.label_list( + doc = "JavaScript source files", + allow_files = [".js"]), + "data": attr.label_list( + doc = "Runtime dependencies", + cfg = "data"), + "cypress": attr.label( + default = Label("//tools/cypress-rule:cypress_bin"), + executable = True, + cfg = "data", + single_file = False, + allow_files = True + ), + } +) From 8d774f4bb5fce7c5bc1305e2887385080796e159 Mon Sep 17 00:00:00 2001 From: Fabian Wiles Date: Mon, 5 Nov 2018 11:40:46 +1300 Subject: [PATCH 4/4] try different start script --- internal/cypress_test/cypress_test.bzl | 82 +++++++++++++++----------- 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/internal/cypress_test/cypress_test.bzl b/internal/cypress_test/cypress_test.bzl index 5884349a..92cf56d2 100644 --- a/internal/cypress_test/cypress_test.bzl +++ b/internal/cypress_test/cypress_test.bzl @@ -1,17 +1,3 @@ -# Copyright 2017 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - """NodeJS testing These rules let you run tests outside of a browser. This is typically faster @@ -19,44 +5,73 @@ than launching a test in Karma, for example. """ load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_test") load("@build_bazel_rules_nodejs//internal/common:devmode_js_sources.bzl", "devmode_js_sources") +CYPRESS_JSON_CONTENT = "{ \"integrationFolder\": \".\", \"video\": false, \"screenshots\": false, \"supportFile\": false }" + +def _short_path_to_manifest_path(ctx, short_path): + if short_path.startswith("../"): + return short_path[3:] + else: + return ctx.workspace_name + "/" + short_path def _impl(ctx): - cypressjson_content = "{ \"integrationFolder\": \".\", \"video\": false, \"screenshots\": false, \"supportFile\": false }" - ctx.actions.write(output = ctx.outputs.cypressjson, content = cypressjson_content) + conf = ctx.actions.declare_file("cypress.json") + ctx.actions.write(output = ctx.outputs.cypressjson, content = CYPRESS_JSON_CONTENT) + + # files = depset(ctx.files.srcs) + # for d in ctx.attr.deps: + # print(d.files) + # if hasattr(d, "node_sources"): + # files += d.node_sources + # elif hasattr(d, "files"): + # files += d.files files = depset(ctx.files.srcs) for d in ctx.attr.deps: - if hasattr(d, "node_sources"): - files += d.node_sources - elif hasattr(d, "files"): - files += d.files - - cypress_executable_path = ctx.executable.cypress.short_path - # if cypress_executable_path.startswith('..'): - # cypress_executable_path = "external" + cypress_executable_path[2:] - - # print(cypress_executable_path) + if hasattr(d, "node_sources"): + files = depset(transitive = [files, d.node_sources]) + elif hasattr(d, "files"): + files = depset(transitive = [files, d.files]) ctx.actions.write( output = ctx.outputs.executable, is_executable = True, content = """#!/usr/bin/env bash -readonly CYPRESS={TMPL_cypress} - +if [ -e "$RUNFILES_MANIFEST_FILE" ]; then + while read line; do + declare -a PARTS=($line) + if [ "${{PARTS[0]}}" == "{TMPL_cypress}" ]; then + readonly CYPRESS=${{PARTS[1]}} + fi + done < $RUNFILES_MANIFEST_FILE +else + readonly CYPRESS=../{TMPL_cypress} +fi +export HOME=$(mktemp -d) +ARGV=() +# Detect that we are running as a test, by using well-known environment +# variables. See go/test-encyclopedia +# Note: in Bazel 0.14 and later, TEST_TMPDIR is set for both bazel test and bazel run +# so we also check for the BUILD_WORKSPACE_DIRECTORY which is set only for bazel run +if [[ ! -z "${{TEST_TMPDIR}}" && ! -n "${{BUILD_WORKSPACE_DIRECTORY}}" ]]; then + ARGV+=( "run" ) +fi +# $CYPRESS ${{ARGV[@]}} +echo $CYPRESS $CYPRESS open + """.format(TMPL_cypress = _short_path_to_manifest_path(ctx, ctx.executable.cypress.short_path))) - """.format(TMPL_cypress = cypress_executable_path)) - - print(ctx.files) + cypress_runfiles = [conf] + ctx.files.srcs + ctx.files.data return [DefaultInfo( + files = depset([ctx.outputs.executable]), runfiles = ctx.runfiles( - files = ctx.files.srcs + ctx.files.deps + ctx.files.cypress, + files = cypress_runfiles, transitive_files = files, # Propagate karma_bin and its runfiles collect_data = True, collect_default = True, ), + executable = ctx.outputs.executable, )] cypress_test = rule ( @@ -71,7 +86,7 @@ cypress_test = rule ( allow_files = [".js"]), "data": attr.label_list( doc = "Runtime dependencies", - cfg = "data"), + cfg = "target"), "cypress": attr.label( default = Label("//tools/cypress-rule:cypress_bin"), executable = True, @@ -79,5 +94,6 @@ cypress_test = rule ( single_file = False, allow_files = True ), + } )