Skip to content

Commit

Permalink
e2e test running Jest programmatically
Browse files Browse the repository at this point in the history
  • Loading branch information
jeysal authored and SimenB committed Jan 26, 2019
1 parent 6b69ee8 commit a126260
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
19 changes: 19 additions & 0 deletions e2e/__tests__/runProgramatically.test.js
@@ -0,0 +1,19 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

import {resolve} from 'path';

import {run} from '../Utils';

const dir = resolve(__dirname, '..', 'run-programatically');

test('run Jest programatically', () => {
const {stdout} = run(`node index.js --version`, dir);
expect(stdout).toMatch(/\d{2}\.\d{1,2}\.\d{1,2}[\-\S]*-dev$/);
});
13 changes: 13 additions & 0 deletions e2e/run-programatically/index.js
@@ -0,0 +1,13 @@
#!/usr/bin/env node
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

// Running Jest like this is not officially supported,
// but it is common practice until there is a proper API as a substitute.
require('jest').run(process.argv);

0 comments on commit a126260

Please sign in to comment.