codeceptjs
Advanced tools
Comparing version 0.4.2 to 0.4.3
@@ -78,2 +78,3 @@ #!/usr/bin/env node | ||
.option('--trace', 'trace function calls') | ||
.option('--profile [value]', 'configuration profile to be used') | ||
@@ -80,0 +81,0 @@ .action(require('../lib/command/run')); |
@@ -0,1 +1,18 @@ | ||
## 0.4.3 | ||
* [Protractor] Regression fixed to ^4.0.0 support | ||
* Translations included into package. | ||
* `teardown` option added to config (opposite to `bootstrap`), expects a JS file to be executed after tests stop. | ||
* [Configuration](http://codecept.io/configuration/) can be set via JavaScript file `codecept.conf.js` instead of `codecept.json`. It should export `config` object: | ||
```js | ||
// inside codecept.conf.js | ||
exports.config = { | ||
// contents of codecept.json | ||
} | ||
``` | ||
* Added `--profile` option to pass its value to `codecept.conf.js` as `process.profile` for [dynamic configuration](http://codecept.io/configuration#dynamic-configuration). | ||
* Documentation for [StepObjects, PageFragments](http://codecept.io/pageobjects#PageFragments) updated. | ||
* Documentation for [Configuration](http://codecept.io/configuration/) added. | ||
## 0.4.2 | ||
@@ -9,2 +26,4 @@ | ||
* Fixed using of 3rd party reporters (xunit, mocha-junit-reporter, mochawesome). Added guide. | ||
* Documentation for [Translation](http://codecept.io/translation/) added. | ||
* Documentation for [Reports](http://codecept.io/reports/) added. | ||
@@ -11,0 +30,0 @@ ## 0.4.1 |
@@ -48,10 +48,14 @@ 'use strict'; | ||
// loading bootstrap | ||
if (this.config.bootstrap && fileExists(fsPath.join(dir, this.config.bootstrap))) { | ||
require(fsPath.join(dir, this.config.bootstrap)); | ||
this.bootstrap(); | ||
} | ||
// loading bootstrap | ||
bootstrap() { | ||
if (this.config.bootstrap && fileExists(fsPath.join(codecept_dir, this.config.bootstrap))) { | ||
require(fsPath.join(codecept_dir, this.config.bootstrap)); | ||
} | ||
} | ||
// loading teardown | ||
teardown() { | ||
// loading teardown | ||
if (this.config.teardown && fileExists(fsPath.join(codecept_dir, this.config.teardown))) { | ||
@@ -58,0 +62,0 @@ require(fsPath.join(codecept_dir, this.config.teardown)); |
@@ -15,2 +15,10 @@ 'use strict'; | ||
let configFile = path.join(testsPath, 'codecept.json'); | ||
if (!fileExists(configFile)) { | ||
console.log(); | ||
console.log(`${colors.bold.red(`codecept.conf.js config can't be updated automatically`)}`); | ||
console.log(`Please add generated object to "include" section of a config file`); | ||
console.log(); | ||
return; | ||
} | ||
console.log(`${colors.yellow(`Updating configuration file...`)}`); | ||
return fs.writeFileSync(configFile, JSON.stringify(config, null, 2)); | ||
@@ -17,0 +25,0 @@ } |
@@ -8,2 +8,5 @@ 'use strict'; | ||
module.exports = function (suite, test, options) { | ||
// registering options globally to use in config | ||
process.profile = options.profile; | ||
let testRoot = getTestRoot(suite); | ||
@@ -10,0 +13,0 @@ let config = getConfig(testRoot); |
@@ -15,6 +15,11 @@ 'use strict'; | ||
let config, | ||
jsConfigFile = path.join(testRoot, 'codecept.js'), | ||
jsConfigFile = path.join(testRoot, 'codecept.conf.js'), | ||
jsConfigFileDeprecated = path.join(testRoot, 'codecept.js'), | ||
jsonConfigFile = path.join(testRoot, 'codecept.json'); | ||
if (fileExists(jsConfigFile)) { | ||
config = require(jsConfigFile).config; | ||
} else if (fileExists(jsConfigFileDeprecated)) { | ||
console.log('Using codecept.js as configuration is deprecated, please rename it to codecept.conf.js'); | ||
config = require(jsConfigFileDeprecated).config; | ||
} else if (fileExists(jsonConfigFile)) { | ||
@@ -21,0 +26,0 @@ config = JSON.parse(fs.readFileSync(jsonConfigFile, 'utf8')); |
@@ -86,10 +86,17 @@ 'use strict'; | ||
let ptor = requireg('protractor'); | ||
// due to api changes in protractor we need to guess wrapper | ||
protractorWrapper = requireg('protractor').wrapDriver; | ||
if (!protractorWrapper) protractorWrapper = requireg('protractor').ProtractorBrowser.wrapDriver; | ||
if (!protractorWrapper) protractorWrapper = requireg('protractor').Browser.wrapDriver; | ||
protractorWrapper = ptor.wrapDriver; | ||
if (!protractorWrapper && ptor.Browser) protractorWrapper = ptor.Browser.wrapDriver; | ||
if (!protractorWrapper && ptor.ProtractorBrowser) protractorWrapper = ptor.ProtractorBrowser.wrapDriver; | ||
if (!protractorWrapper) throw Error('Current Protractor version is not supported'); | ||
EC = requireg('protractor').Browser.ExpectedConditions || requireg('protractor').ProtractorBrowser.ExpectedConditions; | ||
global.by = requireg('protractor').Browser.By || requireg('protractor').ProtractorBrowser.By; | ||
let browser = ptor.ProtractorBrowser ? ptor.ProtractorBrowser : ptor.Browser; | ||
EC = browser.ExpectedConditions; | ||
global.by = browser.By; | ||
if (!EC || !global.by) throw Error('Current Protractor version is not supported'); | ||
let driverProviderModule = requireg('protractor/built/driverProviders/'+this.options.driver); | ||
@@ -109,3 +116,3 @@ let className = Object.keys(driverProviderModule)[0]; | ||
} catch(e) { | ||
return ["protractor@^4.0.4"]; | ||
return ["protractor@^4.0.0"]; | ||
} | ||
@@ -112,0 +119,0 @@ } |
{ | ||
"name": "codeceptjs", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "Modern Era Aceptance Testing Framework for NodeJS", | ||
@@ -18,3 +18,4 @@ "homepage": "http://codecept.io", | ||
"bin", | ||
"lib" | ||
"lib", | ||
"translations" | ||
], | ||
@@ -21,0 +22,0 @@ "main": "lib/codecept.js", |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
198727
47
5685
21