Skip to content

Commit

Permalink
Merge pull request #78 from rwjblue/add-release-it-14-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue authored Sep 8, 2020
2 parents d5b6775 + f08bb07 commit 69ad9b2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 10 deletions.
32 changes: 25 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:

jobs:
build:
name: "Node ${{ matrix.node-version }}"

runs-on: ubuntu-latest

Expand All @@ -17,13 +18,30 @@ jobs:

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: install dependencies
run: yarn install --non-interactive
- name: lint
run: yarn lint:js
- name: test
run: yarn test
run: yarn install --non-interactive --frozen-lockfile
- run: yarn lint:js
- run: yarn test

release-it-compat:
name: "release-it@${{ matrix.release-it-version }}"

runs-on: ubuntu-latest

strategy:
matrix:
release-it-version: [13, 14]

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 14
- name: install dependencies
run: yarn install --non-interactive --frozen-lockfile
- run: yarn add --dev release-it@^${{ matrix.release-it-version }}
- run: yarn lint:js
- run: yarn test
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const { EOL } = require('os');
const fs = require('fs');
const which = require('which');
Expand Down Expand Up @@ -82,7 +84,7 @@ module.exports = class LernaChangelogGeneratorPlugin extends Plugin {

async _launchEditor(tmpFile) {
// do not launch the editor for dry runs
if (this.global.isDryRun) {
if (this.config.isDryRun) {
return;
}

Expand Down Expand Up @@ -155,7 +157,7 @@ module.exports = class LernaChangelogGeneratorPlugin extends Plugin {
}
}

if (this.global.isDryRun) {
if (this.config.isDryRun) {
this.log.log(`! Prepending ${infile} with release notes.`);
} else {
let currentFileData = hasInfile ? fs.readFileSync(infile, { encoding: 'utf8' }) : '';
Expand Down
4 changes: 3 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const fs = require('fs');
const path = require('path');
const tmp = require('tmp');
Expand Down Expand Up @@ -218,7 +220,7 @@ test('does not launch the editor for dry-run', async (t) => {

let plugin = buildPlugin({ infile, launchEditor: `${editor} \${file}` });

plugin.global.isDryRun = true;
plugin.config.options['dry-run'] = true;

await runTasks(plugin);

Expand Down

0 comments on commit 69ad9b2

Please sign in to comment.