diff --git a/npm/grep/cypress/e2e/unit.js b/npm/grep/cypress/e2e/unit.js index b64558ae446e..0ade87a29418 100644 --- a/npm/grep/cypress/e2e/unit.js +++ b/npm/grep/cypress/e2e/unit.js @@ -14,6 +14,7 @@ describe('utils', () => { context('parseTitleGrep', () => { it('grabs the positive title', () => { const parsed = parseTitleGrep('hello w') + expect(parsed).to.deep.equal({ title: 'hello w', invert: false, @@ -22,6 +23,7 @@ describe('utils', () => { it('trims the string', () => { const parsed = parseTitleGrep(' hello w ') + expect(parsed).to.deep.equal({ title: 'hello w', invert: false, @@ -30,6 +32,7 @@ describe('utils', () => { it('inverts the string', () => { const parsed = parseTitleGrep('-hello w') + expect(parsed).to.deep.equal({ title: 'hello w', invert: true, @@ -38,6 +41,7 @@ describe('utils', () => { it('trims the inverted the string', () => { const parsed = parseTitleGrep(' -hello w ') + expect(parsed).to.deep.equal({ title: 'hello w', invert: true, @@ -46,6 +50,7 @@ describe('utils', () => { it('returns null for undefined input', () => { const parsed = parseTitleGrep() + expect(parsed).to.equal(null) }) }) @@ -53,6 +58,7 @@ describe('utils', () => { context('parseFullTitleGrep', () => { it('returns list of title greps', () => { const parsed = parseFullTitleGrep('hello; one; -two') + expect(parsed).to.deep.equal([ { title: 'hello', invert: false }, { title: 'one', invert: false }, @@ -65,6 +71,7 @@ describe('utils', () => { it('parses AND tags', () => { // run only the tests with all 3 tags const parsed = parseTagsGrep('@tag1+@tag2+@tag3') + expect(parsed).to.deep.equal([ // single OR part [ @@ -78,6 +85,7 @@ describe('utils', () => { it('handles dashes in the tag', () => { const parsed = parseTagsGrep('@smoke+@screen-b') + expect(parsed).to.deep.equal([ [ { tag: '@smoke', invert: false }, @@ -89,6 +97,7 @@ describe('utils', () => { it('parses OR tags spaces', () => { // run tests with tag1 OR tag2 or tag3 const parsed = parseTagsGrep('@tag1 @tag2 @tag3') + expect(parsed).to.deep.equal([ [{ tag: '@tag1', invert: false }], [{ tag: '@tag2', invert: false }], @@ -99,6 +108,7 @@ describe('utils', () => { it('parses OR tags commas', () => { // run tests with tag1 OR tag2 or tag3 const parsed = parseTagsGrep('@tag1,@tag2,@tag3') + expect(parsed).to.deep.equal([ [{ tag: '@tag1', invert: false }], [{ tag: '@tag2', invert: false }], @@ -108,11 +118,13 @@ describe('utils', () => { it('parses inverted tag', () => { const parsed = parseTagsGrep('-@tag1') + expect(parsed).to.deep.equal([[{ tag: '@tag1', invert: true }]]) }) it('parses tag1 but not tag2 with space', () => { const parsed = parseTagsGrep('@tag1 -@tag2') + expect(parsed).to.deep.equal([ [{ tag: '@tag1', invert: false }], [{ tag: '@tag2', invert: true }], @@ -121,6 +133,7 @@ describe('utils', () => { it('forgives extra spaces', () => { const parsed = parseTagsGrep(' @tag1 -@tag2 ') + expect(parsed).to.deep.equal([ [{ tag: '@tag1', invert: false }], [{ tag: '@tag2', invert: true }], @@ -129,6 +142,7 @@ describe('utils', () => { it('parses tag1 but not tag2 with comma', () => { const parsed = parseTagsGrep('@tag1,-@tag2') + expect(parsed).to.deep.equal([ [{ tag: '@tag1', invert: false }], [{ tag: '@tag2', invert: true }], @@ -137,15 +151,17 @@ describe('utils', () => { it('filters out empty tags', () => { const parsed = parseTagsGrep(',, @tag1,-@tag2,, ,, ,') + expect(parsed).to.deep.equal([ [{ tag: '@tag1', invert: false }], [{ tag: '@tag2', invert: true }], ]) }) - // would need to change the tokenizer + // TODO: would need to change the tokenizer it.skip('parses tag1 but not tag2', () => { const parsed = parseTagsGrep('@tag1-@tag2') + expect(parsed).to.deep.equal([ [ { tag: '@tag1', invert: false }, @@ -156,8 +172,9 @@ describe('utils', () => { it('allows all tags to be inverted', () => { const parsed = parseTagsGrep('--@tag1,--@tag2') + expect(parsed).to.deep.equal([ - [ { tag: '@tag1', invert: true }, { tag: '@tag2', invert: true } ] + [{ tag: '@tag1', invert: true }, { tag: '@tag2', invert: true }], ]) }) }) @@ -170,6 +187,7 @@ describe('utils', () => { it('creates just the title grep', () => { const parsed = parseGrep('hello w') + expect(parsed).to.deep.equal({ title: [ { @@ -183,6 +201,7 @@ describe('utils', () => { it('creates object from the grep string only', () => { const parsed = parseGrep('hello w') + expect(parsed).to.deep.equal({ title: [ { @@ -224,6 +243,7 @@ describe('utils', () => { it('creates object from the grep string and tags', () => { const parsed = parseGrep('hello w', '@tag1+@tag2+@tag3') + expect(parsed).to.deep.equal({ title: [ { @@ -251,6 +271,7 @@ describe('utils', () => { expect( shouldTestRun(parsed, ['@tag1', '@tag2', '@tag3', '@tag4']), ).to.equal(true) + // title matches, but tags do not expect(shouldTestRun(parsed, 'hello w', ['@tag1', '@tag2'])).to.equal( false, @@ -269,6 +290,7 @@ describe('utils', () => { // our parsing and decision logic computes the expected result const shouldIt = (used, tags, expected) => { const parsedTags = parseTagsGrep(used) + expect( shouldTestRunTags(parsedTags, tags), `"${used}" against "${tags}"`, @@ -308,29 +330,34 @@ describe('utils', () => { // and apply the first argument in shouldTestRun const checkName = (grep, grepTags) => { const parsed = parseGrep(grep, grepTags) + expect(parsed).to.be.an('object') return (testName, testTags = []) => { expect(testName, 'test title').to.be.a('string') expect(testTags, 'test tags').to.be.an('array') + return shouldTestRun(parsed, testName, testTags) } } it('simple tag', () => { const parsed = parseGrep('@tag1') + expect(shouldTestRun(parsed, 'no tag1 here')).to.be.false expect(shouldTestRun(parsed, 'has @tag1 in the name')).to.be.true }) it('with invert title', () => { const t = checkName('-hello') + expect(t('no greetings')).to.be.true expect(t('has hello world')).to.be.false }) it('with invert option', () => { const t = checkName(null, '-@tag1') + expect(t('no tags here')).to.be.true expect(t('has tag1', ['@tag1'])).to.be.false expect(t('has other tags', ['@tag2'])).to.be.true @@ -338,6 +365,7 @@ describe('utils', () => { it('with AND option', () => { const t = checkName('', '@tag1+@tag2') + expect(t('no tag1 here')).to.be.false expect(t('has only @tag1', ['@tag1'])).to.be.false expect(t('has only @tag2', ['@tag2'])).to.be.false @@ -346,20 +374,23 @@ describe('utils', () => { it('with OR option', () => { const t = checkName(null, '@tag1 @tag2') + expect(t('no tag1 here')).to.be.false expect(t('has only @tag1 in the name', ['@tag1'])).to.be.true expect(t('has only @tag2 in the name', ['@tag2'])).to.be.true expect(t('has @tag1 and @tag2 in the name', ['@tag1', '@tag2'])).to.be - .true + .true }) it('OR with AND option', () => { const t = checkName(null, '@tag1 @tag2+@tag3') + expect(t('no tag1 here')).to.be.false expect(t('has only @tag1 in the name', ['@tag1'])).to.be.true expect(t('has only @tag2 in the name', ['@tag2'])).to.be.false expect(t('has only @tag2 in the name and also @tag3', ['@tag2', '@tag3'])) - .to.be.true + .to.be.true + expect( t('has @tag1 and @tag2 and @tag3 in the name', [ '@tag1', @@ -371,8 +402,9 @@ describe('utils', () => { it('Multiple invert strings and a simple one', () => { const t = checkName('-name;-hey;number') + expect(t('number should only be matches without a n-a-m-e')).to.be.true - expect(t("number can't be name")).to.be.false + expect(t('number can\'t be name')).to.be.false expect(t('The man needs a name')).to.be.false expect(t('number hey name')).to.be.false expect(t('numbers hey name')).to.be.false @@ -382,8 +414,9 @@ describe('utils', () => { it('Only inverted strings', () => { const t = checkName('-name;-hey') - expect(t("I'm matched")).to.be.true - expect(t("hey! I'm not")).to.be.false + + expect(t('I\'m matched')).to.be.true + expect(t('hey! I\'m not')).to.be.false expect(t('My name is weird')).to.be.false }) }) @@ -391,6 +424,7 @@ describe('utils', () => { context('parseFullTitleGrep', () => { const shouldIt = (search, testName, expected) => { const parsed = parseFullTitleGrep(search) + expect( shouldTestRunTitle(parsed, testName), `"${search}" against title "${testName}"`, diff --git a/npm/webpack-preprocessor/package.json b/npm/webpack-preprocessor/package.json index 7f3d79b06ef9..d383f094a0ff 100644 --- a/npm/webpack-preprocessor/package.json +++ b/npm/webpack-preprocessor/package.json @@ -21,7 +21,10 @@ "lint": "eslint --ext .js,.jsx,.ts,.tsx,.json, ." }, "dependencies": { - "@babel/parser": "7.13.0", + "@babel/core": "^7.0.1", + "@babel/generator": "^7.17.9", + "@babel/parser": "^7.13.0", + "@babel/traverse": "^7.17.9", "bluebird": "3.7.1", "debug": "^4.3.2", "fs-extra": "^10.1.0", @@ -32,7 +35,6 @@ "webpack-virtual-modules": "^0.4.4" }, "devDependencies": { - "@babel/core": "^7.0.1", "@babel/plugin-proposal-nullish-coalescing-operator": "7.8.3", "@babel/preset-env": "^7.0.0", "@fellow/eslint-plugin-coffee": "0.4.13", diff --git a/tooling/v8-snapshot/cache/dev-darwin/snapshot-meta.cache.json b/tooling/v8-snapshot/cache/dev-darwin/snapshot-meta.cache.json index 7e77c05f0d64..7ea84bfd5d27 100644 --- a/tooling/v8-snapshot/cache/dev-darwin/snapshot-meta.cache.json +++ b/tooling/v8-snapshot/cache/dev-darwin/snapshot-meta.cache.json @@ -4,10 +4,6 @@ "./get-stream/buffer-stream.js", "./graceful-fs/polyfills.js", "./lockfile/lockfile.js", - "./node_modules/@babel/traverse/lib/path/comments.js", - "./node_modules/@babel/traverse/lib/path/conversion.js", - "./node_modules/@babel/traverse/lib/path/family.js", - "./node_modules/@babel/traverse/lib/path/introspection.js", "./node_modules/@cspotcode/source-map-support/source-map-support.js", "./node_modules/@cypress/commit-info/node_modules/debug/src/node.js", "./node_modules/@cypress/get-windows-proxy/node_modules/debug/src/node.js", @@ -44,6 +40,10 @@ "./node_modules/tcp-port-used/node_modules/debug/src/node.js", "./node_modules/trash/node_modules/make-dir/index.js", "./node_modules/utif/UTIF.js", + "./packages/config/node_modules/@babel/traverse/lib/path/comments.js", + "./packages/config/node_modules/@babel/traverse/lib/path/conversion.js", + "./packages/config/node_modules/@babel/traverse/lib/path/family.js", + "./packages/config/node_modules/@babel/traverse/lib/path/introspection.js", "./packages/data-context/node_modules/debug/src/node.js", "./packages/data-context/node_modules/minimatch/minimatch.js", "./packages/graphql/node_modules/debug/src/node.js", @@ -73,17 +73,6 @@ "deferred": [ "./node_modules/@babel/generator/lib/node/index.js", "./node_modules/@babel/generator/lib/node/whitespace.js", - "./node_modules/@babel/helper-environment-visitor/lib/index.js", - "./node_modules/@babel/traverse/lib/context.js", - "./node_modules/@babel/traverse/lib/index.js", - "./node_modules/@babel/traverse/lib/path/ancestry.js", - "./node_modules/@babel/traverse/lib/path/context.js", - "./node_modules/@babel/traverse/lib/path/index.js", - "./node_modules/@babel/traverse/lib/path/modification.js", - "./node_modules/@babel/traverse/lib/path/removal.js", - "./node_modules/@babel/traverse/lib/path/replacement.js", - "./node_modules/@babel/traverse/lib/scope/index.js", - "./node_modules/@babel/traverse/lib/traverse-node.js", "./node_modules/@babel/types/lib/definitions/core.js", "./node_modules/@babel/types/lib/definitions/experimental.js", "./node_modules/@babel/types/lib/definitions/flow.js", @@ -632,6 +621,15 @@ "./node_modules/xml2js/lib/xml2js.js", "./node_modules/yauzl/index.js", "./node_modules/zip-stream/index.js", + "./packages/config/node_modules/@babel/traverse/lib/context.js", + "./packages/config/node_modules/@babel/traverse/lib/index.js", + "./packages/config/node_modules/@babel/traverse/lib/path/ancestry.js", + "./packages/config/node_modules/@babel/traverse/lib/path/context.js", + "./packages/config/node_modules/@babel/traverse/lib/path/index.js", + "./packages/config/node_modules/@babel/traverse/lib/path/modification.js", + "./packages/config/node_modules/@babel/traverse/lib/path/removal.js", + "./packages/config/node_modules/@babel/traverse/lib/path/replacement.js", + "./packages/config/node_modules/@babel/traverse/lib/scope/index.js", "./packages/data-context/node_modules/chokidar/index.js", "./packages/data-context/node_modules/chokidar/lib/constants.js", "./packages/data-context/node_modules/chokidar/lib/fsevents-handler.js", @@ -816,18 +814,6 @@ "./node_modules/@babel/template/lib/parse.js", "./node_modules/@babel/template/lib/populate.js", "./node_modules/@babel/template/lib/string.js", - "./node_modules/@babel/traverse/lib/cache.js", - "./node_modules/@babel/traverse/lib/hub.js", - "./node_modules/@babel/traverse/lib/path/evaluation.js", - "./node_modules/@babel/traverse/lib/path/inference/index.js", - "./node_modules/@babel/traverse/lib/path/inference/inferer-reference.js", - "./node_modules/@babel/traverse/lib/path/inference/inferers.js", - "./node_modules/@babel/traverse/lib/path/lib/hoister.js", - "./node_modules/@babel/traverse/lib/path/lib/removal-hooks.js", - "./node_modules/@babel/traverse/lib/path/lib/virtual-types.js", - "./node_modules/@babel/traverse/lib/scope/binding.js", - "./node_modules/@babel/traverse/lib/scope/lib/renamer.js", - "./node_modules/@babel/traverse/lib/visitors.js", "./node_modules/@babel/types/lib/asserts/assertNode.js", "./node_modules/@babel/types/lib/asserts/generated/index.js", "./node_modules/@babel/types/lib/ast-types/generated/index.js", @@ -3295,6 +3281,18 @@ "./node_modules/yallist/yallist.js", "./node_modules/yn/index.js", "./node_modules/yn/lenient.js", + "./packages/config/node_modules/@babel/traverse/lib/cache.js", + "./packages/config/node_modules/@babel/traverse/lib/hub.js", + "./packages/config/node_modules/@babel/traverse/lib/path/evaluation.js", + "./packages/config/node_modules/@babel/traverse/lib/path/inference/index.js", + "./packages/config/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js", + "./packages/config/node_modules/@babel/traverse/lib/path/inference/inferers.js", + "./packages/config/node_modules/@babel/traverse/lib/path/lib/hoister.js", + "./packages/config/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js", + "./packages/config/node_modules/@babel/traverse/lib/path/lib/virtual-types.js", + "./packages/config/node_modules/@babel/traverse/lib/scope/binding.js", + "./packages/config/node_modules/@babel/traverse/lib/scope/lib/renamer.js", + "./packages/config/node_modules/@babel/traverse/lib/visitors.js", "./packages/data-context/node_modules/@babel/code-frame/lib/index.js", "./packages/data-context/node_modules/@babel/parser/lib/index.js", "./packages/data-context/node_modules/anymatch/index.js", @@ -3542,5 +3540,5 @@ "./tooling/v8-snapshot/cache/dev-darwin/snapshot-entry.js" ], "deferredHashFile": "yarn.lock", - "deferredHash": "7da54eecbd832d3cd8ba75441a83e8c69c033664f25df5a2e43c1794d9d149de" + "deferredHash": "5295dd77feda0712e2ad5cbd740abe54fc9e26f01b05c1f6e1c8256a65324250" } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 0b0a4e7a1b80..05c2950b35d2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1149,10 +1149,10 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.15.6.tgz#043b9aa3c303c0722e5377fef9197f4cf1796549" integrity sha512-S/TSCcsRuCkmpUuoWijua0Snt+f3ewU/8spLo+4AXJCZfT0bVCzLD5MuOKdrx0mlAptbKzn5AdgEIIKXxXkz9Q== -"@babel/parser@^7", "@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.1.6", "@babel/parser@^7.15.4", "@babel/parser@^7.15.8", "@babel/parser@^7.16.4", "@babel/parser@^7.16.5", "@babel/parser@^7.16.7", "@babel/parser@^7.17.9", "@babel/parser@^7.4.3", "@babel/parser@^7.6.0", "@babel/parser@^7.7.0", "@babel/parser@^7.9.0", "@babel/parser@^7.9.6": - version "7.19.1" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.19.1.tgz#6f6d6c2e621aad19a92544cc217ed13f1aac5b4c" - integrity sha512-h7RCSorm1DdTVGJf3P2Mhj3kdnkmF/EiysUkzS2TdgAYqyjFdMQJbVuXOBej2SBJaXan/lIVtT6KkGbyyq753A== +"@babel/parser@^7", "@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.1.6", "@babel/parser@^7.13.0", "@babel/parser@^7.15.4", "@babel/parser@^7.15.8", "@babel/parser@^7.16.4", "@babel/parser@^7.16.5", "@babel/parser@^7.16.7", "@babel/parser@^7.17.9", "@babel/parser@^7.4.3", "@babel/parser@^7.6.0", "@babel/parser@^7.7.0", "@babel/parser@^7.9.0", "@babel/parser@^7.9.6": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.5.tgz#7f3c7335fe417665d929f34ae5dceae4c04015e8" + integrity sha512-r27t/cy/m9uKLXQNWWebeCUHgnAZq0CpG1OwKRxzJMP1vpSU4bSIK2hq+/cp0bQxetkXx38n09rNu8jVkcK/zA== "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.16.7": version "7.16.7"