Skip to content

Commit

Permalink
feat(lift): migrated the predicate public function to be named test
Browse files Browse the repository at this point in the history
to align with the form8ion convention

BREAKING CHANGE: `predicate` is now `test` to better align with the form8ion convention
  • Loading branch information
travi committed Jul 23, 2024
1 parent 326b251 commit 56c367a
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .remarkrc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#options
exports.settings = {
listItemIndent: 1,
listItemIndent: 'one',
emphasis: '_',
strong: '_',
bullet: '*',
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ $ npm install @form8ion/renovate-scaffolder --save-prod
#### Import

```javascript
import {lift, predicate as projectUsesRenovate, scaffold} from '@form8ion/renovate-scaffolder';
import {lift, test as projectUsesRenovate, scaffold} from '@form8ion/renovate-scaffolder';
```

#### Execute
Expand Down
2 changes: 1 addition & 1 deletion example.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// #### Import
// remark-usage-ignore-next
import stubbedFs from 'mock-fs';
import {lift, predicate as projectUsesRenovate, scaffold} from './lib/index.js';
import {lift, test as projectUsesRenovate, scaffold} from './lib/index.js';

// remark-usage-ignore-next
stubbedFs();
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"lint:engines": "ls-engines",
"test:integration": "run-s 'test:integration:base -- --profile noWip'",
"test:integration:base": "NODE_OPTIONS=--enable-source-maps DEBUG=any cucumber-js test/integration",
"pretest:integration:base": "npm run build",
"test:integration:debug": "DEBUG=test run-s test:integration",
"test:integration:wip": "run-s 'test:integration:base -- --profile wip'",
"test:integration:wip:debug": "DEBUG=test run-s 'test:integration:wip'",
Expand Down
2 changes: 1 addition & 1 deletion src/lift/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export {default as lift} from './lift.js';
export {default as predicate} from './predicate.js';
export {default as test} from './predicate.js';
1 change: 1 addition & 0 deletions test/integration/features/lift/badge.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Feature: Badge

Scenario: define a renovate badge
Given the project uses a renovate config with the modern filename
When the scaffolder results are processed
Then the renovate badge details are defined
1 change: 1 addition & 0 deletions test/integration/features/lift/branches.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Feature: Branches

Scenario: enable verification of renovate branches
Given the project uses a renovate config with the modern filename
When the scaffolder results are processed
Then renovate branches are suggested for verification
9 changes: 6 additions & 3 deletions test/integration/features/step_definitions/common-steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import {fileURLToPath} from 'node:url';
import stubbedFs from 'mock-fs';
import {After, Before, When} from '@cucumber/cucumber';

let lift;
let lift, test;

const __dirname = dirname(fileURLToPath(import.meta.url)); // eslint-disable-line no-underscore-dangle
const stubbedNodeModules = stubbedFs.load(resolve(__dirname, '..', '..', '..', '..', 'node_modules'));

Before(async function () {
this.projectRoot = process.cwd();
// eslint-disable-next-line import/no-extraneous-dependencies,import/no-unresolved
({lift} = await import('@form8ion/renovate-scaffolder'));
({lift, test} = await import('@form8ion/renovate-scaffolder'));

stubbedFs({
node_modules: stubbedNodeModules
Expand All @@ -23,5 +24,7 @@ After(function () {
});

When('the scaffolder results are processed', async function () {
this.result = await lift();
if (await test({projectRoot: this.projectRoot})) {
this.result = await lift({projectRoot: this.projectRoot});
}
});
8 changes: 8 additions & 0 deletions test/integration/features/step_definitions/config-steps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {promises as fs} from 'node:fs';

import {Given} from '@cucumber/cucumber';
import any from '@travi/any';

Given('the project uses a renovate config with the modern filename', async function () {
await fs.writeFile(`${this.projectRoot}/.renovaterc.json`, JSON.stringify(any.simpleObject()));
});

0 comments on commit 56c367a

Please sign in to comment.