-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: replace hermione tokens #895
Conversation
822056e
to
d3f3776
Compare
@@ -862,7 +862,7 @@ If you want to extend testplane.ctx typings, you could use module augmentation: | |||
import type { TestplaneCtx } from "testplane"; | |||
|
|||
declare module "testplane" { | |||
interface HermioneCtx { | |||
interface TestplaneCtx { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed interface name in README.
You can still use HermioneCtx
though
"name": "hermione", | ||
"version": "8.7.2", | ||
"name": "testplane", | ||
"version": "0.0.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first ready version will be marked as 0.1.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to change to 0.1.0 in the file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be made automatically. With npm run release
@@ -72,6 +69,6 @@ export abstract class BaseHermione extends AsyncEmitter { | |||
} | |||
|
|||
protected _loadPlugins(): void { | |||
pluginsLoader.load(this, this.config.plugins, PREFIX); | |||
pluginsLoader.load(this, this.config.plugins, "hermione-"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using hard-coded "hermione-"
here, because it no longer depends on package.json
-s name, and we are not planning to add ability to use implicit plugin names in Testplane.
/** | ||
* @deprecated Use `testplaneCtx` instead | ||
*/ | ||
hermioneCtx: ExecutionThreadToolCtx; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
map: (value, _, __, { isSetByUser }) => { | ||
const deprecatedScreensPath = "hermione/screens"; | ||
|
||
if (!isSetByUser && fs.existsSync(deprecatedScreensPath) && !fs.existsSync(value)) { | ||
return deprecatedScreensPath; | ||
} | ||
|
||
return value; | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If user uses default value, we check for "hermione/screens" folder. If it exists, and "testplane/screens" does not, switch to "hermione/screens"
Only works when default value is untouched, and new default directory does not exist, but old one - does
global.testplane = toolGlobals; | ||
global.hermione = toolGlobals; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all public api instances of hermione*
are also exported as copies (with Object.is equality) for testplane*
@@ -528,6 +529,66 @@ describe("config browser-options", () => { | |||
assert.equal(config.browsers.b1.screenshotsDir, "/some/dir"); | |||
assert.equal(config.browsers.b2.screenshotsDir, "/screens"); | |||
}); | |||
|
|||
it("should fallback default value to hermione/screens, if it exists and default dir not exists", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New logic tests added in this file
it("should parse comma seperated env value", () => { | ||
process.env.foo = "a, b,c"; | ||
|
||
assert.deepEqual(env.parseCommaSeparatedValue("foo"), ["a", "b", "c"]); | ||
const { key, value } = env.parseCommaSeparatedValue("foo"); | ||
assert.deepEqual(value, ["a", "b", "c"]); | ||
assert.equal(key, "foo"); | ||
}); | ||
|
||
it("should fallback to other env keys", () => { | ||
process.env.foo = "a, b,c"; | ||
|
||
const { key, value } = env.parseCommaSeparatedValue(["bar", "foo"]); | ||
assert.deepEqual(value, ["a", "b", "c"]); | ||
assert.equal(key, "foo"); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And these ones
// testplane does not support its own plugin prefixes. | ||
it("should load plugins with deprecated hermione prefix", () => { | ||
Testplane.create(); | ||
|
||
assert.calledWith(pluginsLoader.load, sinon.match.any, sinon.match.any, "hermione-"); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loading plugins with implicit "testplane-" or "@testplane/" would not be supported.
Testplane = proxyquire("src/testplane", { | ||
"./reporters": { initReporters }, | ||
}).Hermione; | ||
"./signal-handler": signalHandler, | ||
}).Testplane; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, after renaming, signalHandler
was interfering from other files, so one tests was failing, when launched with all other test files.
screenshotsDir: option({ | ||
defaultValue: defaultFactory("screenshotsDir"), | ||
validate: value => { | ||
if (!_.isString(value) && !_.isFunction(value)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest not using lodash where possible.
if (typeof value === "string" || typeof value === "function") {
return;
}
throw new Error('"screenshotsDir" must be a string or function');
d3f3776
to
068df03
Compare
068df03
to
a23643b
Compare
What is done
Changed
hermione
totestplane
in all necessary places.Public api change list:
HERMIONE_SETS
andHERMIONE_SKIP_BROWSERS
env vars, you can useTESTPLANE_
analogsscreenshotsDir
default value changed. But if default value is used and there is"hermione/screens"
directory, but no"testplane/screens"
(new default) directory, deprecated path will be chosenhermione*"
-stuff, marked allhermione*
stuff asdeprecated