Skip to content
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(deps-dev): bump jest-extended from 3.0.2 to 3.1.0 #593

Merged
merged 3 commits into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,6 @@ jobs:
- name: Run tests
run: npm test

build-node12:
name: Test Suite (Node 12)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Use Node.js 12
uses: actions/setup-node@v3
with:
node-version: 12

- name: Install deps
run: npm ci

- name: Build dist
run: npm run build

# rdme doesn't work on Node 12 but we just want to run this single test to make sure that
# our "we don't support node 12" error is shown.
- name: Run tests
run: npx jest __tests__/bin.test.ts

action:
name: GitHub Action Dry Run
runs-on: ubuntu-latest
Expand Down
32 changes: 7 additions & 25 deletions __tests__/bin.test.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@
import { exec } from 'child_process';

import pkg from '../package.json';
import isSupportedNodeVersion from '../src/lib/isSupportedNodeVersion';

describe('bin', () => {
if (isSupportedNodeVersion(process.version)) {
it('should show our help screen', async () => {
expect.assertions(1);

await new Promise(resolve => {
exec(`node ${__dirname}/../bin/rdme`, (error, stdout) => {
expect(stdout).toContain('a utility for interacting with ReadMe');
resolve(true);
});
});
});
} else {
it('should fail with a message', async () => {
expect.assertions(1);
it('should show our help screen', async () => {
expect.assertions(1);

await new Promise(resolve => {
exec(`node ${__dirname}/../bin/rdme`, (error, stdout, stderr) => {
expect(stderr).toContain(
`We're sorry, this release of rdme does not support Node.js ${process.version}. We support the following versions: ${pkg.engines.node}`
);
resolve(true);
});
await new Promise(resolve => {
exec(`node ${__dirname}/../bin/rdme`, (error, stdout) => {
expect(stdout).toContain('a utility for interacting with ReadMe');
resolve(true);
});
});
}
});
});
14 changes: 0 additions & 14 deletions __tests__/lib/isSupportedNodeVersion.test.ts

This file was deleted.

157 changes: 146 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,11 @@ import updateNotifier from 'update-notifier';
import pkg from '../package.json';

import isGHA from './lib/isGitHub';
import isSupportedNodeVersion from './lib/isSupportedNodeVersion';

import rdme from '.';

updateNotifier({ pkg }).notify();

/**
* We use optional chaining throughout the library, which doesn't work on Node 12, so to curb
* support questions about why rdme is throwing an "Unexpected token '.'" error we should hard
* stop if we're being run with any Node version that we don't explicitly support.
*/
if (!isSupportedNodeVersion(process.version)) {
const message = `We're sorry, this release of rdme does not support Node.js ${process.version}. We support the following versions: ${pkg.engines.node}`;
// eslint-disable-next-line no-console
console.error(chalk.red(`\n${message}\n`));
process.exit(1);
}

rdme(process.argv.slice(2))
.then((msg: string) => {
// eslint-disable-next-line no-console
Expand Down
11 changes: 0 additions & 11 deletions src/lib/isSupportedNodeVersion.ts

This file was deleted.