Skip to content

Commit

Permalink
update hammerhead and remove unnecessary util methods (#2041)
Browse files Browse the repository at this point in the history
* update hammerhead and remove unnecessary util methods

* fix tests

* update version
  • Loading branch information
miherlosev authored and AlexanderMoskovkin committed Jan 12, 2018
1 parent b957956 commit b474763
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .publishrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"gitTag": true
},
"confirm": true,
"publishTag": "latest",
"publishTag": "dev",
"prePublishScript": "gulp test-server",
"postPublishScript": "gulp docker-publish"
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "testcafe",
"description": "Automated browser testing for the modern web development stack.",
"license": "MIT",
"version": "0.18.6",
"version": "0.18.7-dev20180112",
"author": {
"name": "Developer Express Inc.",
"url": "https://www.devexpress.com/"
Expand Down Expand Up @@ -102,7 +102,7 @@
"stack-chain": "^1.3.6",
"strip-bom": "^2.0.0",
"testcafe-browser-tools": "1.4.6",
"testcafe-hammerhead": "12.1.6",
"testcafe-hammerhead": "12.1.7",
"testcafe-legacy-api": "3.1.4",
"testcafe-reporter-json": "^2.1.0",
"testcafe-reporter-list": "^2.1.0",
Expand Down
17 changes: 2 additions & 15 deletions src/api/test-run-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,6 @@ import BabelPromise from 'babel-runtime/core-js/promise';
const TRACKING_MARK_RE = /^\$\$testcafe_test_run\$\$(\S+)\$\$$/;
const STACK_CAPACITY = 5000;

// Utils
// NOTE: testRunId may contain '-' which is not allowed in function names.
// But it's guaranteed that it will never contain '$'
// (see: https://github.com/dylang/shortid#charactersstring)
// So we use '$' to encode '-'.
function encodeTestRunId (testRunId) {
return testRunId.replace(/-/g, '$');
}

function decodeTestRunId (testRunId) {
return testRunId.replace(/\$/g, '-');
}

// Tracker
export default {
enabled: false,
Expand Down Expand Up @@ -74,7 +61,7 @@ export default {

addTrackingMarkerToFunction (testRunId, fn) {
var markerFactoryBody = `
return function $$testcafe_test_run$$${encodeTestRunId(testRunId)}$$ () {
return function $$testcafe_test_run$$${testRunId}$$ () {
switch (arguments.length) {
case 0: return fn.call(this);
case 1: return fn.call(this, arguments[0]);
Expand Down Expand Up @@ -102,7 +89,7 @@ export default {
var match = fnName && fnName.match(TRACKING_MARK_RE);

if (match)
return decodeTestRunId(match[1]);
return match[1];
}

return null;
Expand Down
2 changes: 1 addition & 1 deletion test/server/test-run-tracker-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('Test run tracker', function () {
function runTest (testName) {
var src = 'test/server/data/test-run-tracking/' + testName;
var compiler = new Compiler([src]);
var testRunMock = { id: 'dB_J4h-H' };
var testRunMock = { id: 'dB_J4h0H' };
var expected = fill(Array(3), testRunMock.id);

return compiler.getTests()
Expand Down

0 comments on commit b474763

Please sign in to comment.