Skip to content

Commit

Permalink
fix: test setup
Browse files Browse the repository at this point in the history
refactor: change let to const

Co-Authored by Thakur Karthik<[email protected]>
  • Loading branch information
jamesgeorge007 committed Dec 23, 2019
1 parent ea6bd13 commit e771e33
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 5 deletions.
6 changes: 3 additions & 3 deletions __e2e__/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ test('shows up help if no arguments were passed', () => {

test('show up help information on passing in the respective options', () => {
['-h', '--help'].forEach(op => {
let { stdout } = run([op]);
const { stdout } = run([op]);
expect(stdout).toMatchSnapshot();
});
});

test('show up CLI version information', () => {
['-V', '--version'].forEach(op => {
let { stdout } = run([op]);
const { stdout } = run([op]);
expect(stdout).toMatchSnapshot();
});
});
Expand All @@ -41,4 +41,4 @@ test('warns the user if an unknown command is passed', () => {
test('suggests the matching command if the user makes a typo', () => {
const { stdout } = run(['ini']);
expect(stdout).toMatchSnapshot();
});
});
18 changes: 18 additions & 0 deletions __e2e__/commands/__snapshots__/info.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`mevn info 1`] = `
"
Environment Info:
System:
OS: Linux 5.0 Ubuntu 19.04 (Disco Dingo)
CPU: (2) x64 Intel(R) Pentium(R) CPU G2020 @ 2.90GHz
Binaries:
Node: 12.8.0 - /usr/local/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.13.1 - /usr/local/bin/npm
Browsers:
Chrome: 79.0.3945.88
Firefox: 71.0
"
`;
8 changes: 8 additions & 0 deletions __e2e__/commands/info.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

import { run } from '../../jest/helpers';

test('mevn info', async () => {
const { stdout } = await run(['info']);
expect(stdout).toMatchSnapshot();
});
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
...common,
displayName: 'e2e',
setupFiles: ['<rootDir>/jest/setupE2eTests.js'],
testMatch: ['<rootDir>/**/__e2e__/*{.,-}test.js'],
testMatch: ['<rootDir>/__e2e__/**/*.test.js'],
}
],
};
5 changes: 5 additions & 0 deletions jest/helpers.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
'use strict';

import 'babel-polyfill';
import execa from 'execa';
import path from 'path';

const CLI_PATH = path.resolve(process.cwd(), 'bin', 'mevn.js');

// sync version
export const run = args => execa.sync(CLI_PATH, args);

// async version
export const runAsync = async args => await execa(CLI_PATH, args);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}
},
"lint-staged": {
"*.js": "npm run lint"
"src/**/*.js": "npm run lint"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit e771e33

Please sign in to comment.