From ddb0fc3ef6e7381f8b59546474e95632559b8996 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Sat, 23 Nov 2019 23:32:22 +0800 Subject: [PATCH] - Run tests against instrumented version, fixing instrumentation --- cypress/integration/accessibility.js | 2 +- cypress/integration/ui.js | 2 +- package-lock.json | 146 +++++++++++++++++++++++++++ package.json | 7 +- 4 files changed, 154 insertions(+), 3 deletions(-) diff --git a/cypress/integration/accessibility.js b/cypress/integration/accessibility.js index 530d44fe..448c5935 100644 --- a/cypress/integration/accessibility.js +++ b/cypress/integration/accessibility.js @@ -1,6 +1,6 @@ describe('Accessibility', function () { beforeEach(() => { - cy.visit('/editor/svg-editor-es.html'); + cy.visit('/instrumented/svg-editor-es.html'); cy.injectAxe(); }); diff --git a/cypress/integration/ui.js b/cypress/integration/ui.js index 4e197cbf..1cfbfd9c 100644 --- a/cypress/integration/ui.js +++ b/cypress/integration/ui.js @@ -5,7 +5,7 @@ import { describe('UI tests', function () { beforeEach(() => { - cy.visit('/editor/svg-editor-es.html'); + cy.visit('/instrumented/svg-editor-es.html'); // Ensure we test against English regardless of the original locale approveStorage(); openEditorPreferences(); diff --git a/package-lock.json b/package-lock.json index 58802fe2..ff4beea1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1927,6 +1927,15 @@ "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==", "dev": true }, + "add-filename-increment": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/add-filename-increment/-/add-filename-increment-1.0.0.tgz", + "integrity": "sha512-pFV8VZX8jxuVMIycKvGZkWF/ihnUubu9lbQVnOnZWp7noVxbKQTNj7zG2y9fXdPcuZ6lAN3Drr517HaivGCjdQ==", + "dev": true, + "requires": { + "strip-filename-increment": "^2.0.1" + } + }, "ajv": { "version": "6.10.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", @@ -3877,6 +3886,20 @@ "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", "dev": true }, + "copyfiles": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/copyfiles/-/copyfiles-2.1.1.tgz", + "integrity": "sha512-y6DZHve80whydXzBal7r70TBgKMPKesVRR1Sn/raUu7Jh/i7iSLSyGvYaq0eMJ/3Y/CKghwzjY32q1WzEnpp3Q==", + "dev": true, + "requires": { + "glob": "^7.0.5", + "minimatch": "^3.0.3", + "mkdirp": "^0.5.1", + "noms": "0.0.0", + "through2": "^2.0.1", + "yargs": "^13.2.4" + } + }, "core-js": { "version": "3.4.2", "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.4.2.tgz", @@ -5857,6 +5880,87 @@ "map-cache": "^0.2.2" } }, + "frs-replace": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/frs-replace/-/frs-replace-2.0.1.tgz", + "integrity": "sha512-sAQMn92WIgcBLik7JmOxZJRJpTBJ+rIFST8cmF6CUejNsJc5MJMPueevQ4bVGwLkTYwAMgsjCgwUC2QFlSeu3g==", + "dev": true, + "requires": { + "fast-glob": "^3.1.0", + "get-stdin": "^7.0.0", + "write": "^2.0.0", + "yargs": "^14.2.0" + }, + "dependencies": { + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "write": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/write/-/write-2.0.0.tgz", + "integrity": "sha512-yam9TAqN8sAZokECAejo9HpT2j2s39OgK8i8yxadrFBVo+iSWLfnipRVFulfAw1d2dz5vSuGmlMHYRKG4fysOA==", + "dev": true, + "requires": { + "add-filename-increment": "^1.0.0" + } + }, + "yargs": { + "version": "14.2.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-14.2.2.tgz", + "integrity": "sha512-/4ld+4VV5RnrynMhPZJ/ZpOCGSCeghMykZ3BhdFBDa9Wy/RH6uEGNWDJog+aUlq+9OM1CFTgtYRW5Is1Po9NOA==", + "dev": true, + "requires": { + "cliui": "^5.0.0", + "decamelize": "^1.2.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^15.0.0" + } + }, + "yargs-parser": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-15.0.0.tgz", + "integrity": "sha512-xLTUnCMc4JhxrPEPUYD5IBR1mWCK/aT6+RJ/K29JY2y1vD+FhtgKK0AXRWvI262q3QSffAQuTouFIKUuHX89wQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, "fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -8308,6 +8412,42 @@ "integrity": "sha512-gwQiR7weFRV8mAtT0x0kXkZ18dfRLB45xH7q0hCOVQMLfLb2f1ZaSvR57q4/b/Vj6B0RwMNJYbvb69e1yM7qEA==", "dev": true }, + "noms": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/noms/-/noms-0.0.0.tgz", + "integrity": "sha1-2o69nzr51nYJGbJ9nNyAkqczKFk=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "readable-stream": "~1.0.31" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + } + } + }, "normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", @@ -10687,6 +10827,12 @@ "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, + "strip-filename-increment": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-filename-increment/-/strip-filename-increment-2.0.1.tgz", + "integrity": "sha512-+v5xsiTTsdYqkPj7qz1zlngIsjZedhHDi3xp/9bMurV8kXe9DAr732gNVqtt4X8sI3hOqS3nlFfps5gyVcux6w==", + "dev": true + }, "strip-final-newline": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", diff --git a/package.json b/package.json index bcdfdf10..f5dc35b1 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,10 @@ "cypress:run": "cypress run", "open-report": "open http://localhost:8000/coverage/", "start-open-report": "run-p start open-report", - "instrument": "npx nyc instrument editor instrumented", + "instrument:replace-html": "FRS-replace \"../svgedit-config-es.js\" \"svgedit-config-es.js\" -i instrumented/svg-editor-es.html -o instrumented/svg-editor-es.html", + "instrument:replace-js": "FRS-replace \"editor/svg-editor.js\" \"svg-editor.js\" -i svgedit-config-es.js -o instrumented/svgedit-config-es.js", + "copy-instrumented": "copyfiles -e \"**/*.js\" -u 1 \"editor/**/*\" instrumented && npm run instrument:replace-html && npm run instrument:replace-js", + "instrument": "rm -Rf instrumented && npx nyc instrument editor instrumented && npm run copy-instrumented", "open-cov": "npm-run-all instrument --parallel --race start cypress:open", "open": "run-p start cypress:open", "report": "npx nyc report", @@ -105,6 +108,7 @@ "axe-core": "^3.4.0", "babel-plugin-transform-object-rest-spread": "^7.0.0-beta.3", "coffeescript": "^2.4.1", + "copyfiles": "^2.1.1", "core-js-bundle": "^3.4.2", "cypress": "^3.6.1", "cypress-axe": "^0.5.1", @@ -126,6 +130,7 @@ "eslint-plugin-sonarjs": "^0.5.0", "eslint-plugin-standard": "4.0.1", "eslint-plugin-unicorn": "^13.0.0", + "frs-replace": "^2.0.1", "imageoptim-cli": "^3.0.2", "jamilih": "^0.46.0", "jsdoc": "^3.6.3",